Skip to content

fix(mcp): keep resource-only servers available after unknown methods - #115169

Merged
steipete merged 1 commit into
mainfrom
codex/code-mode-adversarial-stress
Jul 28, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/code-mode-adversarial-stress

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Closes #111940

What Problem This Solves

Fixes an issue where users configuring resource-only or prompt-only MCP servers would lose access to the server when it reports unsupported tools/list requests as -32000 Unknown method.

Why This Change Was Made

Recognize the common nonstandard Unknown method spelling only through the existing unsupported-method classifier. The current capability gate remains authoritative, so servers advertising tools still surface their tools/list failures instead of being silently accepted.

User Impact

Resource-only and prompt-only MCP servers remain connected and available for utility tools when they do not implement optional tool discovery. Errors from tools-capable MCP servers continue to appear in catalog diagnostics.

Evidence

  • Reproduced both failures using real spawned stdio MCP servers: before the fix, 80 tests passed and the new resource-only and prompt-only cases failed; the tools-capable negative case passed.
  • Remote Linux proof: pnpm test src/agents/agent-bundle-mcp-runtime.test.ts — all 82 tests passed after the fix.
  • Remote Linux changed gate: pnpm check:changed — passed, including core and core-test type checks, formatting, lint, plugin boundaries, dependency pins, and database guards.
  • Fresh structured autoreview --mode uncommitted — clean, no actionable findings.
  • Verified the installed MCP SDK error behavior and upstream Codex MCP source before changing compatibility behavior.
  • AI-assisted implementation and review.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Jul 28, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels Jul 28, 2026
@clawsweeper

clawsweeper Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 28, 2026, 7:55 AM ET / 11:55 UTC.

ClawSweeper review

What this changes

This PR recognizes Unknown method as an unsupported optional MCP tools/list response so resource-only and prompt-only servers remain available while servers that advertise tools still report discovery failures.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this PR open for normal maintainer review. The provided evidence describes a narrow MCP compatibility repair with real spawned-server proof, but the protected maintainer label means conservative cleanup must not auto-close it; the available review environment could not complete the required source-and-history inspection.

Priority: P2
Reviewed head: 6f98a05ad053e385c4a8c4b346cb6fdabcfb8f4e

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, regression-tested compatibility repair with reported real-runtime proof; landing still needs the ordinary current-head review because the branch is behind main.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR body provides after-fix evidence from real spawned stdio MCP servers, including resource-only and prompt-only success cases plus a tools-capable negative case; redact any connection or endpoint details if this proof is reposted.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body provides after-fix evidence from real spawned stdio MCP servers, including resource-only and prompt-only success cases plus a tools-capable negative case; redact any connection or endpoint details if this proof is reposted.
Evidence reviewed 4 items PR intent and supplied live proof: The PR body reports before/after runs against spawned stdio MCP servers for resource-only and prompt-only capability advertisements, plus a tools-capable negative case; it says the focused runtime suite passed after the change.
Narrow runtime change: The supplied diff changes the existing optional-method classifier to recognize the nonstandard Unknown method wording alongside JSON-RPC -32601 and Method not found; the accompanying tests cover both accepted capability-only servers and a tools-capable negative case.
Canonical bug relationship: The PR body explicitly links the open report describing -32000 plus Unknown method during optional tools/list discovery, including a concrete resource-only reproduction and expected retention of non-tool capabilities.
Findings None None.
Security None None.

How this fits together

OpenClaw builds an MCP catalog by initializing configured MCP servers and attempting optional tool discovery. The resulting catalog feeds agent utility tools and diagnostics, so an unsupported optional discovery method must not remove otherwise usable resource or prompt capabilities.

flowchart LR
  A[Configured MCP server] --> B[MCP initialization]
  B --> C[Optional tools list request]
  C --> D{Unsupported method?}
  D -->|Yes, server has no tools| E[Keep resource or prompt server]
  D -->|No or server advertises tools| F[Report catalog diagnostic]
  E --> G[Agent MCP catalog]
  F --> G[Agent MCP catalog]
Loading

Before merge

  • Resolve merge risk (P1) - The branch is reported as behind current main; refresh the merge result and confirm the focused MCP runtime tests still exercise the exact head before landing.
  • Resolve merge risk (P1) - The supplied proof is strong but could not be independently checked against the current source, callers, SDK contract, or Git history in this read-only execution environment.
