用途:在 Python 中用 FastMCP 构建 MCP 服务器,把 API、数据库、CLI 或文件处理流程封装为 MCP 工具,也可暴露资源与提示词;本地验证后安装到 MCP 客户端或部署为 HTTP 端点。若服务器已存在只需接入 Hermes,应使用 native-mcp;若只需临时 CLI 访问已有服务器,应使用 mcporter。
主要能力:提供 API 包装、只读 SQLite 查询、文本文件检查与搜索三类模板,以及脚手架脚本 scaffold_fastmcp.py 和 CLI 参考文档。工具设计建议使用动词命名、明确类型参数、返回 JSON 安全数据、默认只读。
使用方式:先安装 pip install fastmcp 并运行 fastmcp version;API 模板需 pip install httpx。可用脚手架复制模板:python ~/.hermes/skills/mcp/fastmcp/scripts/scaffold_fastmcp.py --template api_wrapper --name "Acme API" --output ./acme_server.py。本地验证命令包括 fastmcp inspect acme_server.py:mcp、fastmcp list acme_server.py --json、fastmcp call acme_server.py search_resources query=router limit=5 --json;本地运行 fastmcp run acme_server.py:mcp,HTTP 传输加 --transport http --host 127.0.0.1 --port 8000。安装到客户端:fastmcp install claude-code acme_server.py、fastmcp install claude-desktop acme_server.py、fastmcp install cursor acme_server.py -e .。
适用场景:新建 MCP 服务器、包装 API/数据库/文件流程、暴露资源或提示词、接入 Claude Code/Claude Desktop/Cursor、准备 HTTP 部署。
限制:资料未提供具体收费、价格、平台支持范围或性能数据;部署到托管平台仅提及 Prefect Horizon,通用 HTTP 托管需自行验证端口暴露。Hermes 集成需在 ~/.hermes/config.yaml 配置并重启。