FastAPI SSE MCP Random
FastAPI SSE MCP ランダム
ストリーミング通信にServer-Sent Events (SSE)を用いたModel Context Protocol (MCP)を実装したFastAPIサーバー。このプロジェクトでは、乱数生成、Azure OpenAI DALL-Eを用いた画像生成、AIポッドキャスト生成など、様々なユーティリティツールを提供しています。
特徴
リアルタイムストリーミング通信のためのサーバー送信イベント(SSE)
構造化されたツールの使用のための**モデルコンテキストプロトコル(MCP)**の実装
複数のユーティリティツール:
Echoツールとリソース
乱数ジェネレータ
Azure OpenAI DALL-E 3 による画像生成
AIポッドキャスト生成
反省的な反応のための「考えるツール」
Related MCP server: AI Agent MCP Server
前提条件
Python 3.10以上
Azure OpenAI API アクセス (画像生成用)
インストール
リポジトリをクローンします。
git clone <repository-url>
cd fastapi_sse_mcp_random依存関係をインストールします。
pip install -r requirements.txtまたはuvを使用します:
uv pip install -e .使用法
サーバーの起動
次のコマンドでサーバーを実行します。
python main.pyサーバーはhttp://0.0.0.0:8000で起動します。
利用可能なエンドポイント
GET /: ヘルスチェックエンドポイントGET /sse/: SSE接続エンドポイントPOST /messages/: クライアントメッセージのエンドポイント
利用可能なツール
エコーツール
{
"name": "echo_tool",
"parameters": {
"message": "Hello, world!"
}
}乱数ジェネレータ
{
"name": "random_number",
"parameters": {
"min_value": 1,
"max_value": 100
}
}画像生成
{
"name": "generate_image",
"parameters": {
"prompt": "A beautiful landscape with mountains and a lake"
}
}ポッドキャスト世代
{
"name": "generate_podcast",
"parameters": {
"prompt": "The future of artificial intelligence",
"duration": 5,
"name1": "Mark",
"voice1": "Thomas",
"name2": "Sophia",
"voice2": "Emily"
}
}シンクツール
{
"name": "think_tool",
"parameters": {
"input": "What are the implications of quantum computing?"
}
}プロジェクト構造
main.py: メインの FastAPI アプリケーションと MCP ツールの実装sse.py: サーバー送信イベント (SSE) の実装pyproject.toml: プロジェクトのメタデータと依存関係requirements.txt: 基本的な依存関係リスト
依存関係
FastAPI: APIを構築するためのWebフレームワーク
MCP: モデルコンテキストプロトコルの実装
OpenAI: Azure OpenAI サービスのクライアント
Uvicorn: FastAPI アプリケーションを実行するための ASGI サーバー
リクエスト: API呼び出し用のHTTPライブラリ
ライセンス
[ここでライセンスを指定してください]
貢献
[プロジェクトへの貢献方法]
This server cannot be deployed
Maintenance
Related MCP Connectors
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Focused MCP server for OpenAI image/audio generation (v2.0.0). Wraps endpoints via HAPI CLI.
Related MCP Servers
- AlicenseAqualityDmaintenanceA Model Context Protocol server that enables AI assistants to make HTTP requests (GET, POST, PUT, DELETE) to external APIs through standardized MCP tools.42MIT
- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol server implementation built with FastAPI that enables AI agent interactions. Provides a structured foundation for building AI-powered applications with proper data validation and modern Python tooling.-
- FlicenseNot gradedqualityDmaintenanceA FastMCP-based server providing tools for weather queries, random number generation, and real-time stock market data retrieval. It enables AI models to interact with external data and perform specific tasks through the Model Context Protocol.-
- AlicenseNot gradedqualityDmaintenanceModel Context Protocol server that standardizes tool discovery, execution, and context management for AI applications.MIT