Skip to content

fix(server): keep a handler-thrown -32002 on 2025-11-25 sessions - #3272

Open
Viv786ek wants to merge 1 commit into
modelcontextprotocol:mainfrom
Viv786ek:fix/preserve-32002-on-2025-era
Open

Viv786ek wants to merge 1 commit into
modelcontextprotocol:mainfrom
Viv786ek:fix/preserve-32002-on-2025-era

Conversation

@Viv786ek

@Viv786ek Viv786ek commented Dec 3, 2026

Copy link
Copy Markdown

Both era codecs mapped -32002 to -32602, so a resources/read handler that throws -32002 answered -32602 on a 2025-11-25 session. That revision's spec lists -32002 for resource not found, and v1.x passed a handler-thrown code through unchanged; only McpServer's own miss used -32602.

Make rev2025Codec.encodeErrorCode the identity. The 2026-07-28 codec keeps the -32002 -> -32602 mapping (SEP-2164). McpServer and ResourceNotFoundError already send -32602 and are unchanged.

Fixes #3266

Motivation and Context

How Has This Been Tested?

  • Automated unit / integration tests
  • Tested manually
  • Tested in a real application

Breaking Changes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Test update (non-breaking change which adds or updates tests)
  • Refactoring (non-breaking change which makes things better)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • CI/build script update (update CI workflow or build scripts)

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • I have added automated tests for my change
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

@Viv786ek
Viv786ek requested a review from a team as a code owner December 3, 2026 02:40
@changeset-bot

changeset-bot Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7c00617

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@modelcontextprotocol/server Patch
@modelcontextprotocol/client Patch
@modelcontextprotocol/codemod Patch
@modelcontextprotocol/core Patch
@modelcontextprotocol/server-legacy Patch
@modelcontextprotocol/core-internal Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/@modelcontextprotocol/client@3272

@modelcontextprotocol/codemod

npm i https://pkg.pr.new/@modelcontextprotocol/codemod@3272

@modelcontextprotocol/core

npm i https://pkg.pr.new/@modelcontextprotocol/core@3272

@modelcontextprotocol/server

npm i https://pkg.pr.new/@modelcontextprotocol/server@3272

@modelcontextprotocol/server-legacy

npm i https://pkg.pr.new/@modelcontextprotocol/server-legacy@3272

@modelcontextprotocol/express

npm i https://pkg.pr.new/@modelcontextprotocol/express@3272

@modelcontextprotocol/fastify

npm i https://pkg.pr.new/@modelcontextprotocol/fastify@3272

@modelcontextprotocol/hono

npm i https://pkg.pr.new/@modelcontextprotocol/hono@3272

@modelcontextprotocol/node

npm i https://pkg.pr.new/@modelcontextprotocol/node@3272

commit: 7c00617

Both era codecs mapped -32002 to -32602, so a resources/read handler that
throws -32002 answered -32602 on a 2025-11-25 session. That revision's
spec lists -32002 for resource not found, and v1.x passed a handler-thrown
code through unchanged; only McpServer's own miss used -32602.

Make rev2025Codec.encodeErrorCode the identity. The 2026-07-28 codec keeps
the -32002 -> -32602 mapping (SEP-2164). McpServer and ResourceNotFoundError
already send -32602 and are unchanged.

Fixes modelcontextprotocol#3266
@Viv786ek
Viv786ek force-pushed the fix/preserve-32002-on-2025-era branch from 8e08c8a to 7c00617 Compare December 3, 2026 02:48
@claude claude Bot added the v2 Ideas, requests and plans for v2 of the SDK which will incorporate major changes and fixes label Dec 3, 2026

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

v2 Ideas, requests and plans for v2 of the SDK which will incorporate major changes and fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A handler's -32002 (resource not found) is rewritten to -32602 on 2025-era sessions

1 participant