補上 MCP filesystem 唯讀白名單
All checks were successful
CD Pipeline / deploy (push) Successful in 55s

This commit is contained in:
OoO
2026-05-13 09:26:12 +08:00
parent 6817f6437e
commit 44eb36992e
2 changed files with 39 additions and 0 deletions

View File

@@ -66,6 +66,16 @@ def is_mcp_router_enabled() -> bool:
# ─────────────────────────────────────────────────────────────────────────────
# Tool 白名單caller × server × tool— 限制 LLM 不能亂打 MCP
# ─────────────────────────────────────────────────────────────────────────────
READONLY_FILESYSTEM_TOOLS = [
'list_allowed_directories',
'list_directory',
'directory_tree',
'read_file',
'read_multiple_files',
'search_files',
'get_file_info',
]
TOOL_REGISTRY: Dict[str, Dict[str, List[str]]] = {
# mcp_collector 取代 Gemini Grounding
'mcp_collector': {
@@ -83,6 +93,10 @@ TOOL_REGISTRY: Dict[str, Dict[str, List[str]]] = {
'postgres': ['query'],
'omnisearch': ['tavily_search', 'exa_search'],
},
# filesystem-mcp 僅掛載 /data、/logs read-only保留給診斷工具讀檔不開寫入類工具。
'ops_diagnostics': {
'filesystem': READONLY_FILESYSTEM_TOOLS,
},
}