From 7c827e4ec80cfd40d04faeb1bf4f1a8ed09ee91e Mon Sep 17 00:00:00 2001 From: Soulter <37870767+Soulter@users.noreply.github.com> Date: Sun, 12 Apr 2026 15:01:29 +0800 Subject: [PATCH] Update astrbot/core/agent/mcp_client.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- astrbot/core/agent/mcp_client.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/astrbot/core/agent/mcp_client.py b/astrbot/core/agent/mcp_client.py index 9ca2d19fb..918f93f45 100644 --- a/astrbot/core/agent/mcp_client.py +++ b/astrbot/core/agent/mcp_client.py @@ -171,7 +171,12 @@ def _validate_stdio_args(command_name: str, args: object) -> None: "MCP stdio JavaScript servers must be launched from a package or file; inline eval flags are not allowed." ) elif command_name == "docker": - denied = [arg for arg in args if arg in _DENIED_DOCKER_ARGS] + denied = [] + for i, arg in enumerate(args): + if arg in _DENIED_DOCKER_ARGS: + denied.append(arg) + elif arg in {"--network", "--net", "--pid", "--ipc"} and i + 1 < len(args) and args[i+1] == "host": + denied.append(f"{arg} {args[i+1]}") if denied: raise ValueError( f"MCP stdio Docker args are unsafe and not allowed: {', '.join(denied)}."