MCP服务器模板

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

  • by KJ14GOD
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 KJ14GOD/tvMCP

使用说明

MCP服务器模板

一个最小值 FastMCP 用于Render部署的可流式HTTP传输服务器模板。

本地开发

设置

克隆该仓库,然后运行:

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:一键部署

点击上方的“部署到Render”按钮。

选项2:手动部署

  1. 克隆这个仓库
  2. 将您的GitHub帐户连接到Render
  3. 在Render上创建一个新的Web服务
  4. 连接你的克隆仓库
  5. Render 将自动检测 render.yaml 配置

您的服务器将在以下地址可用: https://your-service-name.onrender.com/mcp (请注意 /mcp!

设置投掷

您可以将您的MCP服务器连接到Poke,连接地址为(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
    # ...