actionmcp 0.50.1 → 0.50.2
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/app/controllers/action_mcp/unified_controller.rb +39 -58
- data/app/models/action_mcp/session/message.rb +25 -16
- data/app/models/action_mcp/session/sse_event.rb +1 -0
- data/app/models/action_mcp/session.rb +31 -27
- data/app/models/concerns/mcp_console_helpers.rb +3 -3
- data/app/models/concerns/mcp_message_inspect.rb +4 -4
- data/db/migrate/20250512154359_consolidated_migration.rb +28 -27
- data/exe/actionmcp_cli +1 -1
- data/lib/action_mcp/client.rb +4 -4
- data/lib/action_mcp/engine.rb +27 -0
- data/lib/action_mcp/instrumentation/controller_runtime.rb +1 -1
- data/lib/action_mcp/json_rpc_handler_base.rb +1 -0
- data/lib/action_mcp/log_subscriber.rb +160 -0
- data/lib/action_mcp/resource_template.rb +1 -3
- data/lib/action_mcp/server/capabilities.rb +11 -8
- data/lib/action_mcp/server/configuration.rb +5 -2
- data/lib/action_mcp/server/json_rpc_handler.rb +155 -88
- data/lib/action_mcp/server/registry_management.rb +2 -0
- data/lib/action_mcp/server/simple_pub_sub.rb +7 -6
- data/lib/action_mcp/server/solid_cable_adapter.rb +12 -13
- data/lib/action_mcp/server/tools.rb +2 -2
- data/lib/action_mcp/server.rb +5 -4
- data/lib/action_mcp/tool.rb +1 -1
- data/lib/action_mcp/version.rb +1 -1
- metadata +20 -17
@@ -39,13 +39,13 @@ module ActionMCP
|
|
39
39
|
DEFAULT_MIN_THREADS = 5
|
40
40
|
DEFAULT_MAX_THREADS = 10
|
41
41
|
DEFAULT_MAX_QUEUE = 100
|
42
|
-
DEFAULT_THREAD_TIMEOUT = 60
|
42
|
+
DEFAULT_THREAD_TIMEOUT = 60 # seconds
|
43
43
|
|
44
44
|
def initialize(options = {})
|
45
45
|
@options = options
|
46
46
|
@subscriptions = Concurrent::Map.new
|
47
47
|
@channels = Concurrent::Map.new
|
48
|
-
@channel_subscribed = Concurrent::Map.new
|
48
|
+
@channel_subscribed = Concurrent::Map.new # Track channel subscription status
|
49
49
|
|
50
50
|
# Initialize thread pool for callbacks
|
51
51
|
pool_options = {
|
@@ -69,15 +69,13 @@ module ActionMCP
|
|
69
69
|
end
|
70
70
|
|
71
71
|
# If there's a connects_to option, pass it along
|
72
|
-
if @options["connects_to"]
|
73
|
-
pubsub_options[:connects_to] = @options["connects_to"]
|
74
|
-
end
|
72
|
+
pubsub_options[:connects_to] = @options["connects_to"] if @options["connects_to"]
|
75
73
|
|
76
74
|
# Use mock version for testing or real version in production
|
77
|
-
if defined?(SolidCable) && !testing?
|
78
|
-
|
75
|
+
@solid_cable_pubsub = if defined?(SolidCable) && !testing?
|
76
|
+
SolidCable::PubSub.new(pubsub_options)
|
79
77
|
else
|
80
|
-
|
78
|
+
MockSolidCablePubSub.new(pubsub_options)
|
81
79
|
end
|
82
80
|
end
|
83
81
|
|
@@ -147,6 +145,7 @@ module ActionMCP
|
|
147
145
|
def has_subscribers?(channel)
|
148
146
|
subscribers = @channels[channel]
|
149
147
|
return false unless subscribers
|
148
|
+
|
150
149
|
!subscribers.empty?
|
151
150
|
end
|
152
151
|
|
@@ -156,6 +155,7 @@ module ActionMCP
|
|
156
155
|
def subscribed_to?(channel)
|
157
156
|
channel_subs = @channels[channel]
|
158
157
|
return false if channel_subs.nil?
|
158
|
+
|
159
159
|
!channel_subs.empty?
|
160
160
|
end
|
161
161
|
|
@@ -185,11 +185,9 @@ module ActionMCP
|
|
185
185
|
next unless subscription && subscription[:message_callback]
|
186
186
|
|
187
187
|
@thread_pool.post do
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
log_error("Error in message callback: #{e.message}\n#{e.backtrace.join("\n")}")
|
192
|
-
end
|
188
|
+
subscription[:message_callback].call(message)
|
189
|
+
rescue StandardError => e
|
190
|
+
log_error("Error in message callback: #{e.message}\n#{e.backtrace.join("\n")}")
|
193
191
|
end
|
194
192
|
end
|
195
193
|
end
|
@@ -215,6 +213,7 @@ module ActionMCP
|
|
215
213
|
|
216
214
|
def log_error(message)
|
217
215
|
return unless defined?(Rails) && Rails.respond_to?(:logger)
|
216
|
+
|
218
217
|
Rails.logger.error("SolidCableAdapter: #{message}")
|
219
218
|
end
|
220
219
|
end
|
@@ -18,9 +18,9 @@ module ActionMCP
|
|
18
18
|
end
|
19
19
|
|
20
20
|
# Use session's registered tools instead of global registry
|
21
|
-
tools = session.registered_tools.map
|
21
|
+
tools = session.registered_tools.map do |tool_class|
|
22
22
|
tool_class.to_h(protocol_version: protocol_version)
|
23
|
-
|
23
|
+
end
|
24
24
|
|
25
25
|
# Send completion progress notification if token is provided
|
26
26
|
if progress_token
|
data/lib/action_mcp/server.rb
CHANGED
@@ -23,6 +23,7 @@ module ActionMCP
|
|
23
23
|
# Shut down the server and clean up resources
|
24
24
|
def shutdown
|
25
25
|
return unless @server
|
26
|
+
|
26
27
|
@server.shutdown
|
27
28
|
@server = nil
|
28
29
|
end
|
@@ -49,7 +50,7 @@ module ActionMCP
|
|
49
50
|
def configure(config_path)
|
50
51
|
shutdown_pubsub if @pubsub
|
51
52
|
@configuration = Configuration.new(config_path)
|
52
|
-
@pubsub = nil
|
53
|
+
@pubsub = nil # Reset pubsub so it will be recreated with new config
|
53
54
|
end
|
54
55
|
|
55
56
|
# Gracefully shut down the server and its resources
|
@@ -61,11 +62,11 @@ module ActionMCP
|
|
61
62
|
|
62
63
|
# Shut down the pubsub adapter gracefully
|
63
64
|
def shutdown_pubsub
|
64
|
-
return unless @pubsub
|
65
|
+
return unless @pubsub.respond_to?(:shutdown)
|
65
66
|
|
66
67
|
begin
|
67
68
|
@pubsub.shutdown
|
68
|
-
rescue => e
|
69
|
+
rescue StandardError => e
|
69
70
|
message = "Error shutting down pubsub adapter: #{e.message}"
|
70
71
|
Rails.logger.error(message) if defined?(Rails) && Rails.respond_to?(:logger)
|
71
72
|
ensure
|
@@ -87,7 +88,7 @@ module ActionMCP
|
|
87
88
|
rescue NameError, LoadError => e
|
88
89
|
message = "Error creating adapter #{adapter_name}: #{e.message}"
|
89
90
|
Rails.logger.error(message) if defined?(Rails) && Rails.respond_to?(:logger)
|
90
|
-
SimplePubSub.new
|
91
|
+
SimplePubSub.new # Fallback to simple pubsub
|
91
92
|
end
|
92
93
|
end
|
93
94
|
end
|
data/lib/action_mcp/tool.rb
CHANGED
@@ -61,7 +61,7 @@ module ActionMCP
|
|
61
61
|
end
|
62
62
|
|
63
63
|
# Return annotations for the tool
|
64
|
-
def annotations_for_protocol(
|
64
|
+
def annotations_for_protocol(_protocol_version = nil)
|
65
65
|
# Always include annotations now that we only support 2025+
|
66
66
|
_annotations
|
67
67
|
end
|
data/lib/action_mcp/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actionmcp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.50.
|
4
|
+
version: 0.50.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abdelkader Boudih
|
8
|
+
autorequire:
|
8
9
|
bindir: exe
|
9
10
|
cert_chain: []
|
10
|
-
date:
|
11
|
+
date: 2025-05-14 00:00:00.000000000 Z
|
11
12
|
dependencies:
|
12
13
|
- !ruby/object:Gem::Dependency
|
13
14
|
name: activerecord
|
@@ -23,6 +24,20 @@ dependencies:
|
|
23
24
|
- - ">="
|
24
25
|
- !ruby/object:Gem::Version
|
25
26
|
version: 8.0.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: concurrent-ruby
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.3.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.3.1
|
26
41
|
- !ruby/object:Gem::Dependency
|
27
42
|
name: jsonrpc-rails
|
28
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -79,20 +94,6 @@ dependencies:
|
|
79
94
|
- - "~>"
|
80
95
|
- !ruby/object:Gem::Version
|
81
96
|
version: '2.6'
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
name: concurrent-ruby
|
84
|
-
requirement: !ruby/object:Gem::Requirement
|
85
|
-
requirements:
|
86
|
-
- - ">="
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: 1.3.1
|
89
|
-
type: :runtime
|
90
|
-
prerelease: false
|
91
|
-
version_requirements: !ruby/object:Gem::Requirement
|
92
|
-
requirements:
|
93
|
-
- - ">="
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
version: 1.3.1
|
96
97
|
description: It offers base classes and helpers for creating MCP applications, making
|
97
98
|
it easier to integrate your Ruby/Rails application with the MCP standard
|
98
99
|
email:
|
@@ -214,6 +215,7 @@ metadata:
|
|
214
215
|
source_code_uri: https://github.com/seuros/action_mcp
|
215
216
|
changelog_uri: https://github.com/seuros/action_mcp/blob/master/CHANGELOG.md
|
216
217
|
rubygems_mfa_required: 'true'
|
218
|
+
post_install_message:
|
217
219
|
rdoc_options: []
|
218
220
|
require_paths:
|
219
221
|
- lib
|
@@ -228,7 +230,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
228
230
|
- !ruby/object:Gem::Version
|
229
231
|
version: '0'
|
230
232
|
requirements: []
|
231
|
-
rubygems_version: 3.
|
233
|
+
rubygems_version: 3.5.22
|
234
|
+
signing_key:
|
232
235
|
specification_version: 4
|
233
236
|
summary: Provides essential tooling for building Model Context Protocol (MCP) capable
|
234
237
|
servers
|