Module: MCP::ProtocolDeprecations
- Extended by:
- ProtocolDeprecations
- Included in:
- ProtocolDeprecations
- Defined in:
- lib/mcp/protocol_deprecations.rb
Overview
Warning texts for the features SEP-2577 deprecates at 2026-07-28.
Only the client emits these, from the modern connect, where the capabilities it declares are
the ones being deprecated. No server-side trigger remains: the initialize handshake never lands on
a deprecating revision and Configuration rejects a modern pin, so nothing on that side can reach
a version these apply to. LOGGING_MESSAGE in particular has no caller left
(a modern client declares no logging capability, and notify_log_message on that wire is
the SEP-2575 sanctioned delivery path rather than a deprecated call). It stays public and
callable for embedders, and because deleting it would be a breaking change for no gain.
Constant Summary collapse
- ROOTS_MESSAGE =
"MCP Roots (`roots/list` and `notifications/roots/list_changed`) is deprecated as of protocol version " \ "2026-07-28 (SEP-2577). Use tool parameters, resource URIs, server configuration, or environment " \ "variables instead."
- SAMPLING_MESSAGE =
"MCP Sampling (`sampling/createMessage`) is deprecated as of protocol version 2026-07-28 (SEP-2577). " \ "Use direct LLM provider APIs instead."
- LOGGING_MESSAGE =
"MCP Logging (`logging/setLevel` and `notifications/message`) is deprecated as of protocol version " \ "2026-07-28 (SEP-2577). Use stderr or OpenTelemetry instead."
- MESSAGES =
{ roots: ROOTS_MESSAGE, sampling: SAMPLING_MESSAGE, logging: LOGGING_MESSAGE, }.freeze
Instance Method Summary collapse
- #deprecated_roots_sampling_logging?(protocol_version) ⇒ Boolean
- #warn_for(feature, protocol_version:, uplevel: 1) ⇒ Object
- #warn_for_client_capabilities(capabilities, protocol_version:, uplevel: 1) ⇒ Object
Instance Method Details
#deprecated_roots_sampling_logging?(protocol_version) ⇒ Boolean
35 36 37 38 39 |
# File 'lib/mcp/protocol_deprecations.rb', line 35 def deprecated_roots_sampling_logging?(protocol_version) return false unless protocol_version protocol_version >= Configuration::ROOTS_SAMPLING_LOGGING_DEPRECATED_PROTOCOL_VERSION end |
#warn_for(feature, protocol_version:, uplevel: 1) ⇒ Object
41 42 43 44 45 |
# File 'lib/mcp/protocol_deprecations.rb', line 41 def warn_for(feature, protocol_version:, uplevel: 1) return unless deprecated_roots_sampling_logging?(protocol_version) Kernel.warn(MESSAGES.fetch(feature), uplevel: uplevel) end |
#warn_for_client_capabilities(capabilities, protocol_version:, uplevel: 1) ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/mcp/protocol_deprecations.rb', line 47 def warn_for_client_capabilities(capabilities, protocol_version:, uplevel: 1) return unless deprecated_roots_sampling_logging?(protocol_version) return unless capabilities warn_for(:roots, protocol_version: protocol_version, uplevel: uplevel) if capability?(capabilities, :roots) warn_for(:sampling, protocol_version: protocol_version, uplevel: uplevel) if capability?(capabilities, :sampling) end |