This commit is contained in:
@@ -236,6 +236,7 @@ class MCPRouter:
|
||||
return MCPResult(
|
||||
success=False, server=server, tool=tool,
|
||||
error='MCP_ROUTER_ENABLED=false (戰役 v5.0 預設 OFF;待 docker-compose.mcp.yml deploy 後翻 ON)',
|
||||
status='error',
|
||||
)
|
||||
|
||||
# 白名單檢查
|
||||
@@ -243,6 +244,7 @@ class MCPRouter:
|
||||
return MCPResult(
|
||||
success=False, server=server, tool=tool,
|
||||
error=f'tool not in registry: caller={caller} server={server} tool={tool}',
|
||||
status='error',
|
||||
)
|
||||
|
||||
# Server 配置檢查
|
||||
@@ -251,6 +253,7 @@ class MCPRouter:
|
||||
return MCPResult(
|
||||
success=False, server=server, tool=tool,
|
||||
error=f'unknown server: {server}',
|
||||
status='error',
|
||||
)
|
||||
|
||||
# Cache 命中
|
||||
|
||||
@@ -48,6 +48,7 @@ def test_flag_off_returns_failure_without_http(monkeypatch):
|
||||
)
|
||||
|
||||
assert result.success is False
|
||||
assert result.status == 'error'
|
||||
assert 'MCP_ROUTER_ENABLED=false' in (result.error or '')
|
||||
mock_post.assert_not_called()
|
||||
|
||||
@@ -68,6 +69,7 @@ def test_unauthorized_caller_tool_combo_rejected(monkeypatch):
|
||||
)
|
||||
|
||||
assert result.success is False
|
||||
assert result.status == 'error'
|
||||
assert 'tool not in registry' in (result.error or '')
|
||||
mock_post.assert_not_called()
|
||||
|
||||
@@ -244,4 +246,5 @@ def test_unknown_server_rejected(monkeypatch):
|
||||
|
||||
# 注意:白名單檢查在前,會先回 'tool not in registry'(因為 omnisearch_wrong 不在 registry)
|
||||
assert result.success is False
|
||||
assert result.status == 'error'
|
||||
mock_post.assert_not_called()
|
||||
|
||||
Reference in New Issue
Block a user