Skip to content

mcp: reject ping and logging/setLevel on 2026-07-28 session - #1537

Merged
guglielmo-san merged 3 commits into
mainfrom
serob/remove-ping-and-setLevel-on-new-protocol
Nov 20, 2026
Merged

guglielmo-san merged 3 commits into
mainfrom
serob/remove-ping-and-setLevel-on-new-protocol

Conversation

@nahapetyan-serob

Copy link
Copy Markdown
Contributor

SEP-2575 removes ping (in both directions) and logging/setLevel in protocol version 2026-07-28. On new-protocol sessions:

ping

  • Already handled: ClientSession.Ping returns CodeMethodNotFound locally, and the server rejects an incoming ping.
  • Added: ServerSession.Ping returns CodeMethodNotFound locally.
  • Added: the client rejects an incoming ping with CodeMethodNotFound.

logging/setLevel

  • Already handled: the server rejects an incoming logging/setLevel.
  • Added: ClientSession.SetLoggingLevel returns CodeMethodNotFound locally instead of sending the request. Docs now point to MetaKeyLogLevel for per-request log levels.

Behavior on older protocol versions is unchanged.
Fixes #1518

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new protocol check reads initialization state without synchronization, creating a critical data race with Connect that must be fixed without blocking pre-initialization ping responses.

1 open issue
What changed in this PR

Updates the MCP SDK to reject methods removed in protocol 2026-07-28, while preserving behavior for older sessions.

Changes:

  • Rejects outgoing server pings, incoming client pings, and client SetLoggingLevel calls on new-protocol sessions.
  • Adds regression tests and pins legacy logging and keepalive tests to protocol 2025-11-25.
  • Documents removed methods and per-request logging configuration.
File Description
mcp/​server.go Rejects server-initiated pings on new-protocol sessions.
mcp/​server_test.go Tests local rejection of server pings.
mcp/​server_lifecycle_log_test.go Uses a legacy session for lifecycle logging tests.
mcp/​server_example_test.go Pins the logging example to a legacy protocol.
mcp/​mcp_test.go Keeps legacy-dependent tests on the older protocol.
mcp/​logging_test.go Uses a legacy session for logging-level tests.
mcp/​client.go Rejects incoming pings and local logging-level changes on new sessions.
mcp/​client_test.go Tests client-side rejection of removed methods.
internal/​docs/​server.src.md Documents per-request log levels and legacy restrictions.
internal/​docs/​protocol.src.md Documents rejection of incoming pings.
docs/​server.md Updates generated logging guidance and example.
docs/​protocol.md Updates generated ping guidance.

Review effort: Balanced

Comment thread mcp/client.go Resolved
Comment thread mcp/client.go Resolved
@guglielmo-san
guglielmo-san merged commit 7f22059 into main Nov 20, 2026
10 checks passed
@guglielmo-san
guglielmo-san deleted the serob/remove-ping-and-setLevel-on-new-protocol branch November 20, 2026 16:58
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.

ping and logging/setLevel still sent for protocol 2026-07-28

3 participants