MCP服务器模板
一个最小的 FastMCP 用于渲染部署的服务器模板,支持流式HTTP传输。

本地开发
设置
克隆该仓库,然后运行:
git clone
cd mcp-server-template
conda create -n mcp-server python=3.13
conda activate mcp-server
pip install -r requirements.txt
cp .env.example .env测试
python src/server.py
# then in another terminal run:
npx @modelcontextprotocol/inspector确保 .env 包含:
POKE_API_KEY=your_poke_api_key
POKE_API_BASE_URL=https://poke.com/api/v1
FRONTEND_SHARED_SECRET=your_shared_secret打开 http://localhost:3000 并连接到 http://localhost:8000/mcp 使用“可流式传输HTTP”传输(注意 /mcp!
部署
选项1:一键部署
点击上方的“部署到Render”按钮。
选项2:手动部署
- 为这个仓库创建分支
- 将您的GitHub帐户连接到Render
- 在Render上创建一个新的Web服务
- 连接你的分叉仓库
- Render 将自动检测
render.yaml配置
您的服务器将在 https://your-service-name.onrender.com/mcp (请注意 /mcp!)
“Poke Setup”可以翻译为“刺戳设置”或根据上下文可能意为“插入设置”或“探测设置”(具体取决于“Poke”在该语境下的确切含义,但“刺戳”是较为直译的选项)
您可以将您的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
# ...