補齊 MCP 早退狀態
All checks were successful
CD Pipeline / deploy (push) Successful in 57s

This commit is contained in:
OoO
2026-05-13 09:40:55 +08:00
parent d7ae243ece
commit ba8510eac7
2 changed files with 6 additions and 0 deletions

View File

@@ -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 命中

View File

@@ -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()