Skip to content

Add MCP::Client::Stdio transport#262

Open
koic wants to merge 1 commit intomodelcontextprotocol:mainfrom
koic:stdio_client_transport
Open

Add MCP::Client::Stdio transport#262
koic wants to merge 1 commit intomodelcontextprotocol:mainfrom
koic:stdio_client_transport

Conversation

@koic
Copy link
Member

@koic koic commented Mar 18, 2026

Motivation and Context

The MCP::Client currently only supports HTTP transport (MCP::Client::HTTP). To achieve parity with other MCP SDKs (Python, TypeScript, C#) which provide stdio client transports for spawning and communicating with server subprocesses, the Ruby SDK needs a stdio client transport.
https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#stdio

This enables building MCP clients that launch server processes and communicate via stdin/stdout using newline-delimited JSON-RPC 2.0 messages.

How Has This Been Tested?

Added tests for process spawning, protocol initialization handshake, notification handling, error handling, and transport close lifecycle.

Breaking Changes

None.

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

Additional context

Enabled the Lint/IncompatibleIoSelectWithFiberScheduler cop in .rubocop.yml to detect accidental use of IO.select instead of IO#wait_readable.

## Motivation and Context

The `MCP::Client` currently only supports HTTP transport (`MCP::Client::HTTP`).
To achieve parity with other MCP SDKs (Python, TypeScript, C#) which provide
stdio client transports for spawning and communicating with server subprocesses,
the Ruby SDK needs a stdio client transport.
https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#stdio

This enables building MCP clients that launch server processes and communicate
via stdin/stdout using newline-delimited JSON-RPC 2.0 messages.

## How Has This Been Tested?

Added tests for process spawning, protocol initialization handshake,
notification handling, error handling, and transport close lifecycle.

## Additional context

Enabled the `Lint/IncompatibleIoSelectWithFiberScheduler` cop in `.rubocop.yml`
to detect accidental use of `IO.select` instead of `IO#wait_readable`.
@koic koic force-pushed the stdio_client_transport branch from 6ea5790 to 52948df Compare March 18, 2026 09:54
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