Skip to content

feat: deprecate roots, sampling, and logging runtime APIs (SEP-2577)#2268

Open
mattzcarey wants to merge 2 commits into
mainfrom
feat/sep-2577-deprecate-roots-sampling-logging
Open

feat: deprecate roots, sampling, and logging runtime APIs (SEP-2577)#2268
mattzcarey wants to merge 2 commits into
mainfrom
feat/sep-2577-deprecate-roots-sampling-logging

Conversation

@mattzcarey

Copy link
Copy Markdown
Contributor

Summary

Implements the runtime-API portion of SEP-2577 (Deprecate Roots, Sampling, and Logging). Per the draft spec (docs/specification/draft/deprecated.mdx registry, plus the banners on client/roots.mdx, client/sampling.mdx, and server/utilities/logging.mdx), roots, sampling, and logging are deprecated as of protocol revision 2026-07-28, remain fully functional for at least twelve months, and are eligible for removal no earlier than the first revision on/after 2027-07-28.

The reference spec types in spec.types.2026-07-28.ts (plus LOG_LEVEL_META_KEY and the _meta log-level schema annotation) were already annotated in #2252. This PR completes the picture by annotating the runtime public API with matching @deprecated JSDoc, and adding deprecation callouts to the guides.

What's annotated

@modelcontextprotocol/server

  • Server.createMessage() (all three overloads)
  • Server.listRoots()
  • Server.sendLoggingMessage() and the internal logging/setLevel handler registration
  • McpServer.sendLoggingMessage()
  • buildContext's ctx.mcpReq.log / ctx.mcpReq.requestSampling wiring (comment)

@modelcontextprotocol/client

  • Client.setLoggingLevel()
  • Client.sendRootsListChanged()
  • Class-level note covering the roots/list and sampling/createMessage handler surfaces, plus comments on the corresponding capability assertions

@modelcontextprotocol/core

  • ServerContext.mcpReq.log / requestSampling helper types (shared/protocol.ts)
  • ClientCapabilitiesSchema.roots / .sampling and ServerCapabilitiesSchema.logging field JSDoc (types/schemas.ts), surfaced on the inferred ClientCapabilities / ServerCapabilities types (types/types.ts)

Docs: deprecation callouts on the Logging, Sampling, and Roots sections of docs/server.md and docs/client.md, each with the spec's migration guidance (roots → tool parameters / resource URIs / configuration; sampling → direct LLM provider APIs; logging → stderr / OpenTelemetry).

Wording matches the #2252 annotations (Deprecated as of protocol version 2026-07-28 (SEP-2577), twelve-month window, deprecated features registry).

No behavior change

JSDoc and docs only. No removals, no runtime changes — all three features keep working exactly as before for the full deprecation window.

Validation

  • pnpm build:all
  • pnpm typecheck:all
  • pnpm lint:all (incl. sync:snippets --check) ✅
  • Tests: core 463/463, server 72/72, client 367/367, integration 320/320 ✅
  • Changeset: patch for core/server/client

Downstream impact

  • cloudflare/agents does not call createMessage, listRoots, or setLoggingLevel, so no migration is needed there.
  • Downstream projects with deprecation lint rules (e.g. @typescript-eslint deprecation plugins) will see new warnings on these surfaces — this is the expected outcome of the SEP and signals where migration is needed.

Closes #2195

Adds @deprecated JSDoc annotations to the runtime public API surface for
roots, sampling, and logging, deprecated as of protocol version 2026-07-28
per SEP-2577. Reference spec types were already annotated in #2252; this
covers the Server/Client/McpServer methods, ServerContext helpers, runtime
capability schema fields, and the server/client guides.

No behavior changes.
@mattzcarey mattzcarey requested a review from a team as a code owner June 9, 2026 20:36
@changeset-bot

changeset-bot Bot commented Jun 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 59741a8

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

This PR includes changesets to release 3 packages
Name Type
@modelcontextprotocol/core Patch
@modelcontextprotocol/server Patch
@modelcontextprotocol/client 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 Jun 9, 2026

Copy link
Copy Markdown

Open in StackBlitz

@modelcontextprotocol/client

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

@modelcontextprotocol/codemod

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/codemod@2268

@modelcontextprotocol/server

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

@modelcontextprotocol/server-legacy

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

@modelcontextprotocol/express

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

@modelcontextprotocol/fastify

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/fastify@2268

@modelcontextprotocol/hono

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

@modelcontextprotocol/node

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

commit: 59741a8

typedoc treats the resolved-but-undocumented {@linkcode *CapabilitiesSchema}
links as warnings, failing docs:check in CI.
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.

Implement SEP-2577: Deprecate Roots, Sampling, and Logging

1 participant