Skip to content

Commit a2b131b

Browse files
committed
Default to the latest stable protocol version
When starting an MCP server in Claude Code with `protocol_version` set to `DRAFT-2025-v3`, it fails with the following error: ```console 2025-12-04T02:58:01.548Z [DEBUG] MCP server "example": Connection failed after 2093ms: Server's protocol version is not supported: DRAFT-2025-v3 2025-12-04T02:58:01.548Z [ERROR] MCP server "example" Connection failed: Server's protocol version is not supported: DRAFT-2025-v3 ``` This PR changes the default behavior so that if `protocol_version` is not specified, it uses the latest stable protocol version instead of the draft version. This PR also updates the README to note that the latest stable protocol version includes new features from the draft version.
1 parent 00392b6 commit a2b131b

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,8 @@ configuration = MCP::Configuration.new(protocol_version: "2024-11-05")
349349
MCP::Server.new(name: "test_server", configuration: configuration)
350350
```
351351

352-
If no protocol version is specified, the [Draft version](https://modelcontextprotocol.io/specification/draft) will be applied by default.
352+
If no protocol version is specified, the latest version (2025-11-25) will be applied by default.
353+
The latest stable version includes new features from the [draft version](https://modelcontextprotocol.io/specification/draft).
353354

354355
This will make all new server instances use the specified protocol version instead of the default version. The protocol version can be reset to the default by setting it to `nil`:
355356

lib/mcp/configuration.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22

33
module MCP
44
class Configuration
5-
# DRAFT-2025-v3 is the latest draft protocol version:
6-
# https://github.com/modelcontextprotocol/modelcontextprotocol/blob/14ec41c/schema/draft/schema.ts#L15
7-
DRAFT_PROTOCOL_VERSION = "DRAFT-2025-v3"
8-
SUPPORTED_STABLE_PROTOCOL_VERSIONS = ["2025-06-18", "2025-03-26", "2024-11-05"]
5+
LATEST_STABLE_PROTOCOL_VERSION = "2025-06-18"
6+
SUPPORTED_STABLE_PROTOCOL_VERSIONS = [LATEST_STABLE_PROTOCOL_VERSION, "2025-03-26", "2024-11-05"]
97

108
attr_writer :exception_reporter, :instrumentation_callback
119

@@ -35,7 +33,7 @@ def validate_tool_call_arguments=(validate_tool_call_arguments)
3533
end
3634

3735
def protocol_version
38-
@protocol_version || DRAFT_PROTOCOL_VERSION
36+
@protocol_version || LATEST_STABLE_PROTOCOL_VERSION
3937
end
4038

4139
def protocol_version?

test/mcp/configuration_test.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,19 @@ class ConfigurationTest < ActiveSupport::TestCase
3838
# https://github.com/modelcontextprotocol/modelcontextprotocol/blob/14ec41c/schema/draft/schema.ts#L15
3939
test "initializes with default protocol version" do
4040
config = Configuration.new
41-
assert_equal Configuration::DRAFT_PROTOCOL_VERSION, config.protocol_version
41+
assert_equal Configuration::LATEST_STABLE_PROTOCOL_VERSION, config.protocol_version
4242
end
4343

4444
test "uses the draft protocol version when protocol_version is set to nil" do
4545
config = Configuration.new(protocol_version: nil)
46-
assert_equal Configuration::DRAFT_PROTOCOL_VERSION, config.protocol_version
46+
assert_equal Configuration::LATEST_STABLE_PROTOCOL_VERSION, config.protocol_version
4747
end
4848

4949
test "raises ArgumentError when setting the draft protocol version" do
5050
exception = assert_raises(ArgumentError) do
51-
# To use the draft version externally, either omit `protocol_version` or set it to nil.
52-
Configuration.new(protocol_version: Configuration::DRAFT_PROTOCOL_VERSION)
51+
# DRAFT-2025-v3 is the latest draft protocol version:
52+
# https://github.com/modelcontextprotocol/modelcontextprotocol/blob/14ec41c/schema/draft/schema.ts#L15
53+
Configuration.new(protocol_version: "DRAFT-2025-v3")
5354
end
5455

5556
assert_equal("protocol_version must be 2025-06-18, 2025-03-26, or 2024-11-05", exception.message)

test/mcp/server/transports/streamable_http_transport_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class StreamableHTTPTransportTest < ActiveSupport::TestCase
8181
body = JSON.parse(response[2][0])
8282
assert_equal "2.0", body["jsonrpc"]
8383
assert_equal "123", body["id"]
84-
assert_equal Configuration::DRAFT_PROTOCOL_VERSION, body["result"]["protocolVersion"]
84+
assert_equal Configuration::LATEST_STABLE_PROTOCOL_VERSION, body["result"]["protocolVersion"]
8585
end
8686

8787
test "handles GET request with valid session ID" do

test/mcp/server_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class ServerTest < ActiveSupport::TestCase
133133
jsonrpc: "2.0",
134134
id: 1,
135135
result: {
136-
protocolVersion: Configuration::DRAFT_PROTOCOL_VERSION,
136+
protocolVersion: Configuration::LATEST_STABLE_PROTOCOL_VERSION,
137137
capabilities: {
138138
prompts: { listChanged: true },
139139
resources: { listChanged: true },
@@ -776,7 +776,7 @@ def call(message:, server_context: nil)
776776
}
777777

778778
response = @server.handle(request)
779-
assert_equal Configuration::DRAFT_PROTOCOL_VERSION, response[:result][:protocolVersion]
779+
assert_equal Configuration::LATEST_STABLE_PROTOCOL_VERSION, response[:result][:protocolVersion]
780780
end
781781

782782
test "server response does not include title when not configured" do

0 commit comments

Comments
 (0)