Skip to content

Commit b74167f

Browse files
committed
[FIXUP] Correct docs and drop server level protocol version
1 parent ab3fec3 commit b74167f

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,18 +240,22 @@ config.instrumentation_callback = ->(data) {
240240

241241
### Server Protocol Version
242242

243-
The server's protocol version can be overridden using the `protocol_version` class method:
243+
The server's protocol version can be overridden via the `Configuration#protocol_version` method:
244244

245245
<!-- SNIPPET ID: set_server_protocol_version -->
246246
```ruby
247-
MCP::Server.protocol_version = "2024-11-05"
247+
MCP.configure do |config|
248+
config.protocol_version = "2024-11-05"
249+
end
248250
```
249251

250252
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`:
251253

252254
<!-- SNIPPET ID: unset_server_protocol_version -->
253255
```ruby
254-
MCP::Server.protocol_version = nil
256+
MCP.configure do |config|
257+
config.protocol_version = nil
258+
end
255259
```
256260

257261
Be sure to check the [MCP spec](https://spec.modelcontextprotocol.io/specification/2024-11-05/) for the protocol version to understand the supported features for the version being set.

lib/mcp/server.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@ module MCP
99
class Server
1010
DEFAULT_VERSION = "0.1.0"
1111

12-
class << self
13-
def protocol_version = MCP.configuration.protocol_version
14-
15-
def protocol_version=(version)
16-
MCP.configuration.protocol_version = version
17-
end
18-
end
19-
2012
class RequestHandlerError < StandardError
2113
attr_reader :error_type
2214
attr_reader :original_error

test/fixtures/files/code_snippet_wrappers/readme/set_server_protocol_version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
require_relative "code_snippet"
66

7-
puts MCP::Server.protocol_version
7+
puts MCP.configuration.protocol_version

0 commit comments

Comments
 (0)