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.
This commit is contained in:
Koichi ITO 2025-12-04 03:15:02 +09:00
commit c786a14f61

View file

@ -2,10 +2,8 @@
module MCP
class Configuration
# DRAFT-2025-v3 is the latest draft protocol version:
# https://github.com/modelcontextprotocol/modelcontextprotocol/blob/14ec41c/schema/draft/schema.ts#L15
DRAFT_PROTOCOL_VERSION = "DRAFT-2025-v3"
SUPPORTED_STABLE_PROTOCOL_VERSIONS = ["2025-06-18", "2025-03-26", "2024-11-05"]
LATEST_STABLE_PROTOCOL_VERSION = "2025-06-18"
SUPPORTED_STABLE_PROTOCOL_VERSIONS = [LATEST_STABLE_PROTOCOL_VERSION, "2025-03-26", "2024-11-05"]
attr_writer :exception_reporter, :instrumentation_callback
@ -35,7 +33,7 @@ module MCP
end
def protocol_version
@protocol_version || DRAFT_PROTOCOL_VERSION
@protocol_version || LATEST_STABLE_PROTOCOL_VERSION
end
def protocol_version?