actionmcp 0.204.0 → 0.204.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: edba9f6e7fb44d50ce86d427dd70563912086d2be58af1a83f13c23fb1f5e59c
4
- data.tar.gz: 327812b7d2f8eab4129d51a0faca042b5ebb12b7e23039842576b0050f77fff5
3
+ metadata.gz: e87098ac26a00a8998c10e8c11b51cb82a832e08a6566bba6a1ddc4a8075236a
4
+ data.tar.gz: 3a0d8e7c32add4999b52c854851581b3db20bc579ca909cecfe8f1a4e1681b46
5
5
  SHA512:
6
- metadata.gz: ea95cc8623b3bf0db8f95d16198beddd546a4b47936a43cd7a7872d2a7bf1f4509cb6220cdd20e2f973dd20a9380c5d0220f4085915af8e80a1cdc3bdf962943
7
- data.tar.gz: 52191be9e6f67efed42bf4045ec1f9499ed45bdae5862f77ecde32b991c9e924b51e59f4b304f5d174023e6ccbaf4e614e8c31d2acc3b84fe962566bd46028f6
6
+ metadata.gz: 0e242930cdfc8e155c386190faaa01acf0abcb1f03639ab41511d9349454de5f0d74a790bd0f96325cd16bb8d1f32df0cb8ec48d8d680e6fdcd0d9d1bbb7d7f6
7
+ data.tar.gz: 26f2cafb16cb69f115b8038fb10eda0e0fd904c41d1d2c2f302401f99b730636f46a1a9b4af1abc85dfa6f3e40297aacaa7eb2fb788544a39054210640c62a7a
@@ -52,6 +52,7 @@ module ActionMCP
52
52
  # Resolves the stable URI declared by a tool to the content-addressed
53
53
  # resource URI currently registered from the compiled views manifest.
54
54
  def resolve_resource_uri(uri)
55
+ ActionMCP.configuration.load_deferred_mcp_components
55
56
  (@resource_uri_aliases || {}).fetch(uri, uri)
56
57
  end
57
58
 
@@ -348,13 +348,14 @@ module ActionMCP
348
348
  ensure_mcp_components_loaded if mcp_components_load_needed?
349
349
  end
350
350
 
351
- # Loading app/mcp inside initialize! drags every model the tools reference into boot.
351
+ # Loading app/mcp or the views inside initialize! drags ActiveModel and every
352
+ # model the tools reference into boot.
352
353
  def prepare_mcp_components
353
354
  if defer_mcp_components_load?
354
- @mcp_components_state = (:deferred if mcp_components_load_needed?)
355
+ @mcp_components_state = (:deferred if mcp_components_load_needed? || mcp_apps_enabled)
355
356
  else
356
357
  @mcp_components_state = nil
357
- eager_load_if_needed
358
+ load_mcp_components
358
359
  end
359
360
  end
360
361
 
@@ -371,7 +372,7 @@ module ActionMCP
371
372
 
372
373
  @mcp_components_state = :loading
373
374
  begin
374
- ensure_mcp_components_loaded
375
+ load_mcp_components
375
376
  @mcp_components_state = nil
376
377
  ensure
377
378
  @mcp_components_state = :deferred if @mcp_components_state == :loading
@@ -381,6 +382,12 @@ module ActionMCP
381
382
 
382
383
  private
383
384
 
385
+ # Views register after app/mcp so rebuilt manifests replace stale templates on dev reloads.
386
+ def load_mcp_components
387
+ eager_load_if_needed
388
+ Apps::ViewManifest.load! if mcp_apps_enabled
389
+ end
390
+
384
391
  def defer_mcp_components_load?
385
392
  !Rails.configuration.eager_load && !Rails.application.initialized?
386
393
  end
@@ -43,22 +43,16 @@ module ActionMCP
43
43
  end
44
44
 
45
45
  config.to_prepare do
46
- # Only clear registries if we're in development mode
47
- if Rails.env.development?
46
+ # Clear registries on development reloads; the boot-time prepare has nothing to clear
47
+ if Rails.env.development? && Rails.application.initialized?
48
48
  ActionMCP::ResourceTemplate.registered_templates.clear
49
49
  ActionMCP::ToolsRegistry.clear!
50
50
  ActionMCP::PromptsRegistry.clear!
51
51
  end
52
52
 
53
- # Eager load MCP components if profile includes "all". Booting without
54
- # eager loading defers them to the first registry read instead.
53
+ # Loads app/mcp (profile "all") and then the compiled MCP Apps views.
54
+ # Booting without eager loading defers both to the first registry read.
55
55
  ActionMCP.configuration.prepare_mcp_components
56
-
57
- # Register compiled MCP Apps views after registries
58
- # are (re)built. Runs on each dev reload so rebuilt view bundles/hashes
59
- # are picked up without restarting the server; runs once at boot in
60
- # production.
61
- ActionMCP::Apps::ViewManifest.load! if ActionMCP.configuration.mcp_apps_enabled
62
56
  end
63
57
 
64
58
  initializer "action_mcp.insert_middleware" do |app|
@@ -87,14 +81,6 @@ module ActionMCP
87
81
 
88
82
  # Configure autoloading for the mcp/tools directory and identifiers
89
83
  initializer "action_mcp.autoloading", before: :set_autoload_paths do |app|
90
- # Ensure ActionMCP base constants exist before Zeitwerk indexes app/mcp
91
- # This prevents NameError when dependent gems have app/mcp
92
- # directories with classes inheriting from ActionMCP::Tool, etc.
93
- require "action_mcp/tool"
94
- require "action_mcp/prompt"
95
- require "action_mcp/resource_template"
96
- require "action_mcp/gateway"
97
-
98
84
  mcp_path = app.root.join("app/mcp")
99
85
  identifiers_path = app.root.join("app/identifiers")
100
86
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative "gem_version"
4
4
  module ActionMCP
5
- VERSION = "0.204.0"
5
+ VERSION = "0.204.1"
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.204.0
4
+ version: 0.204.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdelkader Boudih