Skip to content

refactor: migrate MCP servers and peripheral clients to v2 - #175366

Merged
steipete merged 3 commits into
mainfrom
refactor/mcp-v2-servers
Oct 17, 2026
Merged

steipete merged 3 commits into
mainfrom
refactor/mcp-v2-servers

Conversation

@steipete

@steipete steipete commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Moves the standalone MCP servers and browser/QA clients onto the maintained v2 SDK as the next step in removing the v1 runtime dependency.

User Impact

No intended user-visible behavior change. Serving and client negotiation remain legacy, Claude configuration is unchanged, and no public plugin SDK API is added.

Why This Change Was Made

Migrate channel, tool, supervision, and skill servers together with their cancellation and cleanup behavior. Migrate browser/QA clients with their transports and typed errors. These callers explicitly retain v1's single-page tool listing and use those tool definitions for output validation instead of adopting v2's automatic pagination. Each plugin owns its v1 interoperability fixture and declares the SDK as a test-only dependency. The registration fixture retains its v1 client while targeting its shutdown fault injection at the new server transport.

Release-note context: internal MCP SDK migration preserving existing behavior.

Evidence

  • Final-head CI: https://github.com/openclaw/openclaw/actions/runs/39022076107 — passed, including the aggregate gate, browser/QA suites, registration fault injection, extension lint/declaration preparation, and builds.
  • Exact-source Windows replay: https://github.com/openclaw/openclaw/actions/runs/39022135415 — 14 passed, including all seven stdio lifecycle cases, and two existing POSIX-only skips. The uploaded identity binds source a137c0f7610a11f316b82dc96a4d99bbeea96ad4, unchanged dependencies, Node 24.21.0, and the ordered test files. Test time: 97.29 seconds; runner command: 100.86 seconds. Actions teardown owns its retained generic test namespace.
  • macOS real stdio lifecycle: 7/7 passed on Node and 7/7 on pinned Bun, including v1/v2 clients, EOF, SIGINT/SIGTERM, in-flight cancellation/drain, and a real Worker. The corrected process-tree assertion passed all seven Node cases again.
  • Linux arm64: 16/16 passed on Node and 16/16 on pinned Bun, including the stdio matrix and HTTP authority, result handling, pending-call teardown, and cleanup.
  • Local browser: 9/9 targeted Node tests passed. Real v1-peer pagination, output-validation and descendant-cleanup tests passed 3/3 on Node and pinned Bun; QA's v1-peer tests passed 3/3 on both runtimes.
  • Targeted core, extension, and test typechecks and formatting passed. Full local build passed in 18m 40s, including 155 public SDK export checks. Final-head runtime build passed in 10m 18s. Independent final-diff review is clean through P2.

Real Claude turn and cleanup limitation

After the one-minute load fell below 30, real Claude Code 2.1.277 completed both baseline and candidate Node turns through isolated Gateways and a synthetic provider. Each turn advertised and called the configured standalone plugin MCP server, negotiated legacy 2025-11-25, returned the independently generated tool nonce, and completed the Gateway response. No modern discovery occurred. Baseline elapsed 85.40 seconds; candidate 60.28 seconds. The readiness deadline remained 180 seconds.

Both overall harness runs failed their final process census: one detached macOS directory-watch helper was still observable immediately after the Gateway exited. That helper's owner is byte-identical in baseline, candidate, and current main, outside this migration. Each reported PID was force-cleaned and verified absent. This is an inherited cleanup gap, not a claim of clean end-to-end teardown. The dedicated MCP and browser process-cleanup proofs passed. Bun full Gateway turns were not run after host load rose above the start threshold again.

An earlier baseline fixture attempt could not load a workspace alias because the external source snapshot lacked its ESM package declaration; that setup was corrected before the successful tool round-trip above. Earlier local browser/QA, registration, and extension-lint preparation attempts hit unchanged time limits on the loaded host and are not counted as passing proof. The local Windows lease did not finish source transfer and was fully released.

