ClaudeMap

MCP Python SDK

Official Python SDK for building MCP servers and clients.

SDKs & Toolingofficialmcpsdkpython

Official Python SDK for building MCP servers and clients. Maintained by the modelcontextprotocol organisation; supports asyncio, FastMCP-style decorators, and Streamable HTTP transport.

What it does

  • The official Python SDK for MCP clients and servers, maintained by modelcontextprotocol
  • Decorator-based MCPServer API for tools/resources/prompts, plus low-level classes for full protocol control
  • asyncio-first with sync/async transports: stdio and Streamable HTTP out of the box
  • Ships 2.x now — v1.x continues on a maintenance branch receiving security fixes

When to use it

The canonical way to write an MCP server in Python on the official implementation (FastMCP the framework is a friendly layer on the same protocol). Also the client SDK for embedding MCP in Python agents — pair with claude-agent-sdk-python when you need the full agent loop.

Getting started

pip install "mcp[cli]"
# or
uv add "mcp[cli]"

Minimal server (2.x):

from mcp.server import MCPServer

mcp = MCPServer("Demo")

@mcp.tool()
def add(a: int, b: int) -> int:
    return a + b

Things to know

2.x renamed APIs relative to 1.x (FastMCP import became MCPServer) — pin mcp<2 until you migrate; the v1.x branch keeps getting security patches. stdio needs no extra setup; HTTP transports and the dev inspector want the [cli] extra.

Repository

modelcontextprotocol/python-sdk

Charted

Related on the map

  • E2B

    SDK / Tool

    Open-source secure sandboxes where AI agents run code — the de facto execution layer for agent apps.

    • sandbox
    • code-execution
    • sdk
    • agents
  • FastMCP

    SDK / Tool

    Pythonic framework for building MCP servers — decorators, type hints, and zero boilerplate.

    • framework
    • python
    • mcp
    • type-driven
  • Anthropic's official TypeScript SDK for building agentic applications.

    • official
    • sdk
    • typescript
    • anthropic