ruby-mcp-client 0.9.1 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +42 -6
- data/lib/mcp_client/audio_content.rb +46 -0
- data/lib/mcp_client/auth/oauth_provider.rb +29 -6
- data/lib/mcp_client/auth.rb +68 -8
- data/lib/mcp_client/client.rb +265 -54
- data/lib/mcp_client/elicitation_validator.rb +262 -0
- data/lib/mcp_client/errors.rb +6 -0
- data/lib/mcp_client/http_transport_base.rb +2 -0
- data/lib/mcp_client/json_rpc_common.rb +3 -3
- data/lib/mcp_client/resource.rb +8 -0
- data/lib/mcp_client/resource_link.rb +63 -0
- data/lib/mcp_client/server_http.rb +17 -7
- data/lib/mcp_client/server_sse.rb +9 -6
- data/lib/mcp_client/server_stdio.rb +9 -6
- data/lib/mcp_client/server_streamable_http.rb +23 -10
- data/lib/mcp_client/task.rb +127 -0
- data/lib/mcp_client/tool.rb +73 -9
- data/lib/mcp_client/version.rb +2 -2
- data/lib/mcp_client.rb +27 -0
- metadata +8 -4
data/lib/mcp_client.rb
CHANGED
|
@@ -7,7 +7,11 @@ require_relative 'mcp_client/prompt'
|
|
|
7
7
|
require_relative 'mcp_client/resource'
|
|
8
8
|
require_relative 'mcp_client/resource_template'
|
|
9
9
|
require_relative 'mcp_client/resource_content'
|
|
10
|
+
require_relative 'mcp_client/audio_content'
|
|
11
|
+
require_relative 'mcp_client/resource_link'
|
|
10
12
|
require_relative 'mcp_client/root'
|
|
13
|
+
require_relative 'mcp_client/elicitation_validator'
|
|
14
|
+
require_relative 'mcp_client/task'
|
|
11
15
|
require_relative 'mcp_client/server_base'
|
|
12
16
|
require_relative 'mcp_client/server_stdio'
|
|
13
17
|
require_relative 'mcp_client/server_sse'
|
|
@@ -466,4 +470,27 @@ module MCPClient
|
|
|
466
470
|
faraday_config: faraday_config
|
|
467
471
|
}
|
|
468
472
|
end
|
|
473
|
+
|
|
474
|
+
# Parse a single content item from a tool result into a typed object
|
|
475
|
+
# Recognizes 'resource_link' type and returns an MCPClient::ResourceLink.
|
|
476
|
+
# Unrecognized types are returned as-is (the original Hash).
|
|
477
|
+
# @param item [Hash] a content item with a 'type' field
|
|
478
|
+
# @return [MCPClient::ResourceLink, Hash] typed object or raw hash
|
|
479
|
+
def self.parse_content_item(item)
|
|
480
|
+
case item['type']
|
|
481
|
+
when 'resource_link'
|
|
482
|
+
ResourceLink.from_json(item)
|
|
483
|
+
else
|
|
484
|
+
item
|
|
485
|
+
end
|
|
486
|
+
end
|
|
487
|
+
|
|
488
|
+
# Parse the content array from a tool result into typed objects
|
|
489
|
+
# Each item with type 'resource_link' is converted to an MCPClient::ResourceLink.
|
|
490
|
+
# Other items are returned as-is.
|
|
491
|
+
# @param content [Array<Hash>] content array from a tool result
|
|
492
|
+
# @return [Array<MCPClient::ResourceLink, Hash>] array of typed objects or raw hashes
|
|
493
|
+
def self.parse_tool_content(content)
|
|
494
|
+
Array(content).map { |item| parse_content_item(item) }
|
|
495
|
+
end
|
|
469
496
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby-mcp-client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Szymon Kurcab
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-03-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -58,14 +58,14 @@ dependencies:
|
|
|
58
58
|
requirements:
|
|
59
59
|
- - "~>"
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '
|
|
61
|
+
version: '7.0'
|
|
62
62
|
type: :development
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
66
|
- - "~>"
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '
|
|
68
|
+
version: '7.0'
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
70
|
name: rspec
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -119,11 +119,13 @@ files:
|
|
|
119
119
|
- LICENSE
|
|
120
120
|
- README.md
|
|
121
121
|
- lib/mcp_client.rb
|
|
122
|
+
- lib/mcp_client/audio_content.rb
|
|
122
123
|
- lib/mcp_client/auth.rb
|
|
123
124
|
- lib/mcp_client/auth/browser_oauth.rb
|
|
124
125
|
- lib/mcp_client/auth/oauth_provider.rb
|
|
125
126
|
- lib/mcp_client/client.rb
|
|
126
127
|
- lib/mcp_client/config_parser.rb
|
|
128
|
+
- lib/mcp_client/elicitation_validator.rb
|
|
127
129
|
- lib/mcp_client/errors.rb
|
|
128
130
|
- lib/mcp_client/http_transport_base.rb
|
|
129
131
|
- lib/mcp_client/json_rpc_common.rb
|
|
@@ -131,6 +133,7 @@ files:
|
|
|
131
133
|
- lib/mcp_client/prompt.rb
|
|
132
134
|
- lib/mcp_client/resource.rb
|
|
133
135
|
- lib/mcp_client/resource_content.rb
|
|
136
|
+
- lib/mcp_client/resource_link.rb
|
|
134
137
|
- lib/mcp_client/resource_template.rb
|
|
135
138
|
- lib/mcp_client/root.rb
|
|
136
139
|
- lib/mcp_client/server_base.rb
|
|
@@ -145,6 +148,7 @@ files:
|
|
|
145
148
|
- lib/mcp_client/server_stdio/json_rpc_transport.rb
|
|
146
149
|
- lib/mcp_client/server_streamable_http.rb
|
|
147
150
|
- lib/mcp_client/server_streamable_http/json_rpc_transport.rb
|
|
151
|
+
- lib/mcp_client/task.rb
|
|
148
152
|
- lib/mcp_client/tool.rb
|
|
149
153
|
- lib/mcp_client/version.rb
|
|
150
154
|
homepage: https://github.com/simonx1/ruby-mcp-client
|