Skip to content

Commit 7b73bc7

Browse files
committed
[Doc] Describe connect across both protocol lifecycles
## Motivation and Context The client documentation equated `MCP::Client#connect` with the MCP initialization handshake, which MCP 2026-07-28 removed: a modern connection probes `server/discover` instead. Calling `connect` first is still required on either era, since it settles the lifecycle and registers the identity, capabilities, and protocol version that modern requests carry in `_meta`, so the wording now names that rather than the handshake. ## How Has This Been Tested? Without `connect` a modern server rejects the first request; with it the same call succeeds. The documentation site builds with the new wording. ## Breaking Changes None. The change is documentation prose and example comments.
1 parent 538a364 commit 7b73bc7

5 files changed

Lines changed: 8 additions & 8 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ stdio_transport = MCP::Client::Stdio.new(
101101
)
102102
client = MCP::Client.new(transport: stdio_transport)
103103

104-
# Perform the MCP initialization handshake before sending any requests.
104+
# Negotiate the protocol lifecycle before sending any requests.
105105
client.connect
106106

107107
# List available tools.

docs/_client/authorization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ transport = MCP::Client::HTTP.new(
7878
oauth: provider,
7979
)
8080
client = MCP::Client.new(transport: transport)
81-
client.connect # `initialize` is sent here; if the server replies 401 the OAuth flow runs and the handshake is retried with the acquired token
81+
client.connect # the lifecycle is established here; if the server replies 401 the OAuth flow runs and the request is retried with the acquired token
8282
client.tools
8383
```
8484

docs/_client/lifecycle.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This page covers `MCP::Client#connect` and how it negotiates between the two.
1212

1313
## Handshake
1414

15-
Call `MCP::Client#connect` to perform the MCP [initialization handshake](https://modelcontextprotocol.io/specification/2025-11-25/basic/lifecycle#initialization) before sending any other requests. The client sends an `initialize` request through the transport, followed by the required `notifications/initialized` notification, and caches the server's `InitializeResult` (protocol version, capabilities, server info, instructions):
15+
Call `MCP::Client#connect` before sending any other requests. On the handshake lifecycle it performs the MCP [initialization handshake](https://modelcontextprotocol.io/specification/2025-11-25/basic/lifecycle#initialization): the client sends an `initialize` request through the transport, followed by the required `notifications/initialized` notification, and caches the server's `InitializeResult` (protocol version, capabilities, server info, instructions):
1616

1717
```ruby
1818
client.connect
@@ -22,7 +22,7 @@ client.connected? # => true
2222
client.server_info # => cached InitializeResult
2323
```
2424

25-
`connect` accepts optional `client_info:`, `protocol_version:`, and `capabilities:` keyword arguments. It is idempotent: a second call returns the cached result without contacting the server. After `close`, state is cleared and `connect` will handshake again.
25+
`connect` accepts optional `client_info:`, `protocol_version:`, and `capabilities:` keyword arguments. It is idempotent: a second call returns the cached result without contacting the server. After `close`, state is cleared and `connect` establishes the lifecycle again.
2626

2727
This applies to both the Stdio and HTTP transports described on the [Transports](/client/transports/) page.
2828

docs/_client/transports.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ stdio_transport = MCP::Client::Stdio.new(
3535
)
3636
client = MCP::Client.new(transport: stdio_transport)
3737

38-
# Perform the MCP initialization handshake before sending any requests.
38+
# Negotiate the protocol lifecycle before sending any requests.
3939
client.connect
4040

4141
# List available tools.
@@ -57,7 +57,7 @@ stdio_transport.close
5757
The stdio transport automatically handles:
5858

5959
- Spawning the server process with `Open3.popen3`
60-
- MCP protocol initialization handshake (`initialize` request + `notifications/initialized`)
60+
- Lifecycle negotiation (a `server/discover` probe, or `initialize` + `notifications/initialized` on the handshake lifecycle)
6161
- JSON-RPC 2.0 message framing over newline-delimited JSON
6262
- Answering server `ping` requests; see [Answering Server Pings](/client/ping/#answering-server-pings)
6363

@@ -93,7 +93,7 @@ Example usage:
9393
http_transport = MCP::Client::HTTP.new(url: "https://api.example.com/mcp")
9494
client = MCP::Client.new(transport: http_transport)
9595

96-
# Perform the MCP initialization handshake before sending any requests.
96+
# Negotiate the protocol lifecycle before sending any requests.
9797
client.connect
9898

9999
# List available tools

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ stdio_transport = MCP::Client::Stdio.new(
8383
)
8484
client = MCP::Client.new(transport: stdio_transport)
8585

86-
# Perform the MCP initialization handshake before sending any requests.
86+
# Negotiate the protocol lifecycle before sending any requests.
8787
client.connect
8888

8989
# List available tools.

0 commit comments

Comments
 (0)