Token导航 LogoToken导航

MCP Server · 数据服务

Fastapi Multi Server MCP

一个基于FastAPI的多服务集成平台,提供天气、新闻、货币和名言等API服务。

stdio官方级别未说明来源级核验工具 0
API集成PythonCursor数据服务Windsurf

快速开始

作者 / 组织
AlwaysSany
提供方
AlwaysSany

工具数量

0

来源目录标注

资源数量

0

来源目录标注

提示词数量

0

来源目录标注

GitHub Star

3

仓库热度

收录来源

1 个

MCP World

选型结论

Fastapi Multi Server MCP 属于数据服务类 MCP Server,公开资料标注 0 个工具,通过stdio 本地进程接入,适配 Cursor、Windsurf,有可以直接复制的安装命令;接入前先确认权限范围。

分类

数据服务

传输方式

stdio

认证方式

无需认证

部署方式

公开资料未说明

安装与配置

安装命令

pip install -r requirements.txt

公开命令不是通用的启动方式,拼不出可靠配置示例;请在客户端 MCP 配置里按官方文档填写 command 和 args。

上手步骤

  1. 1

    准备运行环境

    stdio 服务在本地起进程,需要先装好 对应的运行时,再按安装命令拉取依赖。

  2. 2

    安装服务

    复制下面的安装命令执行;命令里带占位符的位置换成自己的密钥或路径。

  3. 3

    写入客户端配置

    在客户端的 MCP 配置里填启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4

    验证是否可用

    连接成功后客户端会列出 0 个工具,随便调一个只读工具确认能返回结果。

接入前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

详细介绍

多服务器MCP FastAPI项目

一个全面的FastAPI应用程序,托管多个模型上下文协议(MCP)服务器,每个服务器都提供对不同公共API和服务的访问。

工作演示

fastmcp-multi-server-mcp.webm

🚀 特性

该项目包括5个不同的MCP服务器:

  • 天气服务器 –天气数据的OpenWeatherMap API集成
  • 新闻服务器 –最新新闻文章的NewsAPI集成
  • 货币服务器 –汇率和货币兑换
  • 报价服务器 –鼓舞人心的引语和随机事实

📋 先决条件

  • Python 3.13+
  • 紫外线的 包管理器
  • 外部服务的API密钥(请参阅配置部分)

📁 项目结构

fastapi-multi-server-mcp/
├── main.py                 # FastAPI application entry point
├── requirements.txt        # Python dependencies
├── pyproject.toml         # UV project configuration
├── .env.example           # Environment variables template
├── README.md              # This file
├── servers/               # MCP servers directory
│   ├── __init__.py
│   ├── weather_server.py  # Weather API MCP server
│   ├── news_server.py     # News API MCP server
│   ├── currency_server.py # Currency API MCP server
│   └── quote_server.py    # Quotes API MCP server
├── utils/                 # Utility modules
│   ├── __init__.py
│   ├── api_clients.py     # HTTP client utilities
│   └── config.py          # Configuration management
├── tests/                 # Test suite
│   ├── __init__.py
│   ├── test_weather.py
│   ├── test_news.py
│   ├── test_currency.py
│   └── test_quote.py
└── docs/                  # Documentation
    ├── api_reference.md
    └── deployment.md

🛠️ 安装

使用紫外线(推荐)

# Clone the repository
git clone 
cd fastapi-multi-server-mcp

# Create virtual environment and install dependencies
uv venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
uv pip install -r requirements.txt

使用pip

pip install -r requirements.txt

🔧 配置

创建一个 .env 根目录中带有API密钥的文件:

# Weather API (OpenWeatherMap)
OPENWEATHER_API_KEY=your_openweather_api_key

# News API
NEWS_API_KEY=your_news_api_key

# Exchange Rates API
EXCHANGE_RATES_API_KEY=your_exchange_rates_api_key

# Server Configuration
PORT=10000
HOST=0.0.0.0

获取API密钥

🏃‍♂️ 运行应用程序

发展

# Using UV
uv run uvicorn main:app --reload --host 0.0.0.0 --port 10000 --reload

# Using `npx` to debug the running application,
npx @modelcontextprotocol/inspector uv run uvicorn main:app

为了将特定服务器连接到检查器,

设置,

  1. 运输类型: StreamableHTTP
  1. 网址:
  • 新闻:http://localhost:10000/news/mcp/
  • 天气:http://localhost:10000/weather/mcp/
  • 对于货币:http://localhost:10000/currency/mcp/
  • 对于报价:http://localhost:10000/quotes/mcp/
  1. 点击连接,将打开检查器窗口,如下所示:

报价服务器:

新闻服务器:

天气服务器:

货币服务器:

截至2025年6月,Windsurf和Cursor支持MCP服务器的两种传输类型: stdio 和 /sse,但不是 StreamableHTTP因此,使用 stdio 或 /sse 因为推荐运输类型。但是,使用检查器,您可以使用任何传输类型连接到在FastAPI上运行的MCP服务器。

