Skip to content

feat(mcp): migrate to split SDK v2 - #100

Merged
ElbertePlinio merged 6 commits into
mainfrom
feat/mcp-v2-current
Sep 5, 2026
Merged

ElbertePlinio merged 6 commits into
mainfrom
feat/mcp-v2-current

Conversation

@ElbertePlinio

@ElbertePlinio ElbertePlinio commented Sep 5, 2026 •

Copy link
Copy Markdown
Member

Summary

  • migrate MCP from the monolithic v1 package to stable split SDK v2 packages
  • use the documented dual-era stdio server, preserving all required legacy revisions while opting into 2026-07-28
  • preserve all 28 tools, three prompts, resources, evidence, takeover, progress, and elicitation behavior
  • add bounded/redacted diagnostics and clean EOF, transport, SIGINT, SIGTERM, and SIGHUP shutdown
  • integrate current origin/main at fc170ea (ci: gate releases on executed candidate artifacts #99)
  • add an accurate docs/releases/UNRELEASED.md entry

Review follow-up

  • diagnostics now resume after a one-minute rate-limit window instead of staying suppressed for the process lifetime
  • legacy elicitation explicitly retains its previous 60-second response window instead of the SDK shim's 600-second default
  • raw lifecycle coverage now includes SIGHUP

Real model-driven client evidence

Exact tested and pushed head: 7689273d4b4d856ab337141739e23a0778980ea9. The client evidence below was produced at 4b48f0f; no MCP server, transport, tool, prompt, or resource source has changed since.

Each installed client used an isolated home/config/state root, isolated project directory, isolated PICKFORGE_HOME, and the final built server. Each model actually selected and invoked artifact_list; these were not server-list checks, handcrafted MCP requests, or relay replays.

Client Protocol Model-driven call
Claude Code 2.1.257 (claude-opus-5) 2025-11-25 emitted mcp__pickforge__artifact_list with {}; ok: true, 0 isolated runs
Codex CLI 0.153.2 (gpt-6-astra) 2025-06-18 emitted pickforge / artifact_list with {}; ok: true, 0 isolated runs
Pi 0.85.0 + pi-mcp-adapter 2.32.1 (openai-codex/gpt-5.4-mini) 2025-11-25 emitted Pi's mcp proxy call for pickforge / artifact_list; ok: true, 0 isolated runs

The credential-free configs allow only the harmless evidence call: Claude permissions allow only artifact_list; Codex uses enabled_tools = ["artifact_list"] plus documented per-tool approval in a read-only sandbox; Pi disables built-in tools and filters Pickforge to artifact_list.

Authentication is coupled to each client's config root, so the ephemeral roots used auth-file symlinks to the already-installed credential stores. No credential was copied, printed, recorded, or placed in the evidence tree, and the symlinks were removed immediately after the runs. Normal client configs were not loaded or modified. Metadata-only wire logs record initialize, tools/list, and tools/call artifact_list for every client.

The evidence packet is at ~/Projects/Boards/pickforge/0.4-release/mcp-v2/REPORT.md. New proof files are *-model-call.txt, *-model-wire.jsonl, and credential-free *-model-* configs.

CI attempt-1 failure: root-caused and fixed

Run 33940159039 attempt 1 failed packages/cli/test/browser-session.test.ts > built MCP browser lifecycle. It was a real defect, not a transient.

The test parsed session_create with a Zod schema, so CI printed only "expected true" and dropped the payload. The discarded error was Chrome exited during startup ... Unhandled 'error' event ... ECONNRESET.

Root cause: waitForDevToolsPort aborts its readiness probe when the budget expires, and an aborted fetch resets the loopback DevTools connection. The budget was the 100 ms poll interval, which a loaded four-core runner exceeds routinely, and the fake Chrome served /json/version from a net server with no socket error listener, so the reset killed it. The next poll then correctly reported a published port with a dead process — a failure the probe itself caused.

  • give the readiness probe a one-second budget, clamped by the time the wait has left
  • let the fake Chrome survive a client that hangs up mid-response, as a real Chrome does
  • report the MCP payload, isError, and server stderr from the built lifecycle test instead of a schema-only failure
  • new regression in packages/browser/test/devtools.test.ts that fails, naming the unhandled 'error' event, with only the fake's socket listener reverted

96 concurrent built-MCP lifecycles per condition on two cores: attempt-1 code 79/96 with every failure matching the CI signature, fake fix only 96/96, probe-budget fix only 96/96, this head 96/96. Display reservation, containment, MCP v2 transport timing, and teardown were all cleared: the failing call returned a well-formed MCP error over a healthy transport and left no Xvfb, Chrome, or X artifact behind.

Exact-head validation

bun audit reports only the known dev-only low-severity esbuild advisory tracked in #60.

Closes #94
Refs #89

ElbertePlinio added a commit that referenced this pull request Sep 5, 2026
CI run 33940159039 attempt 1 failed the built MCP browser lifecycle in
`session_create`. The test parsed the tool payload with a Zod schema, so
the report was a bare "expected true" and the server's own error string
was discarded.

Root cause: `waitForDevToolsPort` aborts its readiness probe on a
timeout, which resets the loopback connection. The fake Chrome served
`/json/version` from a `net` server with no socket `error` listener, so
the reset raised an unhandled 'error' event and killed the process. The
next poll saw a published port with a dead process and reported "Chrome
exited during startup" — a real failure caused by the probe itself. The
probe budget was the 100 ms poll interval, which a loaded four-core
runner exceeds routinely, which is why this only showed up in CI.

- give the readiness probe a one-second budget, clamped by the time the
  wait has left, so a live-but-slow endpoint is not reset on every poll
- let the fake Chrome survive a client that hangs up mid-response, as a
  real Chrome does
- report the MCP payload, `isError`, and server stderr from the built
  lifecycle test instead of a schema-only failure

Reproduced at 8/72 concurrent lifecycles under two-core contention
before the fix and 0/256 after, plus the full suite on two and four
cores. The new devtools regression fails with `exited` without the fake
fix.

Refs #100
CI run 33940159039 attempt 1 failed the built MCP browser lifecycle in
`session_create`. The test parsed the tool payload with a Zod schema, so
the report was a bare "expected true" and the server's own error string
was discarded.

Root cause: `waitForDevToolsPort` aborts its readiness probe on a
timeout, which resets the loopback connection. The fake Chrome served
`/json/version` from a `net` server with no socket `error` listener, so
the reset raised an unhandled 'error' event and killed the process. The
next poll saw a published port with a dead process and reported "Chrome
exited during startup" — a real failure caused by the probe itself. The
probe budget was the 100 ms poll interval, which a loaded four-core
runner exceeds routinely, which is why this only showed up in CI.

- give the readiness probe a one-second budget, clamped by the time the
  wait has left, so a live-but-slow endpoint is not reset on every poll
- let the fake Chrome survive a client that hangs up mid-response, as a
  real Chrome does
- report the MCP payload, `isError`, and server stderr from the built
  lifecycle test instead of a schema-only failure

Reproduced at 8/72 concurrent lifecycles under two-core contention
before the fix and 0/256 after, plus the full suite on two and four
cores. The new devtools regression fails with `exited` without the fake
fix.

Refs #100
@ElbertePlinio
ElbertePlinio merged commit ec704ce into main Sep 5, 2026
10 checks passed
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.

Rebuild the MCP SDK v2 migration from current main

1 participant