Earlier PR revisions exposed obsolete browser call-shape expectations, baseline shrinkage, an incomplete shutdown schema mock, and Windows fixture-launch assumptions. These were repaired without changing assertions or budgets; final-head CI and Windows replay are green.

New real-process tests deliberately cover boundaries that mocks cannot prove. Loaded-host local times were 105–158 seconds for the seven-case lifecycle matrix and 26–36 seconds for three-case peripheral peer files. Final CI summed case times were 5.48 seconds for lifecycle, 5.60 seconds for registration, 0.78 seconds for browser peer, and 0.32 seconds for QA peer.

@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T09:18:05.563240Z cde6860 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Dependency graph changes

This maintainer PR changes the dependency graph.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: a137c0f7610a11f316b82dc96a4d99bbeea96ad4
  • Maintainer: @steipete
  • Repository role: admin

These dependency graph changes were made:

  • pnpm-lock.yaml
  • extensions/browser/package.json
  • extensions/qa-lab/package.json

Carefully review these changes before merging.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b91da432c9

ℹ️ 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".

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 17, 2026
@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR migrates standalone MCP servers and browser/QA clients to the split v2 SDK while preserving legacy protocol behavior.

Example: A browser MCP server returns list_pages on its first catalog page and a nextCursor.

  • Before: The v1 client reads one page and validates tool results against that catalog.
  • After: The v2 client explicitly reads one page and supplies the selected tool definition for result validation.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful migration with meaningful transport integration coverage, but the introduced stale baseline blocks CI and shipped CLI proof is incomplete.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored migration is outside the ordinary contributor proof gate; reported stdio and HTTP integration runs exercise the changed owners, while full Claude CLI proof remains pending.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Maintenance · Worth it: Yes · Fix scope: Complete
User problem: Standalone MCP adapters still depend on the older SDK despite the approved v2 dependency foundation.
Reason: The maintainer-authored migration follows the approved dependency sequence without adding configuration, public plugin APIs, or intended behavior changes.

Merge readiness

⛔ Needs changes before merge - 1 item remains

This PR is useful maintainer-approved maintenance, and both prior findings are fixed, but removing a shutdown-test mock leaves a stale baseline entry that blocks CI.

Priority: P3
Reviewed head: cde68606ffce5419b15145e997c6a17936455c8c

Before merge

  • Prune the baseline entry for the deleted shutdown mock (P2) - The latest commit removes vi.mock("./channel-shared.js") from the shutdown test but leaves this exact factory tuple in the ledger. scripts/check-test-mock-exports.mts rejects removed factories at lines 217–222, so the branch cannot pass the mock-export ratchet; the exact-head baseline job already reports mock-exports failed. Remove this obsolete tuple through the baseline prune path while retaining the real schema import.

Findings

  • [P2] Prune the baseline entry for the deleted shutdown mock — config/test-mock-exports-baseline.txt:7948

Tests

  • Missing end-to-end proof: A completed Claude CLI turn through the migrated adapters remains explicitly pending; the supplied evidence covers transport and production-owner integration scenarios.
Agent review details

How this fits together

MCP adapters connect external clients, browser subprocesses, and QA probes to OpenClaw tools and Gateway-backed conversations, returning protocol results while preserving cancellation and resource cleanup.

flowchart LR
  A[MCP clients] --> B[Standalone MCP servers]
  B --> C[Tool and channel owners]
  C --> D[Gateway and plugin resources]
  E[Browser and QA clients] --> F[MCP subprocesses]
Loading

Technical review

Best possible solution:

Keep the coordinated migration and prune the obsolete mock-baseline tuple without restoring the incomplete mock or expanding allowances.

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

The stale tuple and checker's removed-entry failure branch establish the CI defect directly, supported by the exact-head mock-exports failure; no target code or tests were executed.

Is this the best way to solve the issue?

The coordinated SDK migration preserves existing owners and legacy behavior; removing the deleted mock's ledger entry is the smallest complete repair.

