1:1 mentoring with Big Tech AI engineers
RAG & MCP

Building MCP Servers

Build a CRM MCP server on the current SDKs (Python mcp 2.x, with a TypeScript twin): the smallest server, type hints as the tool schema, rejecting bad input, resources and prompts, running it under the Inspector, and testing it before a model does.

Last updated

Core12 min readFirst readMCP ArchitectureTool Surface Design

After this section you can

  • Build an MCP server on the current Python SDK and read the tool schema it derives from your type hints
  • Make bad input fail loudly with Literal and Field limits, and say what still needs authorization on the server
  • Run the server under the Inspector and test it with an in-memory client before any model calls it
03

Building MCP Servers: From Eight Lines to Tested

Type hints become the tool schema, bad input fails loudly, and a test finds the first mistake before a model does.

Key idea

An MCP server is ordinary functions with a decorator. The SDK reads each signature and docstring, publishes it as the tool a model sees, and rejects calls that do not fit. This page builds one for Acme’s CRM on mcp 2.x, revision 2026-07-28, and tests it without a model.

Your signature is the tool schema
SERVER.PY · WHAT YOU WRITE from mcp.server import MCPServer mcp = MCPServer("acme-crm") @mcp.tool() def get_account(account_id: str) -> str: """Look up one account by id.""" return "Acme Corp, active" if __name__ == "__main__": mcp.run() nameinputSchemaoutputSchemadescription TOOLS/LIST RETURNS · TRIMMED { "name": "get_account", "description": "Look up one account by id.", "inputSchema": { "properties": {"account_id": {"type": "string"}}, "required": ["account_id"]}, "outputSchema": { "properties": {"result": {"type": "string"}}, "required": ["result"]}}

Captured from mcp 2.2.0 and 2.3.0, trimmed (step 2). The host sends the model name, description and inputSchema (Inside a Tool Call); outputSchema is for the client.

Related

More in RAG & MCP

Get full access to all 149 sections with code examples, diagrams, and interactive animations.

Unlock Premium