MCP Python SDK (Model Context Protocol)

MCP Python SDK: reference Python implementation of the Model Context Protocol (Anthropic-led). Two server surfaces (low-level Server / high-level MCPServer, formerly FastMCP), three transports (stdio / SSE / streamable-http), and three primitives (Tools / Resources / Prompts).

✓ 0 reported success·v0.1.0·

Overview

The MCP Python SDK is the reference implementation of the Model Context Protocol (github.com/modelcontextprotocol/python-sdk) — an Anthropic-led open standard for AI hosts (Claude, Cursor, etc.) to talk to tool servers over JSON-RPC 2.0. Two server surfaces: low-level Server (constructor-injected handlers) and high-level MCPServer (decorator API, formerly FastMCP). Three transports share a structural (read_stream, write_stream) AnyIO contract: stdio (line-delimited JSON), legacy SSE, and the recommended streamable-http (single endpoint with optional resumability via EventStore ABC). Three primitives: Tools (side-effecting operations), Resources (read-only context), and Prompts (templates). This skill embeds 50 constraints (1 fatal) covering typical pitfalls: at commit 3d7b311 the README still imports the renamed FastMCP package (26 import lines + 10 broken file paths); DNS-rebinding protection is auto-enabled ONLY for 127.0.0.1 / localhost / ::1 — production hosts get NO protection by default; stateless HTTP mode silently breaks sampling / elicit_form / elicit_url / list_roots and raises StatelessModeNotSupported at call time.

Blueprint Source

finance-bp-140

modelcontextprotocol/python-sdk3d7b3111 source file

Constraints

1total
1fatal
1 must-not-violate

Evidence Quality

Confidence90%

High confidence — strong evidence base

1 non-negotiable constraints

FATALoperational_lessonmcp-C-001

WHENWhen following README quickstart code at commit 3d7b311 to build an MCP server

ACTIONtranslate every `from mcp.server.fastmcp import FastMCP` line (≥26 occurrences in README at lines 147, 231, 293, 324, 349, 419, 470, 572, 573, 600, 640, 665, 697, 830, 937, 974, 1017, 1211, 1255, 1297, 1410, 1457, 1504, 1565, 1602, 1623) to `from mcp.server.mcpserver import MCPServer` and instantiate `MCPServer(...)` instead of `FastMCP(...)`; `mcp.server.fastmcp` package no longer exists

CONSEQUENCECopy-pasting README import statements raises ModuleNotFoundError: No module named 'mcp.server.fastmcp' immediately at import time, blocking any further work on the server before a single line of business logic runs

FAQ

Discussion (0)

No comments yet. Be the first to share!

Changelog

v0.1.02026-04-25·Contributors: tangweigang-jpg

v0.1.0: Initial release on Doramagic.ai. MCP reference implementation on modelcontextprotocol/python-sdk with bilingual metadata, 50 anti-pattern constraints, and 3 FAQs.

v0.1.02026-04-25·Contributors: tangweigang-jpg

v0.1.0: Initial release on Doramagic.ai. MCP reference implementation on modelcontextprotocol/python-sdk with bilingual metadata, 50 anti-pattern constraints, and 3 FAQs.