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.
This commit is contained in:
Koichi ITO 2025-06-08 15:23:46 +09:00
commit 16ab4bac81

View file

@ -0,0 +1,15 @@
# frozen_string_literal: true
require_relative "../server/transports/stdio_transport"
warn <<~MESSAGE, uplevel: 3
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.
MESSAGE
module MCP
module Transports
StdioTransport = Server::Transports::StdioTransport
end
end