Skip to content

feat(mcp): migrate to dual-era SDK v2 for the 0.49 line - #2599

Open
kunickiaj wants to merge 1 commit into
feat/mcp-sdk-compatibilityfrom
feat/mcp-sdk-v2
Open

kunickiaj wants to merge 1 commit into
feat/mcp-sdk-compatibilityfrom
feat/mcp-sdk-v2

Conversation

@kunickiaj

@kunickiaj kunickiaj commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

Description

Migrates codemem's MCP implementation to the split SDK v2 packages for 0.49. The stdio and HTTP entrypoints support both MCP 2026-07-28 discovery and legacy initialize clients through the official SDK serving APIs.

  • Converts all fourteen tool registrations to Standard Schema inputs and the SDK's request context while preserving results, annotations, and retrieval-ledger identity.
  • Uses serveStdio with legacy support and one store across discovery probes and fallback. Shutdown closes the protocol handle before draining the store.
  • Uses createMcpHandler and the Node adapter for HTTP. OAuth router, provider, bearer middleware, and error classes stay together on the SDK's legacy auth compatibility surface. Issuer metadata does not claim support the separate OIDC callback cannot provide.
  • Documents the approved compatibility change: unknown tools return JSON-RPC error -32602. Registered-tool validation and business errors still return tool execution errors. Local callers handle protocol errors explicitly.

Protocol support does not enable safe cross-project pooling by itself. Caller-context integration remains separate.

Type of Change

  • 🚀 Feature (new functionality)
  • 🐛 Bug fix (fixes an issue)
  • 📚 Documentation (docs-only change)
  • 🔧 Maintenance (refactor, chore, CI, etc.)
  • 🧪 Testing (test-only changes)

Testing

  • Relevant checks pass locally (pnpm run tsc, pnpm run lint, pnpm run test)
  • Added/updated tests for changes
  • Manually verified changes work as expected

Node 24.22.2: build, typecheck, Biome error checks, and delta ratchet pass. The completed migration passes 348 MCP tests, packaged CLI/plugin checks, and real OpenCode 2.2.6 acceptance with pooling off. Legacy mode negotiates 2025-11-25; modern and auto select 2026-07-28. Each discovers fourteen tools and successfully calls a tool again after an execution error.

Checklist

  • Code follows project style (pnpm run lint passes for touched files)
  • Self-review completed
  • Documentation updated (if needed)
  • No new warnings introduced

Post-fork validation on current main: standard pnpm run test:ci passed 33,609 tests, then 92 tests in its required serial run. Build, typecheck, and Biome checks pass under Node 24.22.2.

Fresh post-fork OpenCode 2.2.6 acceptance passed under Node 24.22.2 using one isolated scratch database per protocol. Legacy negotiated 2025-11-25; modern and auto selected 2026-07-28. Each listed exactly fourteen tools and completed success, expected tool error, and recovery on the same connection (nine actual calls total). Pooling was disabled and no plugin was loaded.

Copy link
Copy Markdown
Owner Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T20:24:13.436713Z 9dc97b0 PR opened
ℹ️ 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.

This branch has not been deployed

No deployments
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.

1 participant