MCP Python SDK
Official Python SDK for building Model Context Protocol servers and clients.
Tags
Description
PyPI package mcp (2.3.0).
Related
- Model Context Protocol (MCP): Open protocol that standardizes how AI applications connect to external tools, data sources and prompts via MCP servers.
- MCP TypeScript SDK: Official TypeScript SDK for building MCP servers and clients on Node.js, Bun and Deno; v2 ships as @modelcontextprotocol/server and @modelcontextprotocol/client.
- FastMCP: The fast, Pythonic framework for building MCP servers, clients and interactive applications.
Guides & comparisons
- Scan agent-written code for vulnerabilities with the Semgrep MCP server (Guide): Give a coding agent a deterministic security scanner. Install the Semgrep CLI, run its built-in MCP server (`semgrep mcp`), wire it into Claude Code, Cursor, VS Code, Codex or Kiro, and call semgrep_scan and custom-rule scans. Includes two gotchas we hit, and when SonarQube's MCP server fits better.
- Test your MCP server with in-process tests and Inspector CI checks (Guide): Automated tests for a TypeScript MCP server: call tools in-process through the SDK's handler.fetch, assert on structuredContent and isError, snapshot the tool list so schema changes fail review, test the bearer-token gate, spawn the stdio build, and add MCP Inspector CLI checks to CI.
- MCP server frameworks compared: FastMCP vs mcp-use vs the official Python and TypeScript SDKs (Comparison): Four ways to build an MCP server in 2026: the official Python SDK (v2) and TypeScript SDK (v2), Prefect's FastMCP and Manufact's mcp-use. Covers languages, schemas, transports, auth, MCP Apps (UI), local testing, deployment and license.
Sources
Machine-readable
- JSON
- Markdown
- Source file on GitHub (edit via pull request)