actionmcp 0.201.3 → 0.203.0
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 +51 -0
- data/app/controllers/action_mcp/application_controller.rb +21 -36
- data/app/jobs/action_mcp/tool_execution_job.rb +57 -27
- data/app/models/action_mcp/session/task.rb +2 -1
- data/app/models/action_mcp/session.rb +1 -233
- data/lib/action_mcp/callbacks.rb +22 -115
- data/lib/action_mcp/capability.rb +44 -0
- data/lib/action_mcp/configuration.rb +26 -14
- data/lib/action_mcp/content/audio.rb +3 -21
- data/lib/action_mcp/content/base.rb +7 -0
- data/lib/action_mcp/content/binary.rb +30 -0
- data/lib/action_mcp/content/image.rb +3 -21
- data/lib/action_mcp/content/validation.rb +37 -38
- data/lib/action_mcp/content.rb +0 -33
- data/lib/action_mcp/custom_methods.rb +61 -0
- data/lib/action_mcp/dev_reloader.rb +19 -0
- data/lib/action_mcp/lifecycle_callbacks.rb +28 -0
- data/lib/action_mcp/log_subscriber.rb +15 -21
- data/lib/action_mcp/output_schema_builder.rb +18 -31
- data/lib/action_mcp/prompt.rb +8 -59
- data/lib/action_mcp/request_meta.rb +11 -0
- data/lib/action_mcp/resource_callbacks.rb +22 -149
- data/lib/action_mcp/resource_response.rb +3 -7
- data/lib/action_mcp/resource_template.rb +1 -0
- data/lib/action_mcp/schema_context.rb +50 -0
- data/lib/action_mcp/server/base_session.rb +7 -173
- data/lib/action_mcp/server/handlers/dispatching.rb +38 -0
- data/lib/action_mcp/server/handlers/prompt_handler.rb +6 -12
- data/lib/action_mcp/server/handlers/resource_handler.rb +6 -23
- data/lib/action_mcp/server/handlers/task_handler.rb +14 -31
- data/lib/action_mcp/server/handlers/tool_handler.rb +4 -11
- data/lib/action_mcp/server/json_rpc_handler.rb +17 -1
- data/lib/action_mcp/server/prompts.rb +8 -17
- data/lib/action_mcp/server/resources.rb +4 -28
- data/lib/action_mcp/server/result_response.rb +19 -0
- data/lib/action_mcp/server/sampling_request.rb +26 -43
- data/lib/action_mcp/server/session_registries.rb +127 -0
- data/lib/action_mcp/server/tools.rb +23 -33
- data/lib/action_mcp/server/transport_handler.rb +0 -6
- data/lib/action_mcp/tagged_stream_logging.rb +9 -5
- data/lib/action_mcp/tool.rb +67 -71
- data/lib/action_mcp/version.rb +1 -1
- data/lib/action_mcp.rb +4 -0
- data/lib/tasks/action_mcp_tasks.rake +22 -44
- metadata +11 -3
- data/lib/action_mcp/server/handlers/router.rb +0 -33
data/lib/action_mcp/version.rb
CHANGED
data/lib/action_mcp.rb
CHANGED
|
@@ -33,6 +33,10 @@ module ActionMCP
|
|
|
33
33
|
# Error raised when structured content doesn't match the declared output_schema
|
|
34
34
|
class StructuredContentValidationError < StandardError; end
|
|
35
35
|
|
|
36
|
+
# Raised when a schema keyword proc fails while a tool schema is built.
|
|
37
|
+
# The tool is left out of tools/list and answers tools/call as unavailable.
|
|
38
|
+
class SchemaResolutionError < StandardError; end
|
|
39
|
+
|
|
36
40
|
# Protocol version constants
|
|
37
41
|
SUPPORTED_VERSIONS = [ "2025-11-25" ].freeze
|
|
38
42
|
|
|
@@ -1,61 +1,43 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
namespace :action_mcp do
|
|
4
|
-
#
|
|
5
|
-
|
|
6
|
-
task list_tools: :environment do
|
|
7
|
-
# Ensure Rails eager loads all classes
|
|
4
|
+
# Prints one registry's non-abstract entries under a coloured heading.
|
|
5
|
+
print_registry = lambda do |title, color, registry, &details|
|
|
8
6
|
Rails.application.eager_load!
|
|
9
7
|
|
|
10
|
-
puts "\e[
|
|
11
|
-
puts "\e[
|
|
12
|
-
|
|
13
|
-
if
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
puts "\e[#{color}m#{title}\e[0m"
|
|
9
|
+
puts "\e[#{color}m#{'-' * (title.length - 1)}\e[0m"
|
|
10
|
+
entries = registry.non_abstract.sort_by(&:name)
|
|
11
|
+
if entries.any?
|
|
12
|
+
entries.each do |entry|
|
|
13
|
+
line = "\e[#{color}m#{entry.name}:\e[0m #{entry.description}"
|
|
14
|
+
line += " : #{details.call(entry)}" if details
|
|
15
|
+
puts line
|
|
16
16
|
end
|
|
17
17
|
else
|
|
18
|
-
puts " No
|
|
18
|
+
puts " No #{title.split.last.downcase} registered"
|
|
19
19
|
end
|
|
20
20
|
puts "\n"
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
+
# bin/rails action_mcp:list_tools
|
|
24
|
+
desc "List all tools with their names and descriptions"
|
|
25
|
+
task list_tools: :environment do
|
|
26
|
+
print_registry.call("ACTION MCP TOOLS", 34, ActionMCP::ToolsRegistry)
|
|
27
|
+
end
|
|
28
|
+
|
|
23
29
|
# bin/rails action_mcp:list_prompts
|
|
24
30
|
desc "List all prompts with their names and descriptions"
|
|
25
31
|
task list_prompts: :environment do
|
|
26
|
-
|
|
27
|
-
Rails.application.eager_load!
|
|
28
|
-
|
|
29
|
-
puts "\e[32mACTION MCP PROMPTS\e[0m" # Green
|
|
30
|
-
puts "\e[32m-----------------\e[0m" # Green
|
|
31
|
-
prompts = ActionMCP::PromptsRegistry.non_abstract.sort_by(&:name)
|
|
32
|
-
if prompts.any?
|
|
33
|
-
prompts.each do |prompt|
|
|
34
|
-
puts "\e[32m#{prompt.name}:\e[0m #{prompt.description}" # Green name
|
|
35
|
-
end
|
|
36
|
-
else
|
|
37
|
-
puts " No prompts registered"
|
|
38
|
-
end
|
|
39
|
-
puts "\n"
|
|
32
|
+
print_registry.call("ACTION MCP PROMPTS", 32, ActionMCP::PromptsRegistry)
|
|
40
33
|
end
|
|
41
34
|
|
|
42
35
|
# bin/rails action_mcp:list_resources
|
|
43
36
|
desc "List all resources with their names and descriptions"
|
|
44
37
|
task list_resources: :environment do
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
puts "\e[33mACTION MCP RESOURCES\e[0m" # Yellow
|
|
49
|
-
puts "\e[33m--------------------\e[0m" # Yellow
|
|
50
|
-
resources = ActionMCP::ResourceTemplatesRegistry.non_abstract.sort_by(&:name)
|
|
51
|
-
if resources.any?
|
|
52
|
-
resources.each do |resource|
|
|
53
|
-
puts "\e[33m#{resource.name}:\e[0m #{resource.description} : #{resource.klass.uri_template}" # Yellow name
|
|
54
|
-
end
|
|
55
|
-
else
|
|
56
|
-
puts " No resources registered"
|
|
38
|
+
print_registry.call("ACTION MCP RESOURCES", 33, ActionMCP::ResourceTemplatesRegistry) do |resource|
|
|
39
|
+
resource.klass.uri_template
|
|
57
40
|
end
|
|
58
|
-
puts "\n"
|
|
59
41
|
end
|
|
60
42
|
|
|
61
43
|
# bin/rails action_mcp:list_widgets
|
|
@@ -198,9 +180,7 @@ namespace :action_mcp do
|
|
|
198
180
|
# Show Capabilities
|
|
199
181
|
puts "\n\e[36mActive Capabilities:\e[0m" # Cyan
|
|
200
182
|
capabilities = ActionMCP.configuration.capabilities
|
|
201
|
-
capabilities.each
|
|
202
|
-
puts " #{cap_name}: #{cap_config.inspect}"
|
|
203
|
-
end
|
|
183
|
+
capabilities.each { |name, config| puts " #{name}: #{config.inspect}" }
|
|
204
184
|
end
|
|
205
185
|
|
|
206
186
|
puts "\n"
|
|
@@ -273,9 +253,7 @@ namespace :action_mcp do
|
|
|
273
253
|
puts "\n\e[36mEnabled Capabilities:\e[0m"
|
|
274
254
|
capabilities = config.capabilities
|
|
275
255
|
if capabilities.any?
|
|
276
|
-
capabilities.each
|
|
277
|
-
puts " #{cap_name}: #{cap_config.inspect}"
|
|
278
|
-
end
|
|
256
|
+
capabilities.each { |name, config| puts " #{name}: #{config.inspect}" }
|
|
279
257
|
else
|
|
280
258
|
puts " None"
|
|
281
259
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: actionmcp
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.203.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Abdelkader Boudih
|
|
@@ -196,6 +196,7 @@ files:
|
|
|
196
196
|
- lib/action_mcp/content.rb
|
|
197
197
|
- lib/action_mcp/content/audio.rb
|
|
198
198
|
- lib/action_mcp/content/base.rb
|
|
199
|
+
- lib/action_mcp/content/binary.rb
|
|
199
200
|
- lib/action_mcp/content/image.rb
|
|
200
201
|
- lib/action_mcp/content/resource.rb
|
|
201
202
|
- lib/action_mcp/content/resource_link.rb
|
|
@@ -203,7 +204,9 @@ files:
|
|
|
203
204
|
- lib/action_mcp/content/validation.rb
|
|
204
205
|
- lib/action_mcp/current.rb
|
|
205
206
|
- lib/action_mcp/current_helpers.rb
|
|
207
|
+
- lib/action_mcp/custom_methods.rb
|
|
206
208
|
- lib/action_mcp/dev/runner.rb
|
|
209
|
+
- lib/action_mcp/dev_reloader.rb
|
|
207
210
|
- lib/action_mcp/engine.rb
|
|
208
211
|
- lib/action_mcp/filtered_logger.rb
|
|
209
212
|
- lib/action_mcp/gateway.rb
|
|
@@ -219,6 +222,7 @@ files:
|
|
|
219
222
|
- lib/action_mcp/instrumentation/resource_instrumentation.rb
|
|
220
223
|
- lib/action_mcp/integer_array.rb
|
|
221
224
|
- lib/action_mcp/json_rpc_handler_base.rb
|
|
225
|
+
- lib/action_mcp/lifecycle_callbacks.rb
|
|
222
226
|
- lib/action_mcp/log_subscriber.rb
|
|
223
227
|
- lib/action_mcp/logging.rb
|
|
224
228
|
- lib/action_mcp/logging/level.rb
|
|
@@ -235,11 +239,13 @@ files:
|
|
|
235
239
|
- lib/action_mcp/protocol_validator.rb
|
|
236
240
|
- lib/action_mcp/registry_base.rb
|
|
237
241
|
- lib/action_mcp/renderable.rb
|
|
242
|
+
- lib/action_mcp/request_meta.rb
|
|
238
243
|
- lib/action_mcp/resource.rb
|
|
239
244
|
- lib/action_mcp/resource_callbacks.rb
|
|
240
245
|
- lib/action_mcp/resource_response.rb
|
|
241
246
|
- lib/action_mcp/resource_template.rb
|
|
242
247
|
- lib/action_mcp/resource_templates_registry.rb
|
|
248
|
+
- lib/action_mcp/schema_context.rb
|
|
243
249
|
- lib/action_mcp/schema_helpers.rb
|
|
244
250
|
- lib/action_mcp/schema_validator.rb
|
|
245
251
|
- lib/action_mcp/server.rb
|
|
@@ -254,10 +260,10 @@ files:
|
|
|
254
260
|
- lib/action_mcp/server/elicitation_request.rb
|
|
255
261
|
- lib/action_mcp/server/error_aware.rb
|
|
256
262
|
- lib/action_mcp/server/error_handling.rb
|
|
263
|
+
- lib/action_mcp/server/handlers/dispatching.rb
|
|
257
264
|
- lib/action_mcp/server/handlers/logging_handler.rb
|
|
258
265
|
- lib/action_mcp/server/handlers/prompt_handler.rb
|
|
259
266
|
- lib/action_mcp/server/handlers/resource_handler.rb
|
|
260
|
-
- lib/action_mcp/server/handlers/router.rb
|
|
261
267
|
- lib/action_mcp/server/handlers/task_handler.rb
|
|
262
268
|
- lib/action_mcp/server/handlers/tool_handler.rb
|
|
263
269
|
- lib/action_mcp/server/json_rpc_handler.rb
|
|
@@ -267,9 +273,11 @@ files:
|
|
|
267
273
|
- lib/action_mcp/server/registry_management.rb
|
|
268
274
|
- lib/action_mcp/server/resources.rb
|
|
269
275
|
- lib/action_mcp/server/response_collector.rb
|
|
276
|
+
- lib/action_mcp/server/result_response.rb
|
|
270
277
|
- lib/action_mcp/server/roots.rb
|
|
271
278
|
- lib/action_mcp/server/sampling.rb
|
|
272
279
|
- lib/action_mcp/server/sampling_request.rb
|
|
280
|
+
- lib/action_mcp/server/session_registries.rb
|
|
273
281
|
- lib/action_mcp/server/session_store.rb
|
|
274
282
|
- lib/action_mcp/server/session_store_factory.rb
|
|
275
283
|
- lib/action_mcp/server/tasks.rb
|
|
@@ -337,7 +345,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
337
345
|
- !ruby/object:Gem::Version
|
|
338
346
|
version: '0'
|
|
339
347
|
requirements: []
|
|
340
|
-
rubygems_version: 4.0.
|
|
348
|
+
rubygems_version: 4.0.20
|
|
341
349
|
specification_version: 4
|
|
342
350
|
summary: Lightweight Model Context Protocol (MCP) server toolkit for Ruby/Rails
|
|
343
351
|
test_files: []
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module ActionMCP
|
|
4
|
-
module Server
|
|
5
|
-
module Handlers
|
|
6
|
-
class Router
|
|
7
|
-
def initialize(handler)
|
|
8
|
-
@handler = handler
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def route(rpc_method, id, params)
|
|
12
|
-
case rpc_method
|
|
13
|
-
when "initialize"
|
|
14
|
-
@handler.handle_initialize(id, params)
|
|
15
|
-
when %r{^prompts/}
|
|
16
|
-
@handler.process_prompts(rpc_method, id, params)
|
|
17
|
-
when %r{^resources/}
|
|
18
|
-
@handler.process_resources(rpc_method, id, params)
|
|
19
|
-
when %r{^tools/}
|
|
20
|
-
@handler.process_tools(rpc_method, id, params)
|
|
21
|
-
when %r{^tasks/}
|
|
22
|
-
@handler.process_tasks(rpc_method, id, params)
|
|
23
|
-
when "completion/complete"
|
|
24
|
-
@handler.process_completion_complete(id, params)
|
|
25
|
-
else
|
|
26
|
-
raise ActionMCP::Server::JSON_RPC::JsonRpcError.new(:method_not_found,
|
|
27
|
-
message: "Method not found: #{rpc_method}")
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|