You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## 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`.
A client that connects to the STDIO server using the `MCP::Client::Stdio` transport. This demonstrates how to use the SDK's built-in client classes to interact with a server subprocess.
21
+
22
+
**Usage:**
23
+
24
+
```console
25
+
$ ruby examples/stdio_client.rb
26
+
```
27
+
28
+
The client will automatically launch `stdio_server.rb` as a subprocess and demonstrate:
29
+
30
+
- Listing and calling tools
31
+
- Listing prompts
32
+
- Listing and reading resources
33
+
- Automatic MCP protocol initialization
34
+
- Transport cleanup on exit
35
+
36
+
### 3. HTTP Server (`http_server.rb`)
19
37
20
38
A standalone HTTP server built with Rack that implements the MCP Streamable HTTP transport protocol. This demonstrates how to create a web-based MCP server with session management and Server-Sent Events (SSE) support.
21
39
@@ -41,7 +59,7 @@ The server will start on `http://localhost:9292` and provide:
41
59
-**Prompts**: `ExamplePrompt` - echoes back arguments as a prompt
42
60
-**Resources**: `test_resource` - returns example content
43
61
44
-
### 3. HTTP Client Example (`http_client.rb`)
62
+
### 4. HTTP Client Example (`http_client.rb`)
45
63
46
64
A client that demonstrates how to interact with the HTTP server using all MCP protocol methods.
47
65
@@ -67,7 +85,7 @@ The client will demonstrate:
67
85
- Listing and reading resources
68
86
- Session cleanup
69
87
70
-
### 4. Streamable HTTP Server (`streamable_http_server.rb`)
88
+
### 5. Streamable HTTP Server (`streamable_http_server.rb`)
71
89
72
90
A specialized HTTP server designed to test and demonstrate Server-Sent Events (SSE) functionality in the MCP protocol.
0 commit comments