使用说明
MCP Python适配器(规范JSON)
此服务充当MCP Orchestrator前面的精简适配器。
它
- 接受 规范JSON 来自任何客户
POST /canonical/voice - 将其转换为简单的MCP
/orchestrate请求格式 - 呼叫MCP编排器
- 将响应包装回规范响应信封中
端点
GET /health–基本健康检查POST /canonical/voice–规范消息的主要入口点
预期规范请求(示例)
{
"version": "1.0",
"timestamp": "2025-11-21T12:44:05.112Z",
"context": {
"channel": "web",
"device": "browser",
"locale": "en-US",
"tenant": "blinksbuy",
"client_app": "food-order-widget"
},
"session": {
"session_id": "postman-user-B:web",
"conversation_id": "conv-23f98c83-9928-4e41-b9f4-01d4998689f2",
"user_id": "postman-user-B",
"turn": 7
},
"request": {
"type": "text",
"text": "Can you please get the menu?",
"intent_override": null
},
"observability": {
"trace_id": "trace-319bf86a-6688-40d5-9833-437b7e2345b2",
"span_id": "span-adapter-in-0021"
}
}
MCP请求(内部)
适配器将此规范信封转换为对MCP Orchestrator的调用:
{
"text": "Can you please get the menu?",
"user_id": "postman-user-B",
"channel": "web",
"session_id": "postman-user-B:web"
}
铁路部署
-
从此仓库创建新服务。
-
设置环境变量
MCP_URL发送给您的MCP编排器/orchestrateURL。 -
铁路将安装
requirements.txt并运行Procfile:web: uvicorn app:app --host 0.0.0.0 --port $PORT
部署后,您可以使用进行测试 POST /canonical/voice.