Merge pull request #184 from koic/support_2025_11_25_specification

Allow stable protocol specification version "2025-11-25"
This commit is contained in:
Koichi ITO 2025-12-20 19:04:36 +09:00 • committed by GitHub
commit 7b3ff946ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 14 additions and 12 deletions

View file

@ -173,7 +173,7 @@ class ApplicationController < ActionController::Base
def index def index
server = MCP::Server.new( server = MCP::Server.new(
name: "my_server", name: "my_server",
title: "Example Server Display Name", # WARNING: This is a `Draft` and is not supported in the `Version 2025-06-18 (latest)` specification. title: "Example Server Display Name",
version: "1.0.0", version: "1.0.0",
instructions: "Use the tools of this server as a last resort", instructions: "Use the tools of this server as a last resort",
tools: [SomeTool, AnotherTool], tools: [SomeTool, AnotherTool],
@ -392,7 +392,7 @@ This gem provides a `MCP::Tool` class that can be used to create tools in three
```ruby ```ruby
class MyTool < MCP::Tool class MyTool < MCP::Tool
title "My Tool" # WARNING: This is a `Draft` and is not supported in the `Version 2025-06-18 (latest)` specification. title "My Tool"
description "This tool performs specific functionality..." description "This tool performs specific functionality..."
input_schema( input_schema(
properties: { properties: {
@ -429,7 +429,7 @@ tool = MyTool
```ruby ```ruby
tool = MCP::Tool.define( tool = MCP::Tool.define(
name: "my_tool", name: "my_tool",
title: "My Tool", # WARNING: This is a `Draft` and is not supported in the `Version 2025-06-18 (latest)` specification. title: "My Tool",
description: "This tool performs specific functionality...", description: "This tool performs specific functionality...",
annotations: { annotations: {
read_only_hint: true, read_only_hint: true,
@ -660,7 +660,7 @@ The `MCP::Prompt` class provides three ways to create prompts:
```ruby ```ruby
class MyPrompt < MCP::Prompt class MyPrompt < MCP::Prompt
prompt_name "my_prompt" # Optional - defaults to underscored class name prompt_name "my_prompt" # Optional - defaults to underscored class name
title "My Prompt" # WARNING: This is a `Draft` and is not supported in the `Version 2025-06-18 (latest)` specification. title "My Prompt"
description "This prompt performs specific functionality..." description "This prompt performs specific functionality..."
arguments [ arguments [
MCP::Prompt::Argument.new( MCP::Prompt::Argument.new(
@ -699,7 +699,7 @@ prompt = MyPrompt
```ruby ```ruby
prompt = MCP::Prompt.define( prompt = MCP::Prompt.define(
name: "my_prompt", name: "my_prompt",
title: "My Prompt", # WARNING: This is a `Draft` and is not supported in the `Version 2025-06-18 (latest)` specification. title: "My Prompt",
description: "This prompt performs specific functionality...", description: "This prompt performs specific functionality...",
arguments: [ arguments: [
MCP::Prompt::Argument.new( MCP::Prompt::Argument.new(
@ -824,7 +824,7 @@ The `MCP::Resource` class provides a way to register resources with the server.
resource = MCP::Resource.new( resource = MCP::Resource.new(
uri: "https://example.com/my_resource", uri: "https://example.com/my_resource",
name: "my-resource", name: "my-resource",
title: "My Resource", # WARNING: This is a `Draft` and is not supported in the `Version 2025-06-18 (latest)` specification. title: "My Resource",
description: "Lorem ipsum dolor sit amet", description: "Lorem ipsum dolor sit amet",
mime_type: "text/html", mime_type: "text/html",
) )
@ -857,7 +857,7 @@ The `MCP::ResourceTemplate` class provides a way to register resource templates
resource_template = MCP::ResourceTemplate.new( resource_template = MCP::ResourceTemplate.new(
uri_template: "https://example.com/my_resource_template", uri_template: "https://example.com/my_resource_template",
name: "my-resource-template", name: "my-resource-template",
title: "My Resource Template", # WARNING: This is a `Draft` and is not supported in the `Version 2025-06-18 (latest)` specification. title: "My Resource Template",
description: "Lorem ipsum dolor sit amet", description: "Lorem ipsum dolor sit amet",
mime_type: "text/html", mime_type: "text/html",
) )

View file

@ -2,8 +2,10 @@
module MCP module MCP
class Configuration class Configuration
LATEST_STABLE_PROTOCOL_VERSION = "2025-06-18" LATEST_STABLE_PROTOCOL_VERSION = "2025-11-25"
SUPPORTED_STABLE_PROTOCOL_VERSIONS = [LATEST_STABLE_PROTOCOL_VERSION, "2025-03-26", "2024-11-05"] SUPPORTED_STABLE_PROTOCOL_VERSIONS = [
LATEST_STABLE_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05",
]
attr_writer :exception_reporter, :instrumentation_callback attr_writer :exception_reporter, :instrumentation_callback

View file

@ -174,7 +174,7 @@ module MCP
private private
def validate! def validate!
# NOTE: The draft protocol version is the next version after 2025-03-26. # NOTE: The draft protocol version is the next version after 2025-11-25.
if @configuration.protocol_version <= "2025-03-26" if @configuration.protocol_version <= "2025-03-26"
if server_info.key?(:title) if server_info.key?(:title)
message = "Error occurred in server_info. `title` is not supported in protocol version 2025-03-26 or earlier" message = "Error occurred in server_info. `title` is not supported in protocol version 2025-03-26 or earlier"

View file

@ -53,7 +53,7 @@ module MCP
Configuration.new(protocol_version: "DRAFT-2025-v3") Configuration.new(protocol_version: "DRAFT-2025-v3")
end end
assert_equal("protocol_version must be 2025-06-18, 2025-03-26, or 2024-11-05", exception.message) assert_equal("protocol_version must be 2025-11-25, 2025-06-18, 2025-03-26, or 2024-11-05", exception.message)
end end
test "raises ArgumentError when protocol_version is not a supported protocol version" do test "raises ArgumentError when protocol_version is not a supported protocol version" do
@ -62,7 +62,7 @@ module MCP
custom_version = "2025-03-27" custom_version = "2025-03-27"
config.protocol_version = custom_version config.protocol_version = custom_version
end end
assert_equal("protocol_version must be 2025-06-18, 2025-03-26, or 2024-11-05", exception.message) assert_equal("protocol_version must be 2025-11-25, 2025-06-18, 2025-03-26, or 2024-11-05", exception.message)
end end
test "raises ArgumentError when protocol_version is not a boolean value" do test "raises ArgumentError when protocol_version is not a boolean value" do