Agent review details

Security

None.

PR surface

Source 0, Tests +64. Total +64 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 1 1 0
Tests 1 68 4 +64
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 69 5 +64

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Rebase or refresh the PR against current main, preserve the capability-gated behavior, and land it once a maintainer confirms the classifier remains limited to optional discovery failures for servers that do not advertise tools.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Rebase or refresh the PR against current main, preserve the capability-gated behavior, and land it once a maintainer confirms the classifier remains limited to optional discovery failures for servers that do not advertise tools.

Do we have a high-confidence way to reproduce the issue?

Yes, at source level: configure a resource-only or prompt-only stdio MCP server to return JSON-RPC -32000 with Unknown method for optional tools/list, then build the MCP catalog. The PR body reports that this path was exercised with real spawned servers, but it could not be independently rerun here.

Is this the best way to solve the issue?

Yes, provisionally: extending the existing unsupported-method classifier is narrower than adding a new fallback path, and the stated capability gate preserves diagnostics for tool-advertising servers. A maintainer should still confirm that conclusion against the current caller and MCP SDK behavior after the branch refresh.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 89b6d85cdd86.

Labels

Label changes:

  • add P2: This is a focused MCP catalog-initialization regression affecting resource-only and prompt-only server integrations, with limited blast radius.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix evidence from real spawned stdio MCP servers, including resource-only and prompt-only success cases plus a tools-capable negative case; redact any connection or endpoint details if this proof is reposted.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides after-fix evidence from real spawned stdio MCP servers, including resource-only and prompt-only success cases plus a tools-capable negative case; redact any connection or endpoint details if this proof is reposted.

Label justifications:

  • P2: This is a focused MCP catalog-initialization regression affecting resource-only and prompt-only server integrations, with limited blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides after-fix evidence from real spawned stdio MCP servers, including resource-only and prompt-only success cases plus a tools-capable negative case; redact any connection or endpoint details if this proof is reposted.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix evidence from real spawned stdio MCP servers, including resource-only and prompt-only success cases plus a tools-capable negative case; redact any connection or endpoint details if this proof is reposted.

Evidence

What I checked:

  • PR intent and supplied live proof: The PR body reports before/after runs against spawned stdio MCP servers for resource-only and prompt-only capability advertisements, plus a tools-capable negative case; it says the focused runtime suite passed after the change. (src/agents/agent-bundle-mcp-runtime.test.ts:1728, 6f98a05ad053)
  • Narrow runtime change: The supplied diff changes the existing optional-method classifier to recognize the nonstandard Unknown method wording alongside JSON-RPC -32601 and Method not found; the accompanying tests cover both accepted capability-only servers and a tools-capable negative case. (src/agents/agent-bundle-mcp-runtime.ts:183, 6f98a05ad053)
  • Canonical bug relationship: The PR body explicitly links the open report describing -32000 plus Unknown method during optional tools/list discovery, including a concrete resource-only reproduction and expected retention of non-tool capabilities.
  • Protected-review state: The PR carries the maintainer label in the supplied GitHub context. Conservative cleanup policy keeps protected-label items open for explicit maintainer handling.

Likely related people:

  • steipete: Authored the proposed focused MCP runtime and regression-test update; no local history inspection was possible to establish broader ownership. (role: recent area contributor; confidence: low; commits: 6f98a05ad053; files: src/agents/agent-bundle-mcp-runtime.ts, src/agents/agent-bundle-mcp-runtime.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Refresh the branch against current main and rerun the focused MCP runtime proof on the merged result.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete

Copy link
Copy Markdown
Contributor Author

ClawSweeper rank-up move reviewed: main has advanced, but neither src/agents/agent-bundle-mcp-runtime.ts nor its regression test changed since the PR merge base. All 83 hosted checks passed for the exact reviewed head, the real 82-test MCP suite and full changed gate already passed on Blacksmith, and scripts/pr prepare-run verified the current-head hosted proof. Skipping an unnecessary branch refresh because it would invalidate green exact-head CI without changing the merge result or exercised MCP behavior.

@steipete
steipete merged commit bb63426 into main Jul 28, 2026
128 of 138 checks passed
@steipete
steipete deleted the codex/code-mode-adversarial-stress branch July 28, 2026 12:07
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Resource-only MCP initialization fails on Unknown method tools/list response

1 participant