MCP Python SDK
by Model Context Protocol
The official Python implementation of MCP — servers, clients and every transport.
Overview
The MCP Python SDK is the official Python implementation of the Model Context Protocol, MIT-licensed, requiring Python 3.10 or newer, and carrying roughly 23.9k stars and 3.8k forks. It covers both halves of the protocol. On the server side, decorated and type-hinted Python functions become MCP endpoints directly — the README's headline example is a server in fifteen lines where an @mcp.tool()-decorated `add(a: int, b: int) -> int` needs no hand-written JSON Schema, no validation code and no protocol plumbing. On the client side, a Client connects to a local in-process server, a stdio subprocess or a remote HTTP endpoint with the same API, giving you a client in about ten lines. Transports covered are stdio, Streamable HTTP and SSE. An optional `cli` extra installs the command-line tools — `mcp dev` opens a server in the MCP Inspector, `mcp run` executes one, and `mcp install` registers it with a host application — and a `rich` extra improves terminal output. Version history is the thing to check before you copy code: the package on PyPI reached 2.0.0 on 28 July 2026, a major rework tracking the 2026-07-28 MCP specification revision, while the 1.x line continues in maintenance (1.29.0 shipped the same day). The v2 rewrite reworked the protocol layer, moved protocol types out into a separate package and changed the low-level server's handler model, so 1.x tutorials do not translate cleanly. The SDK also has a lineage worth knowing: FastMCP 1.0 was the high-level API incorporated into this SDK in 2024, and the standalone FastMCP project continues separately on top of it.
At a Glance
- Topic
- MCP
- Level
- Intermediate
- Format
- Documentation
- Cost
- Free
- Duration
- Self-paced reference; the README quickstart is a 15-line server
- Provider
- Model Context Protocol
- Hands-on
- Yes — code/exercises
- Certificate
- None
What You’ll Learn
- ✓Build an MCP server from type-hinted Python functions with no schema boilerplate
- ✓Expose tools, resources and prompts and have inputs validated automatically
- ✓Write an MCP client that connects to in-process, stdio or remote HTTP servers
- ✓Choose between stdio, Streamable HTTP and SSE transports for a deployment
- ✓Use the mcp CLI to run, inspect and install servers during development
- ✓Understand what changed in the v2 rework for the 2026-07-28 specification
- ✓Trace protocol behaviour against the reference implementation when a client misbehaves
Highlights
- •The official implementation — the tiebreaker when a spec detail is ambiguous
- •Server and client in one package, so you can test both halves without a second dependency
- •v2.0.0 landed the same day as the 2026-07-28 spec revision, so it tracks the protocol closely
- •Ships CLI tooling (mcp dev/run/install) rather than leaving the dev loop to you
- •MIT-licensed with roughly 23.9k stars and 3.8k forks, so integration problems are well-trodden
Who It’s For
Best For
- ✓Python engineers implementing MCP servers or clients
- ✓Developers debugging protocol-level behaviour against a reference implementation
- ✓Teams deciding between the official SDK and a higher-level framework
Prerequisites
- •Comfortable Python including type hints, decorators and async/await
- •Python 3.10 or newer
- •Basic familiarity with MCP's tools, resources and prompts
FAQ
What is MCP Python SDK?
The official Python SDK for the Model Context Protocol, covering both sides of the protocol: servers that expose tools, resources and prompts, and clients that connect to any MCP server over stdio, Streamable HTTP or SSE. Decorated, type-hinted Python functions become MCP endpoints with no hand-written JSON Schema. This is the ground-truth implementation to check a behaviour against.
Is MCP Python SDK free?
MCP Python SDK is free to access.
What level is MCP Python SDK for?
MCP Python SDK is aimed at a intermediate audience. Recommended background: Comfortable Python including type hints, decorators and async/await, Python 3.10 or newer, Basic familiarity with MCP's tools, resources and prompts.
How long does MCP Python SDK take?
Expect roughly Self-paced reference; the README quickstart is a 15-line server. Most learners work through it at their own pace.
What will I learn from MCP Python SDK?
You'll learn: Build an MCP server from type-hinted Python functions with no schema boilerplate; Expose tools, resources and prompts and have inputs validated automatically; Write an MCP client that connects to in-process, stdio or remote HTTP servers; Choose between stdio, Streamable HTTP and SSE transports for a deployment; Use the mcp CLI to run, inspect and install servers during development; Understand what changed in the v2 rework for the 2026-07-28 specification; Trace protocol behaviour against the reference implementation when a client misbehaves.
Topics
Sources
This page was written from 3 sources, 2 on domains other than github.com.