Skip to content

Keep Ruby 2.7 from warning about keywords in StdioTransport - #621

Merged
koic merged 1 commit into
modelcontextprotocol:mainfrom
koic:keep_ruby_2_7_from_warning_about_keywords_in_stdio_transport
Oct 17, 2026
Merged

koic merged 1 commit into
modelcontextprotocol:mainfrom
koic:keep_ruby_2_7_from_warning_about_keywords_in_stdio_transport

Conversation

@koic

@koic koic commented Oct 16, 2026

Copy link
Copy Markdown
Member

Since 1.8.0, ServerSession#handle accepts bare keyword arguments as the request (handle(request = nil, auth_info: nil, **request_keywords)), so StdioTransport passing the parsed request Hash as its only argument makes Ruby 2.7 treat the Hash as keyword arguments. The request is still handled, but every frame prints "Using the last argument as keyword parameters is deprecated" to stderr when deprecation warnings are enabled, which breaks callers that expect a silent stderr, such as RuboCop's MCP server specs on Ruby 2.7.

Passing auth_info: nil explicitly keeps the Hash positional without changing the request that reaches the server.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Since 1.8.0, `ServerSession#handle` accepts bare keyword arguments as the request (`handle(request = nil, auth_info: nil, **request_keywords)`),
so `StdioTransport` passing the parsed request Hash as its only argument makes Ruby 2.7 treat the Hash as keyword arguments.
The request is still handled, but every frame prints
"Using the last argument as keyword parameters is deprecated" to stderr when deprecation warnings are enabled,
which breaks callers that expect a silent stderr, such as RuboCop's MCP server specs on Ruby 2.7.

Passing `auth_info: nil` explicitly keeps the Hash positional without changing the request that reaches the server.
koic added a commit to rubocop/rubocop that referenced this pull request Oct 16, 2026
mcp 1.8.0 makes Ruby 2.7 print a keyword argument deprecation warning for every stdio request,
which fails the MCP server specs that expect a silent stderr on the Ruby 2.7 CI jobs.
The fix is modelcontextprotocol/ruby-sdk#621.

Excluding only 1.8.0 resolves to 1.7.0 until then and picks up 1.8.1 without another change here.
mcp is a development dependency only, so users of RuboCop are not affected.
@koic
koic merged commit 7a101d6 into modelcontextprotocol:main Oct 17, 2026
11 checks passed
@koic
koic deleted the keep_ruby_2_7_from_warning_about_keywords_in_stdio_transport branch October 17, 2026 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant