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

  • Harness Bridge

    SDK / Tool

    A local launcher that points Claude Code and seven other coding harnesses at any OpenAI-, Anthropic- or Responses-compatible endpoint — without editing a single config file.

    • launcher
    • local-models
    • cli
    • menu-bar
  • Claude for Siri

    SDK / Tool

    Answers macOS Spotlight and Siri prompts with your signed-in Claude Code account — an experimental macOS 27 model-delegation provider.

    • macos
    • siri
    • spotlight
    • model-delegation
  • Extract your own local chat history from ten AI coding assistants into one normalized JSONL — for fine-tuning, analytics, or backing up years of conversations. Standard library only.

    • cli
    • data-export
    • jsonl
    • backup