Repository navigation
test: fix all test type errors and typecheck tests in CI - #143
Merged
Merged
Conversation
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>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ctufts
previously approved these changes
Oct 23, 2026
# Conflicts: # test/resources/resourceRegistry.test.ts
ctufts
approved these changes
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.
Same cleanup as mapbox/mcp-server#298. Stacked on #142 (SDK v2), so the base is
feat/mcp-sdk-v2. I'll retarget it to main once #142 merges.The tests were never typechecked (CI only builds
src), andtsc -p tsconfig.test.jsonhad 247 errors. All of them are on main too, so they're older than the v2 move.What changed
npm run typecheck(tsc oversrcandtest), run in CI before the build.tsconfig.test.jsongetsnoEmit, so a plaintscrun can't write.jsfiles next to the sources.test/utils/resultTestUtils.tswithtextOf,resourceTextOfandpromptTextOf. 238 errors were tests reading.textoff a content block without checking it was text. The helpers narrow the type and throw a clear error on the wrong content type instead of comparing againstundefined.StyleBuilderTool.test.tstyped raw input with the parsed type, which makesrender_typerequired even though the schema defaults it to'auto'. It now usesz.input<typeof StyleBuilderToolSchema>.CreateTokenTool.test.tsimportedsrc/utils/types.jswith a baresrc/path that doesn't resolve. Made it a relative type import.resourceRegistry.test.tscasts the spied context toServerContext.Checked locally
npm run typecheck: 0 errors (was 247)npm test: 650 passednpm run lint: 0 errors, same 124 warnings as beforenpm run format: clean🤖 Generated with Claude Code