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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 34a7a67e4f2e58c82a8a06bb11adf328747ed61a38e4c06598b21657556b8779
4
- data.tar.gz: 0a81e9eaec25dc3906a9476fff4c9458da889fd201cb644b46ba1074ea46d5ad
3
+ metadata.gz: 7a91639193cbd4c38f5bd9ca6932c7368a4fc6c23b6b09252900a7f456c0d937
4
+ data.tar.gz: 695b569c3dc9629a7927e658eba3a4f22be69d1c0d416edf973818541b47ee34
5
5
  SHA512:
6
- metadata.gz: 76e455eefa6f0fb9c055d4a799ba38f09993c7562746733c05e15e8bc256df112e24788989dce2dbe0bfa290b77eedc54f89a480422a6805050bde18fbb51d2f
7
- data.tar.gz: 8c2fb33e02738de33451097b92c743acf053bdd759be14380fd62a098153b59a925aa8b7f490908457835d9cdb5de903a07e6d1bfe0b741aebe6f28ce64185b5
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 - default to ApplicationGateway if it exists, otherwise ActionMCP::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
- @gateway_class
100
+ ActionMCP::Gateway
98
101
  end
99
102
  end
100
103
 
@@ -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
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative "gem_version"
4
4
  module ActionMCP
5
- VERSION = "0.83.1"
5
+ VERSION = "0.83.2"
6
6
 
7
7
  class << self
8
8
  alias version gem_version
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.83.1
4
+ version: 0.83.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdelkader Boudih