FastAPI SSE MCP Random

by hk4crprasad

Integrations

  • Uses FastAPI to implement the Model Context Protocol server with Server-Sent Events for streaming communication

  • Connects to Azure OpenAI DALL-E 3 for image generation based on text prompts

  • Built with Python 3.10+ and includes various utility tools like random number generation, echo functionality, and AI podcast generation

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ポッドキャスト生成
    • 反省的な反応のための「考えるツール」

前提条件

  • Python 3.10以上
  • Azure OpenAI API アクセス (画像生成用)

インストール

  1. リポジトリをクローンします。
git clone <repository-url> cd fastapi_sse_mcp_random
  1. 依存関係をインストールします。
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ライブラリ

ライセンス

[ここでライセンスを指定してください]

貢献

[プロジェクトへの貢献方法]

-
security - not tested
F
license - not found
-
quality - not tested

構造化されたツールの使用のためにモデル コンテキスト プロトコル (MCP) を実装する FastAPI サーバー。乱数生成、Azure OpenAI DALL-E による画像生成、AI ポッドキャスト生成などのユーティリティ ツールを提供します。

  1. 特徴
    1. 前提条件
      1. インストール
        1. 使用法
          1. サーバーの起動
          2. 利用可能なエンドポイント
          3. 利用可能なツール
        2. プロジェクト構造
          1. 依存関係
            1. ライセンス
              1. 貢献

                Related MCP Servers

                • -
                  security
                  A
                  license
                  -
                  quality
                  A Model Context Protocol (MCP) server implementation for the OpenLedger API. This server provides structured context to AI models according to the MCP specification.
                  Last updated -
                  8
                  TypeScript
                  Apache 2.0
                • -
                  security
                  -
                  license
                  -
                  quality
                  A Model Context Protocol server enabling AI assistants to generate images through OpenAI's DALL-E API with full support for all available options and fine-grained control.
                  Last updated -
                  JavaScript
                  MIT License
                • -
                  security
                  A
                  license
                  -
                  quality
                  A 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 -
                  1
                  Python
                  MIT License
                • -
                  security
                  A
                  license
                  -
                  quality
                  A command-line tool that transforms any OpenAPI service into a Model Context Protocol (MCP) server, enabling seamless integration with AI agents and tools that support the MCP specification.
                  Last updated -
                  90
                  2
                  TypeScript
                  MIT License

                View all related MCP servers

                ID: cxgfonzuny