Repository navigation
feat!: move to MCP TypeScript SDK v2 - #296
Merged
Merged
Conversation
Swaps @modelcontextprotocol/sdk 1.x for the v2 packages
(@modelcontextprotocol/server and /core, plus /client and /node for tests
and scripts). Ran the official v1-to-v2 codemod, then:
- Replace the SDK output-validation patch with lenientOutputSchema, a
Standard Schema wrapper that keeps the real schema in tools/list but only
warns on a mismatch. Tools that return text only get structuredContent {}.
- Make publishJsonSchema2020 a deprecated no-op, since v2 publishes JSON
Schema 2020-12 natively. Kept for hosted's adapter.
- Remove OptimizationV2Tool, which was never registered and used the
experimental tasks API that v2 drops.
- Move test request contexts to the v2 shape (http.authInfo) so the token
checks actually run.
- Replace the patch tests, which never went through the SDK, with tests
that make a real tools/call.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 21, 2026
ctufts
previously approved these changes
Oct 23, 2026
# Conflicts: # src/utils/versionUtils-cjs.cjs # src/utils/versionUtils-cjs.d.cts
ctufts
approved these changes
Oct 23, 2026
mattpodwysocki
added a commit
to mapbox/mcp-devkit-server
that referenced
this pull request
Oct 26, 2026
* feat!: move to MCP TypeScript SDK v2 Swaps @modelcontextprotocol/sdk 1.x for the v2 packages (@modelcontextprotocol/server and /core, plus /client for tests) and ext-apps 2.0.3, same as mapbox/mcp-server#296. Ran the official v1-to-v2 codemod, then: - Replace the SDK output-validation patch with lenientOutputSchema, a Standard Schema wrapper that keeps the real schema in tools/list but only warns on a mismatch. Tools that return text only get structuredContent {}. - Register prompt argument schemas as z.object(), since v2 deprecates raw shapes. - Move test request contexts to the v2 shape (http.authInfo) so the token checks actually run. - Add tests that make a real tools/call through McpServer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: add PR number to CHANGELOG Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
mattpodwysocki
added a commit
to mapbox/mcp-docs-server
that referenced
this pull request
Oct 26, 2026
* feat!: move to MCP TypeScript SDK v2 Swaps @modelcontextprotocol/sdk 1.x for @modelcontextprotocol/server 2.3.1 (and @modelcontextprotocol/client as a dev dependency for the scripts and tests), same as mapbox/mcp-server#296. The v1-to-v2 codemod did the imports and context types. No tool has an output schema, so v2's strict output validation doesn't apply. Adds a test that installs every tool and resource on a real v2 McpServer, since the tool tests call run() directly and never touch the SDK. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: add PR number to CHANGELOG Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: typecheck tests in CI Adds npm run typecheck (tsc over src and test) as a CI step, fixes the one error it found, and sets noEmit in tsconfig.test.json so tsc can't write .js files next to the sources. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: bump MCP TypeScript SDK to 2.4.0 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
mattpodwysocki
added a commit
that referenced
this pull request
Oct 26, 2026
* feat!: move to MCP TypeScript SDK v2 (#245) Swaps @modelcontextprotocol/sdk 1.x for the v2 packages (@modelcontextprotocol/server and /core, plus /client and /node for tests and scripts). Ran the official v1-to-v2 codemod, then: - Replace the SDK output-validation patch with lenientOutputSchema, a Standard Schema wrapper that keeps the real schema in tools/list but only warns on a mismatch. Tools that return text only get structuredContent {}. - Make publishJsonSchema2020 a deprecated no-op, since v2 publishes JSON Schema 2020-12 natively. Kept for hosted's adapter. - Remove OptimizationV2Tool, which was never registered and used the experimental tasks API that v2 drops. - Move test request contexts to the v2 shape (http.authInfo) so the token checks actually run. - Replace the patch tests, which never went through the SDK, with tests that make a real tools/call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: add PR number to CHANGELOG Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: fix all test type errors and typecheck tests in CI Follow-up to #296. Adds structuredOf/textOf/resourceTextOf test helpers, fixes the ~450 errors tsconfig.test.json reported (about 200 already on main, the rest from SDK v2's open structuredContent type), adds noEmit to tsconfig.test.json and runs `npm run typecheck` in CI. Fixes tests the errors exposed: the zod 4 tuple traversal that never looked inside arrays, a structured-content test importing a nonexistent file, a stale directions input shape, and a SimplifyTool comparison that couldn't fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: add PR number to CHANGELOG Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 26, 2026
mattpodwysocki
added a commit
to mapbox/mcp-devkit-server
that referenced
this pull request
Oct 26, 2026
* feat!: move to MCP TypeScript SDK v2 Swaps @modelcontextprotocol/sdk 1.x for the v2 packages (@modelcontextprotocol/server and /core, plus /client for tests) and ext-apps 2.0.3, same as mapbox/mcp-server#296. Ran the official v1-to-v2 codemod, then: - Replace the SDK output-validation patch with lenientOutputSchema, a Standard Schema wrapper that keeps the real schema in tools/list but only warns on a mismatch. Tools that return text only get structuredContent {}. - Register prompt argument schemas as z.object(), since v2 deprecates raw shapes. - Move test request contexts to the v2 shape (http.authInfo) so the token checks actually run. - Add tests that make a real tools/call through McpServer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: add PR number to CHANGELOG Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: fix all test type errors and typecheck tests in CI Adds npm run typecheck (tsc over src and test) as a CI step. Fixes the 247 errors it found: content/resource/prompt text reads go through helpers that narrow the block type, StyleBuilderTool tests use the schema's input type, and a bare src/ import is made relative. Sets noEmit in tsconfig.test.json. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: add PR number to CHANGELOG Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 26, 2026
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.
Part of #245.
Moves us from
@modelcontextprotocol/sdk1.x to the v2 SDK packages (@modelcontextprotocol/serverand/core2.3.1) and ext-apps 2.0.3. v2 is where new MCP features land, including the SDK's Skills extension support (typescript-sdk#2818), which #295 wants to switch to once it merges.What changed
Most of this is the official codemod (
npx @modelcontextprotocol/codemod v1-to-v2 .): import paths, method-stringsetRequestHandler,RequestHandlerExtratoServerContext,extra.authInfotoctx.http?.authInfo. On top of that:structuredContentdoesn't match the output schema or is missing, which is what we patched v1 to stop. v2 takes any Standard Schema, solenientOutputSchemawraps each tool's Zod schema:tools/liststill publishes the real schema, validation only warns. Text-only results from a tool with an output schema getstructuredContent: {}.patches/is now empty.publishJsonSchema2020is a deprecated no-op. v2 publishes 2020-12 itself. Kept because hosted's adapter calls it.OptimizationV2Toolremoved. Never registered, and built on the experimental tasks API that v2 drops.{ authInfo }shape, so the token never reached the code under test. That includes the checks that a secretsk.token never gets embedded in the map page. They now use{ http: { authInfo } }, so those checks actually run.tool.run()directly and never touched the SDK. The new ones make a realtools/callthroughMcpServerand fail without the wrapper.@modelcontextprotocol/clientand/nodeare dev deps only (tests, evals harness, dev HTTP server).Clients
Nothing changes for clients. It still negotiates 2025-11-25, and the MCP Apps wire protocol is the same in ext-apps 2.x, so
render_map_toolrenders as before. Adopting the 2026-07-28 protocol revision is separate work under #245.Heads up
installTo(server)needs a v2McpServer, so hosted-mcp-server needs its own v2 PR (adapter plus the auth context shape) before it picks up this version.structuredContentloosely. Nothing fails because of them; happy to clean up in a follow-up.Testing
npm test: 96 files, 1080 tests passingnpm run lint: 0 errorsnpm run build: ESM and CJS both build; the CJS dist installs all 32 tools on a v2McpServertext/html;profile=mcp-app), logging and abbox_toolcall🤖 Generated with Claude Code