Skip to content

MCP Python SDK

Official Python SDK for building Model Context Protocol servers and clients, rewritten for the 2026-07-28 spec.

Reviewed by Sheela · Updated

View on GitHub Open source

Our rating

4.4/5

The spec-first way to build MCP in Python; version 2 is cleaner, and it breaks every v1 import on the way.

What it is

The Model Context Protocol (MCP) is a standard way for AI apps to connect to tools and data. This is the official Python SDK for writing MCP servers (which expose tools) and clients (which use them). There is also an official TypeScript SDK, plus Go and C# SDKs.

Version 2.0 shipped on 28 July 2026 alongside the 2026-07-28 spec revision. The FastMCP class was renamed MCPServer, a single Client object replaced the older session layering, and WebSocket transport was removed. Servers still answer older clients.

The 1.x line is in maintenance mode with security fixes only.

Our review

This is the reference Python implementation of the Model Context Protocol, and it tracks the spec before anyone else. Version 2.0 shipped on 28 July 2026 alongside the 2026-07-28 spec revision and serves both that revision and 2025-11-25 at once, so a v2 server still answers older clients with nothing to configure. The latest release is v2.3.0, from 2 October 2026.

The migration is the cost. FastMCP became MCPServer, the module path moved, get_context() went away, transport settings moved from the constructor to run(), and the low-level Server was rebuilt around constructor arguments instead of decorators. Old paths were removed rather than deprecated. The WebSocket transport, never part of the spec, is gone, as is the experimental Tasks API. The 1.x line stays in maintenance with security fixes, but no end date is published; pinning mcp>=1.28,<2 is the documented holding pattern.

Security work has been heavy. The repository has published 12 advisories, including a high-severity bug where Streamable HTTP sessions were never reclaimed by default (fixed in 1.30.0 and 2.2.0) and a bearer-token check that accepted tokens issued for a different resource server. Anyone running an HTTP server on 2.0 or 2.1 should upgrade.

The standalone FastMCP project, now at v4.1.3 under PrefectHQ, has about 28,200 stars against this SDK's 24,700 and layers more conveniences on top. The official SDK is the leaner choice where exact spec behaviour matters more than extras.

Where it earns its place

  • A backend developer exposing an internal Postgres-backed API to Claude and other MCP clients

    Ship an MCP server the security team will sign off

    Write tools as decorated functions on MCPServer, run it over Streamable HTTP behind your auth, and stay on 2.2.0 or later for the session-reclaim and token-audience fixes. A first server is a few dozen lines.

  • A platform team maintaining ten v1 MCP servers

    Plan the move to v2 without breaking clients

    Pin mcp>=1.28,<2 to keep security fixes, then migrate one server at a time using the migration guide's before-and-after list. Because v2 serves both spec revisions, clients do not need to change at the same time.

  • An engineering manager choosing a Python MCP stack for a new product

    Decide between the official SDK and FastMCP

    The official SDK is MIT, maintained by the MCP project and tracks the spec first; FastMCP adds more batteries on top. Either is free, so the choice is about spec fidelity versus convenience and upgrade churn.

Before you commit

Setup
uv add "mcp[cli]" or pip install "mcp[cli]" on Python 3.10+; uv run mcp run server.py --transport streamable-http starts a server. A decorated tool and a first call take minutes.
Integrations
Works with any MCP client, including Claude apps and agent frameworks; ships a Client for calling servers over stdio or Streamable HTTP, and sister SDKs exist in TypeScript, Go and C#. Wire types live in a separate mcp-types package.
Data and privacy
A library: it sends nothing anywhere itself. Your server sees whatever its tools can reach, so authentication and scoping are your job. 12 advisories published, including session leakage over Streamable HTTP and a client that fetched server-chosen $ref URLs during schema validation.
Cost at scale
Free under MIT. Hosting a server is ordinary Python web hosting; 2026-era requests carry no session, which removes sticky-session routing from the hosting problem.
Limits
About 370 open issues. On 2026-era connections server-initiated requests are gone, so ctx.elicit() fails and Resolve(...) replaces it; roots, sampling and protocol logging are deprecated, and ping is removed.

What's good

  • First to implement new spec revisions
  • v2 servers answer both 2026-07-28 and 2025-11-25 clients
  • Decorators for tools, resources and prompts on MCPServer
  • stdio, Streamable HTTP and SSE transports

What's not

  • v2 removed v1 import paths outright
  • WebSocket transport and Tasks API dropped
  • 12 security advisories; 2.0 and 2.1 need upgrading
  • Fewer extras than standalone FastMCP

Best for

Python developers building MCP servers or clients who want the official, spec-tracking implementation.

Alternatives

MCP Python SDK: common questions

Is MCP Python SDK worth it?
The spec-first way to build MCP in Python; version 2 is cleaner, and it breaks every v1 import on the way. We rate it 4.4 out of 5.
How much does MCP Python SDK cost?
Free and open source under the MIT licence.
What are the downsides of MCP Python SDK?
v2 removed v1 import paths outright; webSocket transport and Tasks API dropped; 12 security advisories; 2.0 and 2.1 need upgrading; fewer extras than standalone FastMCP.
Who is MCP Python SDK best for?
Python developers building MCP servers or clients who want the official, spec-tracking implementation.
How much does MCP Python SDK cost for a team or in production?
Free under MIT. Hosting a server is ordinary Python web hosting; 2026-era requests carry no session, which removes sticky-session routing from the hosting problem.
Is MCP Python SDK safe for company data?
A library: it sends nothing anywhere itself. Your server sees whatever its tools can reach, so authentication and scoping are your job. 12 advisories published, including session leakage over Streamable HTTP and a client that fetched server-chosen $ref URLs during schema validation.
What are the best MCP Python SDK alternatives?
The closest alternatives we have reviewed are OpenAI Agents SDK and Pydantic AI.

Answers checked Oct 23, 2026.

Make MCP Python SDK? Show this rating on your siteMCP Python SDK rated 4.4 out of 5 on ReviewRamble