Skip to content

mcp: deprecate roots, sampling, and logging (SEP-2577)#1013

Open
piyushbag wants to merge 3 commits into
modelcontextprotocol:mainfrom
piyushbag:fix-995-sep-2577-deprecate
Open

mcp: deprecate roots, sampling, and logging (SEP-2577)#1013
piyushbag wants to merge 3 commits into
modelcontextprotocol:mainfrom
piyushbag:fix-995-sep-2577-deprecate

Conversation

@piyushbag

Copy link
Copy Markdown
Contributor

Summary

Implements SEP-2577 by marking user-facing roots, sampling, and logging APIs as deprecated. The deprecation is advisory: wire format and runtime behavior are unchanged.

  • Add Deprecated: comments on client/server session methods, option handlers, and logging helpers (AddRoots, CreateMessage, NewLoggingHandler, LoggingTransport, and related APIs).
  • Document deprecated capability and wire types in protocol.go without changing their behavior.
  • Route internal SDK call sites through unexported helpers so production code stays staticcheck-clean.
  • Add //lint:file-ignore SA1019 to conformance and example servers that intentionally exercise deprecated APIs for coverage.
  • Update generated README and docs with SEP-2577 notes.

Fixes #995

Test plan

  • gofmt (clean)
  • go vet ./...
  • staticcheck ./...
  • go test ./...
  • go test -race ./...

Mark user-facing roots, sampling, and logging APIs as deprecated per
SEP-2577. Wire behavior is unchanged; internal call sites use
unexported helpers to keep staticcheck clean.
Use single-line Deprecated comments and drop marginal wire-type
doc notes on ListRootsParams, RootsListChangedParams, and
SetLoggingLevelParams.
@piyushbag

Copy link
Copy Markdown
Contributor Author

@guglielmo-san Following up from your go-ahead on #995. This mirrors rust-sdk #884: advisory Deprecated: on user-facing APIs, doc notes on capability and main wire types, no behavior change. Internal call sites use unexported helpers; conformance/examples use file-level SA1019 ignore.

Local gate:

staticcheck ./...
go test ./...
go test -race ./mcp/...

CI is green on the first run (lint, test 1.25/1.26, race, client+server conformance, docs-check, CodeQL). Pushed a small follow-up to tighten deprecation wording and trim marginal wire-type doc comments.

Happy to adjust wording or scope if you prefer a smaller first pass.

Comment thread docs/client.md
Comment on lines +13 to +15
> **Note:** The roots feature is deprecated by [SEP-2577](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577).
> The SDK continues to support roots for compatibility.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it would be better to reference modelcontextprotocol.io rather than github, as in the other locations of these files.
In this case https://modelcontextprotocol.io/seps/2577-deprecate-roots-sampling-and-logging

Comment thread mcp/client.go
// It is a panic to set both CreateMessageHandler and
// CreateMessageWithToolsHandler.
//
// Deprecated: SEP-2577 deprecates this API. It may be removed in a future release of this SDK.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@cursor cursor Bot force-pushed the fix-995-sep-2577-deprecate branch 3 times, most recently from 550d880 to 3f6fe83 Compare June 19, 2026 18:01
@piyushbag piyushbag force-pushed the fix-995-sep-2577-deprecate branch 2 times, most recently from 4f90273 to 3f6fe83 Compare June 19, 2026 18:29
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

2 participants