FastMCP服务器模板

一个基于FastMCP的最小化服务器模板,支持可流式HTTP传输,用于Render部署。

  • by ishanla
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 ishanla/oura-mcp-server

使用说明

MCP服务器模板

最低限度 快速MCP 用于具有流式HTTP传输的Render部署的服务器模板。

本地开发

设置

分叉repo,然后运行:

git clone <your-repo-url>
cd mcp-server-template
conda create -n mcp-server python=3.13
conda activate mcp-server
pip install -r requirements.txt

测试

python src/server.py
# then in another terminal run:
npx @modelcontextprotocol/inspector

打开http://localhost:3000并连接到 http://localhost:8000/mcp 使用“流式HTTP”传输(注意 /mcp!).

部署

选项1:一键部署

单击上面的“部署到渲染”按钮。

选项2:手动部署

  1. 分叉此存储库
  2. 将您的GitHub帐户连接到Render
  3. 在Render上创建新的Web服务
  4. 连接您的分叉存储库
  5. 渲染将自动检测 render.yaml 配置

您的服务器将在 https://your-service-name.onrender.com/mcp (注意 /mcp!)

Poke设置

您可以将MCP服务器连接到Poke at(Poke.com/settings/connections)[Poke.com/settings/connections]。 要明确地测试连接,可以问戳一下 Tell the subagent to use the "{connection name}" integration's "{tool name}" tool. 如果您遇到持续的poke未调用正确的MCP的问题(例如,在您重命名连接后),您可以发送 clearhistory 戳以删除所有消息历史记录并重新开始。 我们正在努力改进Poke的集成使用:)

定制

通过装饰功能添加更多工具 @mcp.tool:

@mcp.tool
def calculate(x: float, y: float, operation: str) -> float:
    """Perform basic arithmetic operations."""
    if operation == "add":
        return x + y
    elif operation == "multiply":
        return x * y
    # ...