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
The `MCP::Client` module provides client implementations for interacting with MCP servers. Currently, it supports HTTP transport for making JSON-RPC requests to MCP servers.
237
-
238
-
**Note:** The client HTTP transport requires the `faraday` gem. Add `gem 'faraday', '>= 2.0'` to your Gemfile if you plan to use the client HTTP transport functionality.
239
-
240
-
### HTTP Client
241
-
242
-
The `MCP::Client::Http` class provides a simple HTTP client for interacting with MCP servers:
By default, the HTTP client has no authentication, but it supports custom headers for authentication. For example, to use Bearer token authentication:
272
-
273
-
```ruby
274
-
client =MCP::Client::Http.new(
275
-
url:"https://api.example.com/mcp",
276
-
headers: {
277
-
"Authorization" => "Bearer my_token"
278
-
}
279
-
)
280
-
281
-
client.tools # will make the call using Bearer auth
282
-
```
283
-
284
-
You can add any custom headers needed for your authentication scheme. The client will include these headers in all requests.
285
-
286
-
### Tool Objects
287
-
288
-
The client provides wrapper objects for tools returned by the server:
289
-
290
-
-`MCP::Client::Tool` - Represents a single tool with its metadata
291
-
-`MCP::Client::Tools` - Collection of tools with enumerable functionality
292
-
293
-
These objects provide easy access to tool properties like name, description, and input schema.
294
-
295
209
## Configuration
296
210
297
211
The gem can be configured using the `MCP.configure` block:
@@ -659,6 +573,74 @@ end
659
573
660
574
otherwise `resources/read` requests will be a no-op.
661
575
576
+
## Building an MCP Client
577
+
578
+
The `MCP::Client` module provides client implementations for interacting with MCP servers. Currently, it supports HTTP transport for making JSON-RPC requests to MCP servers.
579
+
580
+
**Note:** The client HTTP transport requires the `faraday` gem. Add `gem 'faraday', '>= 2.0'` to your Gemfile if you plan to use the client HTTP transport functionality.
581
+
582
+
### HTTP Transport Layer
583
+
584
+
You'll need to add `faraday` as a dependency to use the HTTP transport layer.
585
+
586
+
```ruby
587
+
gem 'mcp'
588
+
gem 'faraday', '>= 2.0'
589
+
```
590
+
591
+
The `MCP::Client::Http` class provides a simple HTTP client for interacting with MCP servers:
0 commit comments