Try “Claude Code skills”, “MCP servers for Cursor” or “Codex” · Esc to close

MCP Python SDK 🔌 MCP server Open source

The official Python SDK for building Model Context Protocol servers and clients

Docs & code context MCP servers · Open source ★ 24k · +55 this week · MIT · updated 2026-10-02

8.5editor score
Visit MCP Python SDK ↗
GitHub stars
24k
Stars this week
+55
Forks
4.0k
Licence
MIT
Last push
2026-10-02
Maintainer
modelcontextprotocol
Installuv add "mcp[cli]"

Third-party MCP servers run with your permissions. Read the source before installing, and prefer pinned versions.

Works with

Built on the open MCP standard, so it works in every app that supports MCP.

About MCP Python SDK

What it does

This is the official Python SDK for the Model Context Protocol, maintained by the MCP project. It lets you build MCP servers that expose tools, resources and prompts to any MCP host, and MCP clients that connect to any server. The same package does both. Servers are written as plain type-hinted Python functions: the type hints become the schema, so you do not write JSON Schema, request parsing or validation by hand. It speaks every standard transport, meaning stdio, Streamable HTTP and SSE. The current release line is v2, reworked for the latest protocol revision, with v1 still maintained on its own branch.

Tools it gives your agent

This is a development library, not a ready-to-run server, so it does not hand your agent a fixed set of tools. Instead you use it to define your own: decorate a function with @mcp.tool() to expose a tool, or @mcp.resource(...) to expose a resource, and the SDK handles the protocol. The cli extra adds an mcp command with mcp dev, mcp run and mcp install for testing a server in the MCP Inspector.

Works with

Any MCP host or client, since it implements the protocol both sides use. Requires Python 3.10 or newer.

How to install

uv add "mcp[cli]"      # or: pip install "mcp[cli]"

Maintenance and safety

The SDK is MIT-licensed and very actively maintained, and it is the reference Python implementation of MCP. Because v2 is a major rework, pin an upper bound such as mcp>=1.28,<2 until you have migrated, since pip install mcp now installs 2.x. A server you build with it runs with whatever access your code gives it, so apply the usual care with tools that touch the filesystem, the network or credentials.

Who should use it

It suits developers who want to build MCP servers or clients in Python and prefer to write ordinary functions rather than protocol plumbing. It is the natural starting point for exposing your own data or tools to coding agents.

mcp python sdk mcp-server mcp-client

Pros

  • Official reference implementation for MCP in Python
  • Type hints become the schema, no boilerplate
  • Supports stdio, Streamable HTTP and SSE

Cons

  • A library to build with, not a ready-to-run server
  • v2 is a major rework; pin a version until you migrate

Context7 🔌 MCP serverFreemium

Up-to-date, version-specific library documentation for your coding agent

★ 63k · +180 this week

Serena 🔌 MCP serverFree

Semantic code retrieval and editing toolkit for agents, powered by language servers

★ 30k · +146 this week

Codebase Memory MCP 🔌 MCP serverOpen source

Local knowledge graph of your repo so agents query call chains instead of grepping files

★ 46k · +765 this week

7.8 Visit ↗

pg-aiguide 🔌 MCP serverOpen source

MCP server and skills giving coding agents versioned PostgreSQL and TimescaleDB expertise

★ 1.9k · +7 this week

MCP Memory Service 🔌 MCP serverOpen source

Self-hosted persistent memory for coding agents with semantic search and a knowledge graph

★ 2.0k · +15 this week

7.6 Visit ↗

Grounded Docs MCP Server 🔌 MCP serverOpen source

Self-hosted, version-specific documentation index for coding agents, an open Context7 alternative

★ 1.8k · +21 this week

7.6 Visit ↗

More from modelcontextprotocol

MCP Reference Servers 🔌 MCP serverFree

The official reference MCP servers: fetch, filesystem, git, memory and more

★ 91k · +362 this week

Popular searches