
MCP Python SDK
Official Python library for building MCP servers and clients that connect AI apps to tools and data.modelcontextprotocol/python-sdk
- Stars
- 24.7k
- Forks
- 4.1k
- Licence
- MIT
- Language
- Python
- Last update
- 4 days ago
- Type
- Library
What it is
MCP (Model Context Protocol) is a standard way for LLM applications to access data and functionality. This Python SDK lets developers write a server that exposes tools, resources, and prompts, or a client that connects to such servers. Plain type-hinted Python functions are turned into MCP tools without writing JSON Schema or protocol code.
- Expose a function such as add(a, b) as a tool that an AI assistant can call
- Expose templated data, such as a greeting resource, that an LLM application can read
- Run a local server with the mcp run command and test it with the MCP Inspector via mcp dev
- Write a Python client that calls tools on a remote MCP server over Streamable HTTP
Great for
- Python developers who want to expose their own functions to an LLM app as MCP tools
- Developers building clients that connect to existing MCP servers
- Teams who need stdio, Streamable HTTP, or SSE transport support
- Anyone following the official MCP specification who wants a reference Python implementation
Not ideal for
- Non-programmers, since it requires writing Python code
- Projects that must run on Python versions below 3.11, as the README lists Python 3.11+ as a requirement
- Users looking for a ready-made end-user app rather than a developer library
How to get it
- 1
Install with a package manager
You'll need: Python 3.11+
Install with uv
uv add "mcp[cli]"Or install with pip
pip install "mcp[cli]" - 2
Run it
- Create a server.py file containing the add tool and greeting resource from the README example
- Run uv run mcp dev server.py to open it in the MCP Inspector
- Call add with a=1 and b=2 to confirm it returns 3
- Optionally serve it with uv run mcp run server.py --transport streamable-http and connect with the Client example
- 3
Get the most out of it
- Use the Get started guide on the documentation site for a step-by-step path
- Use mcp dev to test tools interactively in the MCP Inspector before connecting a real host
- Serve over Streamable HTTP to deploy a server, or use stdio to let Client launch a local server as a subprocess
- Read the migration guide if you are moving from an earlier version, since the docs include a v2 what's-new page
Downloads
Strengths
- Type hints and docstrings define the tool interface, so little boilerplate is needed
- Supports the standard transports: stdio, Streamable HTTP, and SSE
- Official project under the MIT license with 24k+ stars and documentation hosted on a dedicated site
Trade-offs
- Requires Python 3.11 or newer
- The README is truncated and gives little detail beyond the quick-start examples; full details are on the external docs site
- Optional mcp[cli] extra is needed for the command-line tools
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| python-sdk (this) | 24.7k | Library | intermediate | 4 days ago | Python developers who want to expose their own functions to an LLM app as MCP tools |
| mcp-use | 10.8k | Library | intermediate | 6 days ago | TypeScript developers who want to build MCP servers |
| mcp-for-beginners | 17.6k | Learning resource | beginner | 4 days ago | Developers new to MCP who want guided lessons |
| context7 | 64.1k | AI model / agent | beginner | 4 days ago | Developers who use AI coding agents such as Claude, Cursor, or VS Code for libraries that change often |
| codebase-memory-mcp | 48k | Dev tool | intermediate | 4 days ago | Developers who use an MCP-capable AI coding agent on a large codebase |
| github-mcp-server | 34.2k | Dev tool | intermediate | 4 days ago | Developers who already use an MCP-compatible AI tool such as VS Code with Copilot, Claude Desktop, or Cursor |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.