Python SDK is the official Python implementation of the Model Context Protocol (MCP), the protocol for exposing data and functionality to LLM applications in a standard way, comparable to a web API designed for LLM interactions. One package covers both sides: you build MCP servers that expose tools, resources, and prompts to any MCP host, and MCP clients that connect to any MCP server.
On the server side, tools and resources are ordinary type-hinted Python functions registered with decorators. The type hints become the JSON Schema, and the SDK handles request parsing, validation, and protocol handling, so a working server with one tool and one templated resource takes about 15 lines.
On the client side, a client connects to a server by URL over Streamable HTTP, launches a local server as a stdio subprocess, or uses a custom transport, then calls tools and reads structured results. The SDK speaks all standard transports (stdio, Streamable HTTP, and SSE). An optional command-line tool runs servers, opens them in the MCP Inspector for testing, and installs them into hosts. Version 2 is the current stable line, with a migration guide for code written against version 1.
Features
- MCP servers: expose tools, resources, and prompts to any MCP host
- MCP clients: connect to any MCP server and call its tools
- Decorator API: type-hinted Python functions become tools and resources, with schemas derived from the type hints
- Templated resources: URI templates map parameters to resource handlers
- Transports: stdio, Streamable HTTP, and SSE, plus custom transports
- Development CLI: run servers, test them in the MCP Inspector, and install them into hosts


