ruby-sdk/lib/mcp
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Koichi ITO b89f6e315d Remove Server#notify_progress broadcast API
## Motivation and Context

`Server#notify_progress` broadcasts progress notifications to all connected clients.
Progress notifications are tied to a specific request's `progressToken` and have no
meaningful broadcast use case. Neither the Python SDK nor the TypeScript SDK provides
a server-level progress broadcast capability.

The MCP specification requires that progress notifications only reference tokens
provided in an active request:

> Progress notifications MUST only reference tokens that:
> - Were provided in an active request
> - Are associated with an in-progress operation

Ref: https://modelcontextprotocol.io/specification/2025-11-25/basic/utilities/progress

Broadcasting progress to all clients does not comply with this requirement,
since clients that did not originate the request have no matching `progressToken`.

The introduction of `ServerSession` for per-connection state (#275) made
this removal possible: `Progress` and `ServerContext` now use `notification_target:`
(a `ServerSession`) to route notifications to the originating session only.

### Changes

- Removed `Server#notify_progress` entirely. The method is no longer needed as
  `notification_target` in `call_tool_with_args` now passes `session` directly
  (nil when no session is available, in which case `Progress#report` and
  `ServerContext#notify_log_message` are no-ops).
- Removed `ServerContext#notify_progress` as well. Progress notifications should
  only be sent via `server_context.report_progress`, which enforces the correct
  `progressToken` from the originating request.
- Added nil guards to `Progress#report` and `ServerContext#notify_log_message`
  for when no session is available.
- Rewrote progress tests to use `ServerSession#handle` instead of
  `Server#handle`, reflecting that progress notifications are always session-scoped.
- Removed 4 tests that called `server.notify_progress` directly as a public broadcast API.
- Removed `notify_progress` from the README.md notification methods list.
- Removed the "Server-Side: Direct `notify_progress` Usage" section from the README.md.

Progress notifications should be sent via `server_context.report_progress` inside tool handlers,
which automatically scopes them to the originating client session.

## Breaking Changes

Progress notifications are scoped to a specific request via `progressToken` per the MCP specification,
so the broadcast behavior of `Server#notify_progress` was a spec violation.
This is treated as a bug fix and is made without a deprecation period.
This aligns the Ruby SDK with the Python and TypeScript SDKs, neither of which provides
a server-level progress broadcast API.

`Server#notify_progress` and `ServerContext#notify_progress` are no longer available.
Users should use `server_context.report_progress` inside tool handlers instead, which
provides session-scoped delivery with the correct `progressToken`.

This feature was only recently introduced in mcp 0.9.0:
https://github.com/modelcontextprotocol/ruby-sdk/releases/tag/v0.9.0

So an early release should help limit its impact on adoption.
2026-03-29 15:11:28 +09:00
..
client Add MCP::Client::Stdio transport 2026-03-19 12:41:27 +09:00
prompt Support Ruby 2.7 - Ruby 3.1 2026-01-06 10:38:56 +09:00
resource Fix Resource::Contents#to_h to use correct property names per MCP spec 2026-02-19 13:50:10 +09:00
server Merge pull request #274 from koic/reject_missing_session_id 2026-03-29 12:34:00 +09:00
tool Allow $ref in Tool::Schema for protocol version 2025-11-25 2026-02-27 14:33:36 +09:00
transports Add a migration path for Server::Transports::StdioTransport 2025-06-10 16:27:22 +09:00
annotations.rb Extract MCP::Annotations into a dedicated file 2026-02-03 15:38:04 +09:00
client.rb Allow Client#call_tool to accept a tool name 2026-03-23 00:43:59 +09:00
configuration.rb Support Ruby 2.7 - Ruby 3.1 2026-01-06 10:38:56 +09:00
content.rb Add Content::EmbeddedResource class for embedded resource content type 2026-03-02 01:33:05 +09:00
icon.rb Support icons parameter 2025-12-30 05:35:22 +09:00
instrumentation.rb Support Ruby 2.7 - Ruby 3.1 2026-01-06 10:38:56 +09:00
logging_message_notification.rb logging_message_notification: Remove unused require 2026-02-05 16:05:08 -05:00
methods.rb Add Elicitation skeleton 2025-11-21 02:42:20 +09:00
progress.rb Remove Server#notify_progress broadcast API 2026-03-29 15:11:28 +09:00
prompt.rb Use autoload to defer loading of unused subsystems 2026-03-12 14:08:27 +09:00
resource.rb Use autoload to defer loading of unused subsystems 2026-03-12 14:08:27 +09:00
resource_template.rb Omit icons from responses when empty or nil 2026-01-12 09:46:45 +09:00
server.rb Remove Server#notify_progress broadcast API 2026-03-29 15:11:28 +09:00
server_context.rb Remove Server#notify_progress broadcast API 2026-03-29 15:11:28 +09:00
server_session.rb Introduce ServerSession for per-connection state 2026-03-29 08:04:56 +09:00
string_utils.rb Fix ReDoS vulnerability in StringUtils#underscore 2026-01-09 01:14:52 +09:00
tool.rb Use autoload to defer loading of unused subsystems 2026-03-12 14:08:27 +09:00
transport.rb Introduce ServerSession for per-connection state 2026-03-29 08:04:56 +09:00
version.rb Release 0.9.2 2026-03-27 12:10:53 +09:00