特徴
- 既存の FastAPI 依存関係を使用して、認証が組み込まれています。
- **FastAPIネイティブ:**単なるOpenAPI -> MCPコンバータではない
- 設定はゼロ/最小限で済みます。FastAPI アプリを指定するだけで動作します。
- リクエストモデルとレスポンスモデルのスキーマの保持
- Swaggerと同じように、すべてのエンドポイントのドキュメントを保存します。
- 柔軟な展開- MCP サーバーを同じアプリにマウントするか、個別に展開します
- ASGIトランスポート- 効率的な通信のためにFastAPIのASGIインターフェースを直接使用します
インストール
高速な Python パッケージ インストーラーであるuv の使用をお勧めします。
あるいは、pip を使用してインストールすることもできます。
基本的な使い方
FastAPI-MCP を使用する最も簡単な方法は、MCP サーバーを FastAPI アプリケーションに直接追加することです。
これで完了です。自動生成された MCP サーバーがhttps://app.base.url/mcp
で利用できるようになります。
ドキュメント、例、高度な使用法
FastAPI-MCPは包括的なドキュメントを提供しています。さらに、これらの機能の実際の動作を示すコードサンプルについては、 examplesディレクトリをご覧ください。
FastAPIファーストアプローチ
FastAPI-MCPは、APIからMCPツールを生成するコンバーターとしてだけでなく、FastAPIのネイティブ拡張機能として設計されています。このアプローチには、いくつかの重要な利点があります。
- ネイティブ依存関係: 認証と承認に使い慣れた FastAPI
Depends()
を使用して MCP エンドポイントを保護します - ASGI トランスポート: ASGI インターフェースを使用して FastAPI アプリと直接通信し、MCP から API への HTTP 呼び出しの必要性を排除します。
- 統合インフラストラクチャ: FastAPI アプリは MCP サーバーから個別に実行する必要はありません (ただし、 個別の展開もサポートされています)
この設計哲学により、既存の FastAPI サービスに MCP 機能を追加する際の摩擦が最小限に抑えられます。
開発と貢献
FastAPI-MCP への貢献をご検討いただきありがとうございます。コミュニティの皆様には、問題の投稿やプルリクエストの作成を歓迎いたします。
始める前に、貢献ガイドをご覧ください。
コミュニティ
MCParty Slack コミュニティに参加して、他の MCP 愛好家と交流したり、質問したり、FastAPI-MCP の経験を共有したりしましょう。
要件
- Python 3.10+ (推奨 3.12)
- 紫外線
ライセンス
MITライセンス。Copyright (c) 2024 Tadata Inc.
This server cannot be installed
FastAPI エンドポイントをモデル コンテキスト プロトコル (MCP) ツールとして自動的に公開するゼロ構成ツール。これにより、Claude などの LLM システムが追加のコーディングなしで API と対話できるようになります。
Related Resources
Related MCP Servers
- -securityFlicense-qualityA MCP server that exposes OpenAPI schema information to LLMs like Claude. This server allows an LLM to explore and understand large OpenAPI schemas through a set of specialized tools, without needing to load the whole schema into the contextLast updated -375JavaScript
- -securityFlicense-qualityA simple application demonstrating Model Context Protocol (MCP) integration with FastAPI and Streamlit, allowing users to interact with LLMs through a clean interface.Last updated -3Python
- AsecurityAlicenseAqualityA Model Context Protocol server that loads multiple OpenAPI specifications and exposes them to LLM-powered IDE integrations, enabling AI to understand and work with your APIs directly in development tools like Cursor.Last updated -72927TypeScriptMIT License
- -securityAlicense-qualityA zero-configuration tool that automatically converts FastAPI endpoints into Model Context Protocol (MCP) tools, enabling AI systems to interact with your API through natural language.Last updated -1PythonMIT License