feat: add MCP code-mode namespace#88636
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed May 31, 2026, 9:39 AM ET / 13:39 UTC. Summary PR surface: Source +325, Tests +219, Docs +30. Total +574 across 8 files. Reproducibility: yes. for the review finding by source inspection: a code-mode snippet that searches/describes an MCP entry and then calls Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Land the MCP namespace as an additive preferred API while preserving the shipped generic MCP Do we have a high-confidence way to reproduce the issue? Yes for the review finding by source inspection: a code-mode snippet that searches/describes an MCP entry and then calls Is this the best way to solve the issue? No as written: the generated MCP namespace is a good additive direction, but making it the only supported path breaks the shipped generic catalog-call contract. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 5dc4531fdf56. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +325, Tests +219, Docs +30. Total +574 across 8 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fe2e38e373
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const mcpEntry = createMcpNamespaceEntry(catalog); | ||
| if (mcpEntry) { | ||
| entries.push(mcpEntry); |
There was a problem hiding this comment.
Reserve the built-in MCP namespace id
If any registered plugin namespace uses id mcp with a different global name, this new built-in MCP entry is serialized for the MCP global, but createCodeModeNamespaceRuntime later builds byId from all entries and the plugin registration wins the same mcp key. In runs with visible MCP tools, MCP.<server>.<tool>(...) will then resolve against the plugin namespace and fail as not callable; reserve/reject the mcp id or make the built-in namespace id collision-proof.
Useful? React with 👍 / 👎.
* feat: add MCP code-mode namespace * fix: unblock mcp namespace ci gates
* feat: add MCP code-mode namespace * fix: unblock mcp namespace ci gates
* feat: add MCP code-mode namespace * fix: unblock mcp namespace ci gates
Summary
MCPnamespace grouped by MCP server, with tools plus resource/prompt helpers dispatching through exact catalog ids.tools.call(...)attempts in code mode so MCP calls have one supported path.Verification
node scripts/run-vitest.mjs src/agents/code-mode.test.ts src/agents/agent-bundle-mcp-tools.materialize.test.ts -- --reporter=dotPATH="/opt/homebrew/opt/node@24/bin:$PATH" node scripts/run-tsgo.mjs -p tsconfig.core.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core.tsbuildinfo && PATH="/opt/homebrew/opt/node@24/bin:$PATH" node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core-test.tsbuildinfopnpm buildpnpm exec oxfmt --check docs/reference/code-mode.md src/agents/agent-bundle-mcp-materialize.ts src/agents/agent-bundle-mcp-tools.materialize.test.ts src/agents/code-mode-namespaces.ts src/agents/code-mode.test.ts src/agents/code-mode.ts src/agents/tool-search.ts src/plugins/tools.tsgit diff --check.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/mainKnown unrelated local gate issues seen during verification:
pnpm format:docs:checkcurrently reportsdocs/tools/slash-commands.md, outside this branch.pnpm test:changedreaches unrelated media-understanding audio failures after the touched MCP/code-mode tests pass.check:changedpasses core/core-test typecheck, then fails in an unrelated Discord boundary dts check.check:changedrun https://github.com/openclaw/openclaw/actions/runs/26713144570 failed during dependency install before code execution (esbuild/ Matrix optional dependency postinstall), not in this patch.Real behavior proof
Behavior addressed: MCP tools in code mode now have one supported call path: generated
MCP.<server>.<tool>(...)namespace calls.Real environment tested: Local OpenClaw checkout on macOS, Node 24 for typecheck and Node 26 for build/test runner defaults.
Exact steps or command run after this patch:
node scripts/run-vitest.mjs src/agents/code-mode.test.ts src/agents/agent-bundle-mcp-tools.materialize.test.ts -- --reporter=dot;pnpm build; final autoreview command above.Evidence after fix: Code-mode regression tests show
MCP.github.createIssue(...),MCP.docs.resources.read(...), andMCP.docs.prompts.get(...)dispatch through exact catalog ids, while directtools.github__create_issue(...)rejects.Observed result after fix: MCP namespace calls return full tool results, schema defaults are applied, unsafe namespace identifiers are suffixed, and direct MCP calls fail closed with the new error.
What was not tested: A live external MCP server call through a real provider session; CI will cover the hosted Linux lanes after PR creation.