Skip to content

Commit 7481c24

Browse files
committed
Consolidate 3 MCP servers into one unified eval-mcp
Merges synthetic-mcp, providers-mcp, and dataset-mcp into a single server (backend/mcp_servers/server.py) with all 17 tools. Supports both stdio (local Claude Code) and HTTP (deployed) transports. - Docker Compose: 1 eval-mcp container instead of 3 separate ones - Helm chart: 1 sidecar instead of 3 in K8s deployment - Backend connects to single EVAL_MCP_URL - user_id injection simplified (no server name check needed) - Tool signatures matched exactly to old servers
1 parent 0790350 commit 7481c24

6 files changed

Lines changed: 759 additions & 151 deletions

File tree

backend/api/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ async def cancel_chat(session_id: str, user_id: str = Depends(get_current_user_i
635635
# Read eval info BEFORE cancelling (read-only, doesn't kill subprocess)
636636
eval_info = {}
637637
try:
638-
mcp_url = os.environ["SYNTHETIC_EVAL_MCP_URL"]
638+
mcp_url = os.environ["EVAL_MCP_URL"]
639639
base_url = mcp_url.replace("/mcp", "")
640640
async with httpx.AsyncClient() as client:
641641
resp = await client.get(f"{base_url}/eval-info/{user_id}", timeout=2.0)
@@ -652,11 +652,11 @@ async def cancel_chat(session_id: str, user_id: str = Depends(get_current_user_i
652652

653653
# Kill the evaluation subprocess and reconnect MCP
654654
try:
655-
mcp_url = os.environ["SYNTHETIC_EVAL_MCP_URL"]
655+
mcp_url = os.environ["EVAL_MCP_URL"]
656656
base_url = mcp_url.replace("/mcp", "")
657657
async with httpx.AsyncClient() as client:
658658
await client.post(f"{base_url}/cancel/{user_id}", timeout=5.0)
659-
await mcp_client.reconnect_server("synthetic-eval")
659+
await mcp_client.reconnect_server("eval")
660660
except Exception as e:
661661
logger.warning(f"[CANCEL] Failed to cancel evaluation: {e}")
662662

backend/core/mcp_client.py

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,11 @@ def __init__(self, working_dir: Optional[str] = None, region: str = "us-west-2")
6666
env["INSPECT_LOG_DIR"] = cwd
6767
env["AWS_REGION"] = region
6868

69-
# Server configurations - ALL HTTP (no stdio!)
70-
# URLs configured via environment variables (required)
71-
# Note: viewer is handled by backend directly, not as MCP server
69+
# Single unified MCP server
7270
self._server_configs = {
73-
"synthetic-eval": {
71+
"eval": {
7472
"type": "http",
75-
"url": os.environ["SYNTHETIC_EVAL_MCP_URL"],
76-
},
77-
"providers": {
78-
"type": "http",
79-
"url": os.environ["PROVIDERS_MCP_URL"],
80-
},
81-
"dataset": {
82-
"type": "http",
83-
"url": os.environ["DATASET_MCP_URL"],
73+
"url": os.environ["EVAL_MCP_URL"],
8474
},
8575
}
8676

@@ -305,7 +295,7 @@ async def call_tool(self, tool_name: str, arguments: Optional[Dict[str, Any]] =
305295
raise RuntimeError(f"Tool '{tool_name}' not found on any server")
306296

307297
# Auto-inject user_id for tools that need it
308-
if server_name in ("synthetic-eval", "dataset") and self.user_id:
298+
if self.user_id:
309299
arguments = arguments or {}
310300
arguments["user_id"] = self.user_id
311301

0 commit comments

Comments
 (0)