python-sdk  by modelcontextprotocol

Python SDK for Model Context Protocol (MCP) servers/clients

created 10 months ago
16,901 stars

Top 2.8% on sourcepulse

GitHubView on GitHub
Project Summary

The Model Context Protocol (MCP) Python SDK provides a standardized way for applications to expose data and functionality to Large Language Models (LLMs). It enables developers to build both MCP clients and servers, facilitating secure and structured LLM interactions by separating context provision from LLM execution.

How It Works

MCP defines three core primitives: Resources (data exposure, like GET endpoints), Tools (functionality, like POST endpoints), and Prompts (reusable interaction templates). The SDK's FastMCP server class simplifies creating servers that expose these primitives via Python decorators. It handles protocol compliance, message routing, and supports features like lifespan management for resource initialization and cleanup, enabling type-safe context passing between server startup and tool execution.

Quick Start & Requirements

Highlighted Details

  • Standardization: Implements the full MCP specification for interoperability.
  • Flexibility: Supports creating MCP servers and clients, with options for direct execution or mounting into existing ASGI applications.
  • Developer Experience: Offers high-level abstractions (FastMCP) and low-level server implementations for custom control.
  • Integration: Includes examples for Claude Desktop integration and common patterns like database access.

Maintenance & Community

  • Active development with a clear contribution guide.
  • Links to GitHub Discussions are provided for community interaction.

Licensing & Compatibility

  • MIT License. Permissive for commercial use and integration with closed-source projects.

Limitations & Caveats

The SDK is actively developed, and some features might be experimental or subject to change. Specific LLM integrations or advanced protocol features may require deeper understanding of the MCP specification.

Health Check
Last commit

2 days ago

Responsiveness

1 day

Pull Requests (30d)
91
Issues (30d)
91
Star History
5,846 stars in the last 90 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), Travis Fischer Travis Fischer(Founder of Agentic), and
1 more.

fastmcp by punkpeye

3.7%
2k
TypeScript framework for building MCP servers handling client sessions
created 7 months ago
updated 2 days ago
Starred by Didier Lopes Didier Lopes(Founder of OpenBB), Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), and
2 more.

fastmcp by jlowin

2.1%
15k
Pythonic SDK for building Model Context Protocol (MCP) servers/clients
created 8 months ago
updated 1 day ago
Feedback? Help us improve.