Skip to main content
Glama

FastAPI SSE MCP Random

by hk4crprasad

FastAPI SSE MCP 随机

一个 FastAPI 服务器,它使用服务器发送事件 (SSE) 实现模型上下文协议 (MCP),用于流式通信。该项目提供各种实用工具,包括随机数生成、使用 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

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

一个实现模型上下文协议 (MCP) 以供结构化工具使用的 FastAPI 服务器,提供实用工具,包括随机数生成、通过 Azure OpenAI DALL-E 生成图像以及 AI 播客生成。

  1. 特征
    1. 先决条件
      1. 安装
        1. 用法
          1. 启动服务器
          2. 可用端点
          3. 可用工具
        2. 项目结构
          1. 依赖项
            1. 执照
              1. 贡献

                Related MCP Servers

                • A
                  security
                  F
                  license
                  A
                  quality
                  A FastMCP server implementation that facilitates resource-based access to AI model inference, focusing on image generation through the Replicate API, with features like real-time updates, webhook integration, and secure API key management.
                  Last updated -
                  18
                  15
                  Python
                  • Apple
                • -
                  security
                  A
                  license
                  -
                  quality
                  A high-performance FastAPI server supporting Model Context Protocol (MCP) for seamless integration with Large Language Models, featuring REST, GraphQL, and WebSocket APIs, along with real-time monitoring and vector search capabilities.
                  Last updated -
                  9
                  Python
                  MIT License
                • -
                  security
                  F
                  license
                  -
                  quality
                  A production-ready MCP server built with FastAPI, providing an enhanced tool registry for creating, managing, and documenting AI tools for Large Language Models (LLMs).
                  Last updated -
                  32
                  Python
                • -
                  security
                  A
                  license
                  -
                  quality
                  A FastMCP server implementation that provides a standardized interface for accessing AI models hosted on Replicate's API, currently supporting image generation with customizable parameters.
                  Last updated -
                  3
                  Python
                  MIT License

                View all related MCP servers

                MCP directory API

                We provide all the information about MCP servers via our MCP API.

                curl -X GET 'https://glama.ai/api/mcp/v1/servers/hk4crprasad/fastapi_sse_mcp_random'

                If you have feedback or need assistance with the MCP directory API, please join our Discord server