Commit graph quickstart-resources/mcp-client-ruby
Author SHA1 Message Date
Alex Akimov
36b6ca4070
Update quickstart URLs (#140) 2026-05-16 08:59:02 -07:00
Koichi ITO
a1838e965a Add client-level connect handshake to stdio transport
## Motivation and Context

Follow-up to https://github.com/modelcontextprotocol/ruby-sdk/pull/336

mcp gem 0.15.0 introduced an explicit `MCP::Client#connect` method for the stdio transport,
aligning with the Python and TypeScript SDKs which require explicit handshake calls regardless
of transport type:

- Python SDK: `ClientSession.initialize()`
  https://github.com/modelcontextprotocol/python-sdk
- TypeScript SDK: `Client.connect(transport)`
  https://github.com/modelcontextprotocol/typescript-sdk

This sample is updated to call `@mcp_client.connect` explicitly after creating the client,
demonstrating the recommended initialization pattern. The Gemfile constraint is bumped to `>= 0.15.0`
to require the new API.

## How Has This Been Tested?

Ran the sample against `weather-server-ruby` and confirmed the connection, tool listing,
and chat loop continue to work as expected.

## Breaking Changes

None. The change updates the sample to use the new explicit `connect` API,
which was added as a non-breaking addition in mcp gem 0.15.0.
2026-05-06 09:27:15 +09:00
Koichi ITO
ded91068d0 Add Ruby MCP client example
## Motivation and Context

Add an LLM-powered chatbot MCP client example using the MCP Ruby SDK and the Anthropic Ruby SDK,
following the same pattern as other language examples.
https://github.com/modelcontextprotocol/ruby-sdk

The Gemfile specifies mcp version 0.9.1 or higher, which supports the stdio client.
https://github.com/modelcontextprotocol/ruby-sdk/releases/tag/v0.9.1

## Additional context

Once https://github.com/anthropics/anthropic-sdk-ruby/pull/161 is merged and released,
`gem "base64"` will no longer be needed in the Gemfile.
2026-03-23 22:45:16 +09:00