actionmcp 0.83.1 → 0.83.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/models/action_mcp/session.rb +16 -0
- data/lib/action_mcp/configuration.rb +7 -4
- data/lib/action_mcp/gateway.rb +21 -0
- data/lib/action_mcp/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7a91639193cbd4c38f5bd9ca6932c7368a4fc6c23b6b09252900a7f456c0d937
|
|
4
|
+
data.tar.gz: 695b569c3dc9629a7927e658eba3a4f22be69d1c0d416edf973818541b47ee34
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: de97090f3157012ed6038d3b071a6b7977fab5b50c1e72f2bdb0b5e5c849e61e014c86412f8d36731ce691d230dd250ed3891d15adfd370c7851e7732cc4bab4
|
|
7
|
+
data.tar.gz: f3d4b289c41574a7686c5dff431b0339034cd2ac40dd0570144bfddd08f36595663174d272341fc97504fc02851e45b1e6142fe5c84c2d43ad8bbeb4fc386348
|
|
@@ -147,6 +147,14 @@ module ActionMCP
|
|
|
147
147
|
}
|
|
148
148
|
end
|
|
149
149
|
|
|
150
|
+
def server_capabilities
|
|
151
|
+
parsed_json_attribute(super)
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
def server_capabilities=(value)
|
|
155
|
+
super(parsed_json_attribute(value))
|
|
156
|
+
end
|
|
157
|
+
|
|
150
158
|
def initialize!
|
|
151
159
|
# update the session initialized to true
|
|
152
160
|
return false if initialized?
|
|
@@ -489,5 +497,13 @@ module ActionMCP
|
|
|
489
497
|
|
|
490
498
|
write(JSON_RPC::Notification.new(method: "notifications/resources/list_changed"))
|
|
491
499
|
end
|
|
500
|
+
|
|
501
|
+
def parsed_json_attribute(value)
|
|
502
|
+
return value unless value.is_a?(String)
|
|
503
|
+
|
|
504
|
+
JSON.parse(value)
|
|
505
|
+
rescue JSON::ParserError
|
|
506
|
+
value
|
|
507
|
+
end
|
|
492
508
|
end
|
|
493
509
|
end
|
|
@@ -71,8 +71,7 @@ module ActionMCP
|
|
|
71
71
|
@sse_event_retention_period = 15.minutes
|
|
72
72
|
@max_stored_sse_events = 100
|
|
73
73
|
|
|
74
|
-
# Gateway -
|
|
75
|
-
@gateway_class = defined?(::ApplicationGateway) ? ::ApplicationGateway : ActionMCP::Gateway
|
|
74
|
+
# Gateway - resolved lazily to account for Zeitwerk autoloading
|
|
76
75
|
@gateway_class_name = nil
|
|
77
76
|
|
|
78
77
|
# Session Store
|
|
@@ -90,11 +89,15 @@ module ActionMCP
|
|
|
90
89
|
end
|
|
91
90
|
|
|
92
91
|
def gateway_class
|
|
92
|
+
# Resolve gateway class lazily to account for Zeitwerk autoloading
|
|
93
|
+
# This allows ApplicationGateway to be loaded from app/mcp even if the
|
|
94
|
+
# configuration is initialized before Zeitwerk runs
|
|
93
95
|
if @gateway_class_name
|
|
94
96
|
@gateway_class_name.constantize
|
|
95
|
-
|
|
97
|
+
elsif defined?(::ApplicationGateway)
|
|
98
|
+
::ApplicationGateway
|
|
96
99
|
else
|
|
97
|
-
|
|
100
|
+
ActionMCP::Gateway
|
|
98
101
|
end
|
|
99
102
|
end
|
|
100
103
|
|
data/lib/action_mcp/gateway.rb
CHANGED
|
@@ -28,6 +28,7 @@ module ActionMCP
|
|
|
28
28
|
def call
|
|
29
29
|
identities = authenticate!
|
|
30
30
|
assign_identities(identities)
|
|
31
|
+
apply_profile_from_authentication(identities)
|
|
31
32
|
self
|
|
32
33
|
end
|
|
33
34
|
|
|
@@ -93,5 +94,25 @@ module ActionMCP
|
|
|
93
94
|
ActionMCP::Current.gateway = self if
|
|
94
95
|
ActionMCP::Current.respond_to?(:gateway=)
|
|
95
96
|
end
|
|
97
|
+
|
|
98
|
+
# Hook called after authentication to allow profile switching based on authenticated identities
|
|
99
|
+
# Override in subclass to implement custom profile switching logic
|
|
100
|
+
#
|
|
101
|
+
# Example:
|
|
102
|
+
#
|
|
103
|
+
# class MyGateway < ActionMCP::Gateway
|
|
104
|
+
# def apply_profile_from_authentication(identities)
|
|
105
|
+
# if user&.admin?
|
|
106
|
+
# use_profile(:admin)
|
|
107
|
+
# else
|
|
108
|
+
# use_profile(:minimal)
|
|
109
|
+
# end
|
|
110
|
+
# end
|
|
111
|
+
# end
|
|
112
|
+
#
|
|
113
|
+
# @param identities [Hash] The authenticated identities from authenticate!
|
|
114
|
+
def apply_profile_from_authentication(identities)
|
|
115
|
+
# Default: do nothing. Override in subclass if you want profile switching.
|
|
116
|
+
end
|
|
96
117
|
end
|
|
97
118
|
end
|
data/lib/action_mcp/version.rb
CHANGED