Skip to content

Commit 16ab4ba

Browse files
committed
Add a migration path for Server::Transports::StdioTransport
Follow-up to #27. This PR adds a migration path for `Server::Transports::StdioTransport`. e.g., ```console $ cat /tmp/example.rb require "mcp/transports/stdio" MCP::Transports::StdioTransport ``` This change displays the following warning instead of raising an error for such cases, allowing execution to proceed: ```console $ bundle exec ruby /tmp/example.rb /tmp/example.rb:1: warning: Use `require "mcp/server/transports/stdio_transport"` instead of `require "mcp/transports/stdio"`. Also use `MCP::Server::Transports::StdioTransport` instead of `MCP::Transports::StdioTransport`. This API is deprecated and will be removed in a future release. ``` Currently (v0.1.0), it results in an error without any warning. This MCP gem is not yet close to version 1.0, but introducing breaking changes to a published interface is undesirable. This compatibility code should be removed at some point after a few releases. Closes #50.
1 parent b65d9b6 commit 16ab4ba

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/mcp/transports/stdio.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# frozen_string_literal: true
2+
3+
require_relative "../server/transports/stdio_transport"
4+
5+
warn <<~MESSAGE, uplevel: 3
6+
Use `require "mcp/server/transports/stdio_transport"` instead of `require "mcp/transports/stdio"`.
7+
Also use `MCP::Server::Transports::StdioTransport` instead of `MCP::Transports::StdioTransport`.
8+
This API is deprecated and will be removed in a future release.
9+
MESSAGE
10+
11+
module MCP
12+
module Transports
13+
StdioTransport = Server::Transports::StdioTransport
14+
end
15+
end

0 commit comments

Comments
 (0)