← プロジェクト一覧に戻る

FastMCP

多くのMCPサーバーが実際に書かれているPythonフレームワーク。公式SDK内の同名APIより先行する

公式Apache-2.0
スター
27.4k
フォーク
2.3k
オープンIssue
291
最終コミット
2026年8月28日

FastMCPとは

型注釈の付いたPython関数にデコレータを1つ付ければ、それで完成したツールになります。スキーマは型注釈とドキュメント文字列から導出され、受け取る引数と返す値の双方が検証されます。さらに、2週目の作業でぶつかる部分まで揃っています。型付きクライアント、OAuthと外部IDプロバイダ、複数サーバーを1つとして束ねる構成、既存サーバーの前段に立つプロキシ、ミドルウェアです。注意すべきは名前の重複で、このAPIの旧版が公式のMCP Python SDKに取り込まれているため、FastMCPという語はどちらのimportを読んでいるかで別のものを指します。

FastMCPで何ができますか?

  • デコレータ1つで関数がツールになる — 型注釈付きの関数に注釈を付けると、シグネチャから入力スキーマが、ドキュメント文字列から説明が導出されます。引数は自分のコードが動く前に、返り値は送り返される前に検証されます。
  • 動作だけでなくデータと定型文も公開する — リソースとリソーステンプレートはクライアントが読めるデータを提供し、プロンプトは引数を取る再利用可能なメッセージ雛形です。手書きのサーバーで省略されがちなMCPの2要素です。
  • クライアント側も同じライブラリで書く — 型付きクライアントで、ローカルでもリモートでもツールの呼び出し、リソースの読み取り、プロンプトの取得ができます。別プロセスを起動せずにサーバーを試験できるのもこの仕組みのおかげです。
  • 本格的な認証を前段に置く — OAuth 2.1とトークン検証に対応し、Auth0、WorkOS、Descope、AWS Cognito、Azureといった外部IDプロバイダを利用できます。認可ルールで、特定の呼び出し元に見せない構成要素を隠すこともできます。
  • 自分が書いていないサーバーを束ねる・包む — 複数のサーバーを1つの名前空間にまとめたり、既存のサーバーの前にプロキシとして立ったりできます。ミドルウェアは、束ねた対象をまたいでリクエストとレスポンスに介入します。

FastMCPを選ぶ前に

  • 本プロジェクトが生んだ高水準APIは公式のMCP Python SDKに取り込まれました。FastMCPという記述が、この版ではなく取り込まれた旧版を指している場合があるため、記事に従う前にimport元を確認してください。
  • 保守はPrefectが担っており、同社はドキュメントが案内するホスト型MCPプラットフォームも販売しています。フレームワーク自体はApache-2.0ですが、方向性は商用製品と並んで決まります。

スター推移

8月21日〜8月28日 · +101

27.3k27.4k

よくある質問

FastMCPは商用利用できますか?

FastMCPはApache-2.0ライセンスで公開されています。OSI承認のオープンソースライセンスで、商用利用が認められています。

FastMCPはどの形で使えますか?

FastMCPはセルフホスト・ローカル実行の形で利用できます。

ドキュメント

PrefectHQ/fastmcp のREADMEより転載(Apache-2.0)。 原文を読む ↗

FastMCP 🚀

Move fast and make things.

Made with 💙 by Prefect

Tests


The Model Context Protocol (MCP) connects LLMs to tools and data. FastMCP is a full MCP application framework for servers, clients, and interactive apps. A server starts with ordinary Python:

from fastmcp import FastMCP

mcp = FastMCP("Demo 🚀")

@mcp.tool
def add(a: int, b: int) -> int:
    """Add two numbers"""
    return a + b

if __name__ == "__main__":
    mcp.run()

Why FastMCP

Building an effective MCP application is harder than it looks. FastMCP handles all of it. Declare a tool with a Python function, and the schema, validation, and documentation are generated automatically. Connect to a server with a URL, and transport negotiation, authentication, and protocol lifecycle are managed for you. You focus on your logic, and the MCP part just works: with FastMCP, best practices are built in.

That’s why FastMCP is the standard framework for working with MCP. FastMCP 1.0 was incorporated into the official MCP Python SDK in 2024. Today, the actively maintained standalone project is downloaded a million times a day, and some version of FastMCP powers 70% of MCP servers across all languages.

FastMCP has three pillars:

Servers wrap your Python functions into MCP-compliant tools, resources, and prompts. Clients connect to any server with full protocol support. And Apps give your tools interactive UIs rendered directly in the conversation.

Building in TypeScript? FastMCP for TypeScript is the official counterpart, built and maintained by the same team. Same pillars, same ideas, npm install @prefecthq/fastmcp-ts.

Ready to build? Start with the installation guide or jump straight to the quickstart.

Scale MCP with Horizon

FastMCP handles the MCP application layer. Prefect Horizon is the enterprise MCP gateway for scaling servers and tools across teams, with centralized governance over how they are deployed, discovered, secured, and used.

FastMCP and Horizon are built by the same team at Prefect.

Deploy FastMCP servers from GitHub with branch previews and instant rollback. Create a private registry of every MCP your company uses. Secure access with SSO and tool-level RBAC. Get audit logs, observability, and governance across your MCP stack. Remix approved tools into purpose-built endpoints for teams and agents.

Start with FastMCP. Scale with Horizon →

Installation

We recommend adding FastMCP to your project with uv:

uv add fastmcp

For full installation instructions, including verification and upgrading, see the Installation Guide.

Upgrading? We have guides for:

📚 Documentation

FastMCP’s complete documentation is available at gofastmcp.com, including detailed guides, API references, and advanced patterns.

Documentation is also available in llms.txt format, which is a simple markdown standard that LLMs can consume easily:

  • llms.txt is essentially a sitemap, listing all the pages in the documentation.
  • llms-full.txt contains the entire documentation. Note this may exceed the context window of your LLM.

Community: Join our Discord server to connect with other FastMCP developers and share what you’re building.