使用说明
MCP Monorepo–监听通道+MCP编排器
- MCP编排器
- 拥有 会话、状态和内存
- 使用混凝土
SessionContext内部结构 - 将决定+回复返回给收听频道
- 用于MCP集成(您可以插入
mcp稍后打包)
高级数据流:
[User / External System]
↓
[Listening Channel /External Systen]
↓ (normalized event)
Block 2: MCP Orchestrator (Session + State + Memory)
此版本使用 一个回购, 一个虚拟,以及 没有Docker.
1.设置
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
可选:复制环境文件
cp .env.example .env
2.运行MCP编排器
在一个终端中:
source .venv/bin/activate
make run-orchestrator
# or, manually:
# uvicorn apps.orchestrator.app.main:app --reload --port 7002
检查健康状况:
curl http://localhost:7002/health
4.端到端测试
呼叫 收听频道;它转发给 MCP编排器,管理 SessionContext
为了 user-123:web:
curl -X POST http://localhost:7001/events/incoming -H "Content-Type: application/json" -d '{
"channel": "web",
"user_id": "user-123",
"text": "hello orchestrator"
}'
预期形状:
{
"status": "ok",
"reply": {
"decision": "reply",
"reply_text": "Hello, user-123! (from MCP Orchestrator)",
"memory_snapshot": {
"session_id": "user-123:web",
"turn_count": 1
},
"debug": {
"version": "v1",
"channel": "web"
}
}
}
5.项目结构
apps/
orchestrator/ # Main MCP Orchestrator
app/
__init__.py
main.py # FastAPI app (MCP Orchestrator)
config.py
models.py # Request/response for orchestrator API
session_context.py # SessionContext struct
memory_store.py # Simple in-memory store
orchestration.py # AgentCore using SessionContext
tests/
test_orchestrator_health.py
6.测试
source .venv/bin/activate
pytest -q
您可以将此monorepo直接推送到GitHub,并对这两种服务进行改进 同时按文件夹保持干净的分隔。
