Files
Max Isbey 59c066dfce Present v2 as the stable release across the README, docs, and policies
The README, the get-started docs, the What's new page, SECURITY.md, and
the contributor docs all still described v2 as a pre-release: pin an
exact 2.0.0b1, do not use in production, v1.x is the only stable line.
This flips that framing for the stable release. Install lines become
plain `mcp[cli]` (the launch-command page keeps only the exact pin that
`mcp install` itself writes), the pre-release banners and pin warnings
go away, the What's new page drops its beta note and the two stale
"since 2.0.0bN" provenance markers, and SECURITY.md gains a
supported-versions table (2.x current, 1.28.x maintenance).

v1.x is presented as the maintenance line throughout, with its docs at
/v1/ and a `<2` bound for projects that are not ready to migrate. The
branching-model text in AGENTS.md and CONTRIBUTING.md now describes main
as the stable line, and the v2 feedback issue template loses its
pre-release wording and the v2-alpha label.

No-Verification-Needed: doc-only
2026-07-26 09:41:35 +00:00

3.4 KiB

MCP Python SDK

!!! info "This documents v2, the current stable release line" New to v2, or coming from v1? What's new in v2 is the five-minute tour of what changed, and the Migration Guide covers every breaking change. Still on v1.x? Its documentation lives at the v1.x docs. Something rough or confusing? Tell us.

The Model Context Protocol (MCP) lets applications provide context to LLMs in a standardized way, separating the concern of providing context from the LLM interaction itself.

This is the official Python SDK for it. With it you can:

  • Build MCP servers that expose tools, resources, and prompts to any MCP host.
  • Build MCP clients that connect to any MCP server.
  • Speak every standard transport: stdio, Streamable HTTP, and SSE.

Requirements

Python 3.10+.

Installation

=== "uv"

```bash
uv add "mcp[cli]"
```

=== "pip"

```bash
pip install "mcp[cli]"
```

The [cli] extra gives you the mcp command; you'll want it for development. See Installation for what each dependency is for.

Example

Create it

Create a file server.py:

--8<-- "docs_src/index/tutorial001.py"

That's a complete MCP server.

It exposes one tool, add, and one templated resource, greeting://{name}.

Run it

uv run mcp dev server.py

This starts your server and opens the MCP Inspector, an interactive UI for poking at it. Open the URL it prints.

!!! note The Inspector is a Node.js app, so mcp dev needs npx on your PATH.

Try it

In the Inspector, go to Tools and call add with a=1, b=2.

You get 3 back.

The Inspector built that form (a required integer field for a, another for b) from your type hints. So will Claude, and every other MCP host.

Now go to Resources and read greeting://World:

Hello, World!

Recap

Look again at what you did not write:

  • No JSON Schema. a: int, b: int is the schema.
  • No request parsing, no serialization, no validation code.
  • No protocol handling at all.

You wrote two Python functions with type hints and a docstring. The SDK does the rest.

Where to go next

  • Get started takes you from install to a working, tested server.
  • Building an application that uses MCP servers? Start with Clients.
  • Already have a FastAPI or Starlette app? Add to an existing app mounts an MCP server inside it.
  • Hunting an exact error message? Troubleshooting is keyed by the verbatim text.
  • Wondering what changed in v2? What's new in v2 is the five-minute tour.
  • Migrating from v1? Start with the Migration Guide.
  • Hunting for an exact signature? The API Reference is generated from the source.
  • Reading with an LLM? This documentation is also published in the llms.txt format: llms.txt is an index of the pages, and llms-full.txt contains every page in a single file.