fastmcp  by jlowin

Pythonic SDK for building Model Context Protocol (MCP) servers/clients

Created 11 months ago
19,902 stars

Top 2.2% on SourcePulse

GitHubView on GitHub
Project Summary

FastMCP provides a Pythonic framework for building Model Context Protocol (MCP) servers and clients, simplifying the creation of tools, resources, and prompts for LLM applications. It abstracts away protocol complexities, enabling developers to focus on core logic and integration with LLMs.

How It Works

FastMCP leverages Python decorators (@mcp.tool(), @mcp.resource(), @mcp.prompt()) to define server capabilities. It automatically generates MCP schemas from type hints and docstrings. The FastMCP class manages server lifecycle, routing, and protocol details, while the Client class allows programmatic interaction with any MCP server, supporting various transport protocols like SSE, Stdio, and WebSockets.

Quick Start & Requirements

  • Install: uv pip install fastmcp
  • Prerequisites: Python 3.10+, uv
  • Docs: gofastmcp.com
  • Run server: fastmcp run server.py
  • Development: fastmcp dev server.py
  • Install for Claude Desktop: fastmcp install server.py

Highlighted Details

  • Supports server composition, proxying, and generation from OpenAPI/FastAPI specs.
  • Client-side LLM sampling allows servers to delegate completions to the client LLM.
  • Handles image data via fastmcp.Image helper.
  • Provides Context object for logging, progress reporting, and resource access within tools/resources.

Maintenance & Community

  • Project is active with a clear contribution guide and testing setup.
  • Links to documentation and examples are provided.

Licensing & Compatibility

  • License: MIT
  • Compatible with commercial and closed-source applications.

Limitations & Caveats

The project is actively evolving, with v2 introducing advanced features. While designed for simplicity, advanced use cases like proxying and composition require a deeper understanding of MCP concepts.

Health Check
Last Commit

10 hours ago

Responsiveness

1 day

Pull Requests (30d)
177
Issues (30d)
179
Star History
1,362 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.