Skip to content

fix(mcp): filter tool catalog by the sandbox tool allowlist - #1450

Open
ivpusic wants to merge 1 commit into
paradigmxyz:mainfrom
ivpusic:mcp-tool-allowlist
Open

fix(mcp): filter tool catalog by the sandbox tool allowlist#1450
ivpusic wants to merge 1 commit into
paradigmxyz:mainfrom
ivpusic:mcp-tool-allowlist

Conversation

@ivpusic

@ivpusic ivpusic commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

The MCP endpoint advertises every discovered tool, but sandboxes only install tools admitted by TOOL_ALLOWLIST/TOOL_BLOCKLIST (services/sandbox/install_tool_shims.py). tools/list therefore includes entries whose calls can only fail in the tool host, and MCP clients plan around those phantom tools.

Filter the MCP tool catalog with the same lists, parsed from SESSION_SANDBOX_EXTRA_ENV — the exact values sandbox pods boot with, so the advertised catalog cannot drift from what the tool host enforces. Matching mirrors the sandbox shim gate: package directory name or pyproject project name; unset or empty lists mean unrestricted (backward compatible for deployments without an allowlist). Since both tools/list and the tools/call lookup resolve through the catalog, non-admitted tools disappear from the listing and calls to them return "unknown tool" instead of dispatching to a sandbox that never installed them.

Validation: cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings, cargo test -p centaur-api-server (MCP module: 19 passed, including 3 new tests for default admit-all, dir/project-name + blocklist matching, and catalog wiring end to end).

The MCP endpoint advertised every discovered tool, but sandboxes only
install tools admitted by TOOL_ALLOWLIST/TOOL_BLOCKLIST, so tools/list
included entries whose calls could only fail in the tool host -- and
clients plan around those phantom tools. Filter the MCP catalog with
the same lists, parsed from SESSION_SANDBOX_EXTRA_ENV (the exact values
sandbox pods boot with), matching the sandbox shim gate: package
directory name or pyproject project name, unset meaning unrestricted.
Covers both tools/list and the tools/call lookup.
@ivpusic
ivpusic marked this pull request as ready for review August 21, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant