feat: migrate pi-mcp-adapter to MCP SDK v2 beta.5 - #210
Merged
Conversation
mattzcarey
marked this pull request as ready for review
July 24, 2026 11:08
mattzcarey
force-pushed
the
feat/mcp-sdk-v2
branch
2 times, most recently
from
July 24, 2026 14:26
ee811cb to
2790f5d
Compare
Replace the MCP SDK v1 client surface with the exact-pinned v2 beta.5 client and server packages, preserving disabled-server behavior and OAuth recovery while adding conformance coverage and automatic protocol negotiation. Co-authored-by: Matt Carey <mcarey@cloudflare.com>
nicobailon
force-pushed
the
feat/mcp-sdk-v2
branch
from
July 24, 2026 17:04
6302e3a to
f7c677a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates pi-mcp-adapter's MCP client from the v1
@modelcontextprotocol/sdkAPI to exact-pinned@modelcontextprotocol/client@2.0.0-beta.5. Test fixtures and the interactive visualizer use@modelcontextprotocol/server@2.0.0-beta.5.The branch is rebased onto current
main, including the isolated programmatic config and per-adapter OAuth runtime work from #86.Changes
/stdioand/validators/ajvexports.callToolsignature.ProtocolErrorandSdkHttpErrorwhile preserving narrow stale-session recovery.@modelcontextprotocol/noderuntime dependency and exact-pins the beta packages.input_requiredfulfillment, while retaining byte-clean fallback to 2025-era servers.OAuth
issfrom both the localhost callback and pasted redirect URLs.iss, so the user can paste the full redirect URL without restarting.createMcpAdapter()OAuth runtime; callback discovery is cleared after token issuance so later PRM changes are rediscovered.invalid_clientrefresh that clears valid credentials.expires_in: 0as expired rather than converting it to a token with no expiry.Conformance and CI
Adds an official MCP client conformance harness that drives the adapter's real
McpServerManager, OAuth provider, auth flow, and localhost callback server.npm run test:conformanceruns all 26 scenarios from@modelcontextprotocol/conformance@0.1.16sequentially to avoid false callback-port contention:auth/basic-cimd,auth/scope-step-up,auth/2025-03-26-oauth-metadata-backcompat,auth/client-credentials-jwt, andauth/cross-app-access-complete-flow.A new GitHub Actions workflow runs the same type, unit, OAuth, conformance, example-build, and package checks used locally.
Verification
npm cinpx tsc --noEmitnpm test: 70 files, 669 tests passing (including probe/live negotiation regressions)npm run test:oauth: 107 tests passingnpm run test:conformance: 26 scenarios passing or matching the reviewed baselinenpm run --prefix examples/interactive-visualizer buildnpm pack --dry-run: 50 runtime filesLive checker smoke test
Against
https://mcp-checker.val.run/:/mcpand/auto/mcpnegotiate 2026-07-28./2026-07-28/mcpconnects as modern-only./2025-11-25/mcpfalls back to the legacy era.checker://aboutresource, andtest-planprompt.