简单数字MCP服务器(HTTP)
一个简单的MCP HTTP服务器,它接受3个数字作为输入,只返回前2个数字。
特性
- 符合MCP的HTTP端点
- 通过工具调用将3个数字作为输入
- 仅返回前两个数字
- 用于监控的健康检查端点
- 准备好铁路/渲染/Vercel部署
安装
npm install用法
本地运行
npm start服务器在上运行 http://localhost:3000 (或PORT环境变量)
MCP端点
1.列出工具
GET /tools答复:
{
"tools": [
{
"name": "process_numbers",
"description": "Takes 3 numbers and returns the first 2 numbers",
"inputSchema": {
"type": "object",
"properties": {
"num1": { "type": "number", "description": "First number" },
"num2": { "type": "number", "description": "Second number" },
"num3": { "type": "number", "description": "Third number (will be ignored)" }
},
"required": ["num1", "num2", "num3"]
}
}
]
}2.调用工具
POST /tools/call
Content-Type: application/json
{
"name": "process_numbers",
"arguments": {
"num1": 10,
"num2": 20,
"num3": 30
}
}答复:
{
"content": [
{
"type": "text",
"text": "{\n \"result\": [10, 20],\n \"message\": \"Received 3 numbers (10, 20, 30), returning first 2: [10, 20]\"\n}"
}
]
}3.健康检查
GET /health答复:
{
"status": "healthy",
"service": "simple-number-mcp",
"version": "1.0.0",
"timestamp": "2025-11-09T12:00:00.000Z"
}使用cURL进行测试
# List available tools
curl http://localhost:3000/tools
# Call the process_numbers tool
curl -X POST http://localhost:3000/tools/call \
-H "Content-Type: application/json" \
-d '{
"name": "process_numbers",
"arguments": {
"num1": 10,
"num2": 20,
"num3": 30
}
}'
# Health check
curl http://localhost:3000/health部署
铁路
- 将您的GitHub仓库连接到Railway
- Railway自动检测Node.js并运行
npm start - 您的MCP服务器将在Railway URL上可用
- 使用
https://your-app.railway.app/tools列出工具
渲染
- 创建新的Web服务
- 连接GitHub仓库
- 构建命令:
npm install - 启动命令:
npm start
维塞尔
- 导入GitHub仓库
- 框架预设:其他
- 构建命令:(留空)
- 输出目录:(留空)
- 部署!
与Bhindi整合
将此MCP服务器添加到Bhindi:
{
"name": "simple-number-mcp",
"endpoint": "https://your-railway-url.railway.app",
"type": "http"
}环境变量
PORT-服务器端口(默认值:3000)
许可证
麻省理工学院
