endou-mame/fastmcp-server
If you are the rightful owner of fastmcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
FastMCP Server is a simple implementation of a Model Context Protocol (MCP) server using FastAPI to provide an API for communication with AI models.
FastMCP Server
FastMCPを使用したシンプルなModel Context Protocol (MCP) サーバーの実装です。このサーバーは、FastAPIフレームワークを利用してAIモデルとの通信を行うAPIを提供します。
機能
/chat
エンドポイント:ユーザーのメッセージを受け取り、AIモデルからのレスポンスを返します- 環境変数による設定:APIキーやモデル選択などを柔軟に設定可能
必要条件
- Python 3.9以上
- APIキー(Anthropic Claude API等)
インストール方法
-
リポジトリをクローン
git clone https://github.com/endou-mame/fastmcp-server.git cd fastmcp-server
-
仮想環境を作成して有効化
python -m venv venv source venv/bin/activate # Linuxの場合 # または venv\Scripts\activate # Windowsの場合
-
依存パッケージをインストール
pip install -r requirements.txt
-
環境変数の設定
cp .env.example .env # .envファイルを編集して、APIキーなどを設定
使用方法
-
サーバーを起動
python main.py
-
ブラウザまたはAPIクライアントで
http://localhost:8000
にアクセス -
/chat
エンドポイントにPOSTリクエストを送信curl -X POST "http://localhost:8000/chat" \ -H "Content-Type: application/json" \ -d '{"message": "こんにちは、AIさん"}'
API仕様
GET /
- サーバーの状態を確認するためのエンドポイント
- レスポンス例:
{"status": "running", "message": "Simple MCP Server is running"}
POST /chat
- パラメータ:
message
: ユーザーからのメッセージ(文字列)
- レスポンス: AIモデルからのレスポンス
- 成功時:
{"response": "AIからの返答"}
- エラー時:
{"error": "エラーメッセージ"}
- 成功時:
ライセンス
MIT