Full review comments:

  • [P2] Prune the baseline entry for the deleted shutdown mock — config/test-mock-exports-baseline.txt:7948
    The latest commit removes vi.mock("./channel-shared.js") from the shutdown test but leaves this exact factory tuple in the ledger. scripts/check-test-mock-exports.mts rejects removed factories at lines 217–222, so the branch cannot pass the mock-export ratchet; the exact-head baseline job already reports mock-exports failed. Remove this obsolete tuple through the baseline prune path while retaining the real schema import.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against b46ec6167975.

Provenance checked

  • Shared MCP server ownership and cancellation keeps the original intent (61ab68f: Consolidate tool stdio serving; subsequent cancellation and lifecycle repairs preserve signals and keep resources alive until accepted work finishes.)
  • Browser MCP lifecycle and routing keeps the original intent (1f051da: Split the existing-session adapter behind its facade while preserving cleanup ordering, session replacement, target invalidation, and action behavior.)
  • Plugin tool image serialization keeps the original intent (a846b87: Normalize screenshot-style image blocks to the pinned MCP schema; the migration retains top-level data and mimeType normalization.)
  • Node Claude skill proxy keeps the original intent (75bcd26: Deliver session-scoped skill resources and Workshop calls while retaining host-owned authority and cleanup.)
  • QA MCP client keeps the original intent (4db162d: Provide plugin-tool probes through the QA runtime; later changes retain bounded stderr diagnostics and repository-root execution.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • pnpm check:test-mock-exports --base e476f87 --no-merge-base
  • git diff --check

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit c5c3748 adds src/mcp/tools-stdio-server.ts:24 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c5c3748d8bd1; files: src/mcp/tools-stdio-server.ts)
  • Vincent Koc: Raw commit 9085d17 adds extensions/qa-lab/src/suite-runtime-agent-tools.ts:7 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 9085d17ab6ad; files: extensions/qa-lab/src/suite-runtime-agent-tools.ts)
  • Josh Avant: Raw commit b7d61c8 adds src/mcp/plugin-tools-handlers.cancel.test.ts:7 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: b7d61c8daffc; files: src/mcp/plugin-tools-handlers.cancel.test.ts)

PR surface

Source +396, Tests +289, Config +2, Other +5. Total +692 across 38 files. Added test files: 3.

View PR surface stats
Area Files Added Removed Net
Source 18 511 115 +396
Tests 16 353 64 +289
Docs 0 0 0 0
Config 2 4 2 +2
Generated 0 0 0 0
Other 2 13 8 +5
Total 38 881 189 +692

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is approved internal dependency maintenance with no intended user-visible change or established production outage.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-17T09:12:35.268Z sha b91da43 :: needs changes before merge. :: [P2] Update both browser assertions to the v2 call signature | [P2] Give extension peer tests a declared fixture dependency

Reviewed October 17, 2026, 5:22 AM ET / 09:22 UTC (Revision 2).

@steipete

Copy link
Copy Markdown
Contributor Author

The interoperability peers now live inside their owning plugins, with v1 declared only as a development dependency. Their pagination, output-validation, and cleanup tests pass on Node and Bun. The Windows lifecycle wrapper now uses native Job ownership and explicitly checks the termination receipt; all seven updated cases pass locally, with Windows confirmation running against the current head. The stale call-shape assertions and baseline ratchet failures are also corrected.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The final source head is a137c0f. Final CI and the exact-source Windows replay passed. The body now includes the real Claude baseline/candidate tool-turn evidence and the inherited macOS helper-cleanup limitation.

@clawsweeper

clawsweeper Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete merged commit 19e7d46 into main Oct 17, 2026
171 of 172 checks passed
@steipete
steipete deleted the refactor/mcp-v2-servers branch October 17, 2026 10:05
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 18, 2026
…175366)

* refactor: migrate MCP servers and peripheral clients to v2

* test: harden MCP migration interoperability coverage

* test: fix MCP fixture loading on Windows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies-changed PR changes dependency-related files extensions: browser extensions: qa-lab P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant