数字处理MCP服务器

一个简单的MCP HTTP服务器,接收3个数字输入并返回前2个数字,适用于数据处理和集成场景。

  • by rohan-kulkarni-25
  • JavaScript
  • 本地部署
  • 更新于
在 GitHub 查看 rohan-kulkarni-25/simple-number-mcp

使用说明

简单数字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

部署

铁路

  1. 将您的GitHub仓库连接到Railway
  2. Railway自动检测Node.js并运行 npm start
  3. 您的MCP服务器将在Railway URL上可用
  4. 使用 https://your-app.railway.app/tools 列出工具

渲染

  1. 创建新的Web服务
  2. 连接GitHub仓库
  3. 构建命令: npm install
  4. 启动命令: npm start

维塞尔

  1. 导入GitHub仓库
  2. 框架预设:其他
  3. 构建命令:(留空)
  4. 输出目录:(留空)
  5. 部署!

与Bhindi整合

将此MCP服务器添加到Bhindi:

{
  "name": "simple-number-mcp",
  "endpoint": "https://your-railway-url.railway.app",
  "type": "http"
}

环境变量

  • PORT -服务器端口(默认值:3000)

许可证

麻省理工学院