FastAPI SSE MCP Random
FastAPI SSE MCP 随机
一个 FastAPI 服务器,它使用服务器发送事件 (SSE) 实现模型上下文协议 (MCP),用于流式通信。该项目提供各种实用工具,包括随机数生成、使用 Azure OpenAI DALL-E 生成图像以及 AI 播客生成。
特征
用于实时流通信的服务器发送事件(SSE)
用于结构化工具使用的**模型上下文协议 (MCP)**实现
多种实用工具:
Echo 工具和资源
随机数生成器
通过 Azure OpenAI DALL-E 3 生成图像
AI播客生成
用于反思性回应的“思考工具”
Related MCP server: MyAIServ 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 installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Appeared in Searches
Latest Blog Posts
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