Repository navigation
fix(mcp): use the dispatched tool namespace for health checks - #4023
Conversation
ECC Tools / Security EvidenceCommit: Security scanner evidence required (action_required) Detected 1 security-sensitive predictive risk signal(s) without scanner evidence. Mode: enforce Findings:
Touched security-sensitive paths:
Expected evidence:
Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
ECC Tools / PR Risk TaxonomyCommit: PR taxonomy review recommended (neutral) Detected 2 PR taxonomy bucket(s): Security Evidence, CI/CD Recommendation. Scanned 2 changed file(s). Roadmap taxonomy buckets: Security EvidenceSecurity-sensitive changes should carry explicit scanner, code-scanning, or focused regression evidence. Signals:
Paths:
CI/CD RecommendationCI, dependency, coverage, and contract signals should be routed into follow-up checks or verification work. Signals:
Paths:
Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
ECC Tools / Reference Set ReadinessCommit: Reference set readiness gaps detected (neutral) Reference evidence present for 1/7 areas (14%) across 2 changed file(s). This check is based on files changed in this PR. Repository-level readiness is still reported by
Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
ECC Tools / Hosted Promotion ReadinessCommit: Hosted promotion readiness passed (success) No hosted promotion evidence gaps detected across 2 changed file(s); 0 corpus scenarios had matching evidence. This check compares PR file changes against the evaluator/RAG promotion corpus in No evaluator corpus scenarios matched this PR. Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission. |
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
[Medium impact] The PR appears safe to merge; no actionable issues were found.
|
|
Thank you for using the dispatched MCP tool namespace in health checks. We merged your original commit history through #4048 so the related changes could be tested together. The resulting main commit |
A well-formed mcp__<server>__<tool> name already names the server before any argument is read (affaan-m#4023). This covers the paths that still let a tool argument or a non-string value choose the probed server: - A tool name that starts with mcp__ but does not parse (mcp__foo, mcp____tool, mcp__) no longer falls back to tool_input.server, mcp_server or connector; those are the MCP tool's own arguments. - Explicit server values must be strings matching the server-id pattern. An object was stringified, so a generic wrapper call such as call_mcp with tool_input.server = {host: 'x'} logged "[object Object]". - In truncated input, server and tool values found by regex anywhere in the raw text are passed as tool_input, so they are not trusted for an mcp__ name that does not parse. The pattern is now one SERVER_ID_PATTERN constant, also used by resolveServerConfig() and reconnectCommand(). tool_input.* is still honored for generic wrapper tools whose name is not an mcp__ name. Claude Code only emits well-formed mcp__<server>__<tool> names, and ^mcp__ keeps generic wrapper tools out, so this is defensive.
A well-formed mcp__<server>__<tool> name already names the server before any argument is read (affaan-m#4023). This covers the paths that still let a tool argument or a non-string value choose the probed server: - A tool name that starts with mcp__ but does not parse (mcp__foo, mcp____tool, mcp__) no longer falls back to tool_input.server, mcp_server or connector; those are the MCP tool's own arguments. - Explicit server values must be strings matching the server-id pattern. An object was stringified, so a generic wrapper call such as call_mcp with tool_input.server = {host: 'x'} logged "[object Object]". - In truncated input, server and tool values found by regex anywhere in the raw text are passed as tool_input, so they are not trusted for an mcp__ name that does not parse. The pattern is now one SERVER_ID_PATTERN constant, also used by resolveServerConfig() and reconnectCommand(). tool_input.* is still honored for generic wrapper tools whose name is not an mcp__ name. Claude Code only emits well-formed mcp__<server>__<tool> names, and ^mcp__ keeps generic wrapper tools out, so this is defensive.
What Changed
The health hook identifies native MCP calls from their
mcp__server__toolname before checking explicit adapter fields. Generic adapters can still provide their target as before.Why This Change
I found this while inspecting the hook's target resolution. With a native
mcp__deployment__lookup__statuscall whose tool schema also definesserverandtoolarguments, the failure hook wrote health state to the server named in the arguments. A subsequent preflight could inherit that wrong server's backoff. The test drives both registered event paths and demonstrates that backoff and tool labels now stay attached to the dispatched MCP endpoint.Testing Done
reportingbefore the fix. Afterward, the failure and subsequent preflight were correctly attributed todeploymentandlookup__status.ECC_TEST_ONLY=hooks/mcp-health-check.test.js npm testpassed the validators and 36 selected checks on macOS, Node 22.23.5. The suite also covers explicit targets for generic adapters and truncated payloads.git diff --checkpassed. Full unfiltered suite status is unverified on Node 22.Type of Change
fix:Bug fixCodex assisted with the reproducer, implementation, tests, and description.