← 返回首页
MCP Hub API 文档
完整的 API 接口说明
📋 服务管理接口
POST
/register
MCP 服务注册 - MCP Server 启动时调用
请求示例:
POST /register
Content-Type: application/json
{
"id": "wechat-mcp-001",
"type": "wechat",
"host": "192.168.1.100",
"port": 8765
}
响应示例:
{
"success": true,
"message": "MCP registered",
"instance": { "id", "type", "host", "port" }
}
POST
/unregister
MCP 服务注销 - MCP Server 停止时调用
请求示例:
POST /unregister
Content-Type: application/json
{ "id": "wechat-mcp-001" }
POST
/heartbeat
心跳更新 - MCP Server 每 30 秒调用一次
请求示例:
POST /heartbeat
Content-Type: application/json
{ "id": "wechat-mcp-001" }
📊 查询接口
GET
/instances
查询所有已注册的 MCP 实例
响应示例:
{
"success": true,
"count": 3,
"instances": [ ... ]
}
GET
/instances/:type
查询指定类型的 MCP 实例
请求示例:
GET /instances/wechat
GET
/stats
获取统计信息
响应示例:
{
"success": true,
"total": 3,
"active": 2,
"inactive": 1,
"byType": { "wechat": 1, "oa": 1, "wecom": 1 }
}
🚀 MCP 调用接口
POST
/mcp/:type/:method
统一 MCP 服务调用入口
请求示例:
POST /mcp/wechat/sendMessage
Content-Type: application/json
{
"to": "user1",
"text": "Hello"
}
响应示例:
{
"success": true,
"result": { ... }
}
🔧 其他接口
GET
/health
健康检查
响应示例:
{
"status": "ok",
"timestamp": "2026-03-27T08:00:00.000Z"
}