Skip to content

Conversation

@KKonstantinov
Copy link
Contributor

@KKonstantinov KKonstantinov commented Jan 22, 2026

Clean deprecated method signature and some exports previously used for backwards compatibility

Motivation and Context

  • This is a v2 cleanup that removes deprecated, backwards-compat registration APIs on McpServer (.tool, .prompt, .resource) and migrates usage to the explicit registerTool, registerPrompt, and registerResource APIs.
  • Simplifies the public API surface and avoids ambiguous overloads (particularly around tool schema vs annotations), while keeping the supported registration style consistent across tools/resources/prompts.
  • Removes deprecated @modelcontextprotocol/core exports/types that were retained as aliases during spec/API transitions.

How Has This Been Tested?

  • Updated unit and integration tests to use the new registration APIs.
  • Suggested local verification:
    • pnpm test:all
    • pnpm check:all

Breaking Changes

  • Removed deprecated McpServer.tool(), McpServer.prompt(), and McpServer.resource() methods. Use registerTool, registerPrompt, and registerResource instead.
  • Registration signatures are now options-object based:
    • Tools: registerTool(name, { description?, inputSchema?, outputSchema?, annotations?, execution? }, handler) (use {} when no options are needed).
    • Prompts: registerPrompt(name, { description?, argsSchema? }, handler) (use {} when no options are needed).
    • Resources: registerResource(name, uriOrTemplate, metadata, handler) (use {} when no metadata is needed).
  • Removed deprecated @modelcontextprotocol/core exports/types (update imports to the non-deprecated names):
    • isJSONRPCResponse (use isJSONRPCResultResponse / isJSONRPCResponseSchema as appropriate)
    • JSONRPCErrorSchema (use JSONRPCErrorResponseSchema)
    • isJSONRPCError (use isJSONRPCErrorResponse)
    • ResourceReferenceSchema / ResourceReference (use ResourceTemplateReferenceSchema / ResourceTemplateReference)
    • JSONRPCError (use JSONRPCErrorResponse)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

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

Additional context

  • Includes changesets to bump @modelcontextprotocol/{core,server,node,test-integration} after removal of deprecated APIs.
  • Migrates examples and tests to the register* APIs (e.g. examples/server/src/ssePollingExample.ts, server/node middleware tests, and integration tests).

@KKonstantinov KKonstantinov requested a review from a team as a code owner January 22, 2026 06:54
@changeset-bot
Copy link

changeset-bot bot commented Jan 22, 2026

🦋 Changeset detected

Latest commit: 43f9738

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

This PR includes changesets to release 6 packages
Name Type
@modelcontextprotocol/node Patch
@modelcontextprotocol/test-integration Patch
@modelcontextprotocol/server Patch
@modelcontextprotocol/core Patch
@modelcontextprotocol/express Patch
@modelcontextprotocol/hono 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
Copy link

pkg-pr-new bot commented Jan 22, 2026

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/client@1419

@modelcontextprotocol/server

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/server@1419

@modelcontextprotocol/express

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/express@1419

@modelcontextprotocol/hono

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/hono@1419

@modelcontextprotocol/node

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/node@1419

commit: 43f9738

@KKonstantinov KKonstantinov marked this pull request as draft January 22, 2026 07:06
@KKonstantinov KKonstantinov marked this pull request as ready for review January 22, 2026 15:57
Copy link
Contributor

@felixweinberger felixweinberger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for doing this, .tool() really needs to go :D

@felixweinberger felixweinberger merged commit dcf708d into modelcontextprotocol:main Jan 23, 2026
10 checks passed
@github-actions github-actions bot mentioned this pull request Jan 23, 2026
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.

2 participants