FastAPI MCP服务

一个通过SSE传输暴露MCP工具的最小化FastAPI服务器。

  • by Anurag-Keshri-ServiceNow
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 Anurag-Keshri-ServiceNow/fastapi-mcp-server

使用说明

FastAPI MCP服务器

通过SSE传输公开MCP工具的最小FastAPI服务器。

设置

uv sync

跑

uv run python server.py

服务器运行于 http://localhost:3000

工具

工具 说明
hello(name) 返回问候语
add(a, b) 将两个数字相加

从克劳德桌面连接

添加 claude_desktop_config.json:

{
  "mcpServers": {
    "hello-world": {
      "url": "http://localhost:3000/mcp/sse"
    }
  }
}

fastapi mcp服务器