生产

# Using Gunicorn
gunicorn main:app -w 4 -k uvicorn.workers.UvicornWorker --bind 0.0.0.0:10000

📚 API终点

一旦一切运行成功,

您的FastAPI服务器将在以下位置可用:http://localhost:10000,文件在http://localhost:10000/docs 您的MCP服务器将在以下网址提供:

  • 天气服务器:http://localhost:10000/weather
  • 新闻服务器:http://localhost:10000/news
  • 货币服务器:http://localhost:10000/currency
  • 报价服务器:http://localhost:10000/quotes

🧪 测试

# Run all tests
pytest

# Run with coverage
pytest --cov=.

# Run specific server tests
pytest tests/test_weather.py

🛠️ 按服务器列出的可用工具

🖼️ Click to see the tool details

天气服务器(/Weather)

get_current_weather - Get current weather for a city
get_weather_forecast - Get 5-day weather forecast
get_weather_by_coordinates - Get weather by latitude/longitude

新闻服务器(/News)

get_top_headlines - Get top news headlines
search_news - Search news articles by keyword
get_news_by_category - Get news by category (business, tech, sports, etc.)

货币服务器(/货币)

get_exchange_rates - Get current exchange rates
convert_currency - Convert between currencies
get_supported_currencies - List all supported currencies

报价服务器(/quotes)

get_random_quote - Get a random inspirational quote
get_quote_by_category - Get quotes by category
get_random_fact - Get a random interesting fact

🚀 部署

码头工人

您可以使用Docker部署此项目。示例 Dockerfile 包括:

FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 10000
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "10000"]

生产环境变量

PORT=10000
HOST=0.0.0.0
LOG_LEVEL=info
WORKERS=4

📝 许可证

此项目根据MIT许可证获得许可-有关详细信息,请参阅License.md文件。

📚 支持和文档

  • 查看文档 docs/ 目录
  • 查看测试文件以获取使用示例

🔄 更新和路线图

  • 添加对实时数据的WebSocket支持
  • 为API响应实现缓存
  • 添加速率限制和身份验证
  • 创建用于监控的web仪表板
  • 添加更多API集成(Spotify、Twitter等)

工具与能力

工具数量

0

资源数量

0

提示词数量

0

能力标签

API集成Python本地部署多服务管理FastAPI应用数据服务

支持客户端

CursorWindsurf

数量来自来源目录的标注,具体工具清单以官方文档为准。

典型使用场景

用自然语言查库

不用手写 SQL,直接问数据,让模型组织查询语句。

数据巡检

定期拉指标、做对比,把异常项整理成一段说明。

打通业务数据

把数据库、数仓和接口接进同一个上下文,减少导出再上传。

选择建议

值得选的地方

  • 只提供 0 个工具,职责集中,接入后不容易误操作。
  • 有现成的安装命令,不用自己找入口,照着跑就能起服务。
  • 已经适配 Cursor、Windsurf,换客户端不用重新研究配置。

先想清楚的地方

  • stdio 方式要求本地装好 运行环境,换机器要重新装一遍。
  • 公开摘要偏短,具体能力和限制要回到仓库确认。
  • 第三方目录整理,版本更新和行为细节以官方仓库为准。

更适合

  • 需要在数据服务场景里让模型直接调用外部能力的人。
  • 已经在用 Cursor 的用户,接入路径最短。
  • 想先快速试一下、能接受在本地跑服务的人。

不太适合

  • 完全不想在本地装环境的人。
  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

5 个同类
MCP Server工具数传输方式安装命令收录来源最后核验
Fastapi Multi Server MCP

MCP World · 本页

0stdio有1 个2026-05-17
Memory 9d25f64e

MCP World

9未说明未标注1 个2026-05-17
Prisma MCP Server

MCP World

0stdio有3 个2026-05-17
Astr Bot

MCP World

0stdio有1 个2026-05-17
Getzep MCP

MCP World

9stdio有1 个2026-05-17

按同分类和工具数量挑出最接近的几条,字段以各自详情页为准。

常见问题

5 条

Fastapi Multi Server MCP 怎么安装?

公开资料给出的安装命令是 pip install -r requirements.txt,运行环境为 未标注。装完后按客户端要求写进 MCP 配置,重启客户端生效。

Fastapi Multi Server MCP 怎么在 Claude Desktop、Cursor 里配置?

它是stdio 本地进程,客户端配置里要写启动命令和参数,运行环境是 未标注;保存后完全退出客户端再打开,配置才会生效。

Fastapi Multi Server MCP 收费吗?

本站只整理公开资料,不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

Fastapi Multi Server MCP 需要 API Key 吗?

公开资料标注为无需认证,装好就能连;如果实际调用时报鉴权错误,按官方文档补上凭据。

Fastapi Multi Server MCP 支持哪些客户端?

公开资料标注支持 Cursor、Windsurf;其他客户端只要能配置 MCP Server,也能用同样的命令或地址接入。

来源信息

继续浏览同类 MCP