Skip to content

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

@alexhancock

Description

@alexhancock

SEP-2577: Deprecate Roots, Sampling, and Logging — rust-sdk implementation

Spec PR: modelcontextprotocol/modelcontextprotocol#2577
Track: Specification · Stage: final · Priority: P1
Needs code changes: Yes (Small) — advisory only, no wire change

Summary

Deprecates three core protocol features — Roots, Sampling, and Logging. Features remain
fully functional in all spec versions released within one year of the deprecating version. There
are no wire-level protocol changes; the deprecation is advisory, signaling the ecosystem to plan
for eventual removal.

Why this needs code changes in rust-sdk

No wire change, but to align with the spec the SDK should mark the corresponding Rust APIs as
deprecated so downstream users get compiler warnings and migration guidance. Concrete targets:

  • Sampling: ServerPeer::create_message(..) (service/server.rs:415); sampling capability bits in model/capabilities.rs (SamplingCapability, enable_sampling* builders) and SamplingTaskCapability.
  • Roots: method!(peer_req list_roots ListRootsRequest() => ListRootsResult) (service/server.rs:444); RootsCapabilities + enable_roots* builders in model/capabilities.rs; ListRootsResult/roots request types in model.rs.
  • Logging: client method!(peer_req set_level SetLevelRequest(..)) (service/client.rs:357); server method!(peer_not notify_logging_message LoggingMessageNotification(..)) (service/server.rs:454); enable_logging builder; LoggingMessageNotification / SetLevelRequest types.

Caveat: several of these are generated by the internal method! macro and the capability builders
are macro-generated too, so #[deprecated] may need to be applied at the macro-invocation site (or
the macro taught to forward a #[deprecated] attribute) rather than on a hand-written fn.

Proposed work

  • Add #[deprecated(since = "0.x.0", note = "Deprecated by SEP-2577; see <url>")] to the sampling/roots/logging public surface — including the method!-generated list_roots / set_level / notify_logging_message and create_message.
  • Apply matching deprecation to the capability builders (enable_roots*, enable_sampling*, enable_logging) and capability structs in model/capabilities.rs.
  • Add doc comments pointing to the SEP and recommended alternatives.
  • Keep all functionality intact (must remain working for ≥1 year of spec versions per SEP-2596).
  • Add #[allow(deprecated)] at the crate's own internal call sites (the SDK's own handlers/tests use these) so the build stays warning-clean.
  • Update README/feature docs to note deprecation status.

Affected areas

crates/rmcp/src/service/server.rs (create_message, list_roots, notify_logging_message),
crates/rmcp/src/service/client.rs (set_level), model/capabilities.rs (capability structs + builders),
model.rs (roots/logging request/result types), and possibly the method! macro definition.

Notes / risks

  • Purely additive deprecation annotations; no behavioral/wire change. Coordinate wording with SEP-2596 (feature lifecycle policy) once that lands.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium: important but non-blocking improvementT-enhancementNew features and enhancementsT-modelModel/data structure changesT-serviceService layer changes

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions