actionmcp 0.53.0 → 0.54.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 961fd09ccf447057085e6e63d38c64079b460917d48d70c5ad5dc53ee0c3154f
4
- data.tar.gz: c74e249d91903199a65afa5ecad8ff55bf188aa7e48167742c26aa20396913cf
3
+ metadata.gz: 8f3d6323b7f8ce694050a031c566f30e33d637116e2869cda61fbbaad0702411
4
+ data.tar.gz: ef8bfccea1b3109146b3e490340a44c4a6071e08c6aed3bd72ddecd5fd95638a
5
5
  SHA512:
6
- metadata.gz: 0f3637e231ef5d5f668d548c41a3d71c121946b4002d56faf27b6fe1941e8f5fb2cf3ed70b0bb49a370055124777ef7300bf3bec174cfa2802c321bbd56f95b2
7
- data.tar.gz: d1066a9642357aa64e77e0bcbdfb99205dbbbe27140262d41aa0bc61aad900e007d6da5a0a136ed116e101fba365066184bb16602cff3caed3c755ddfca8d9bc
6
+ metadata.gz: 2665d85224ce5b07a115936d1f1d159b70c8068a8a221e2f196bebd9564b9e753a73acd15b86241b04d277e70dc6dc5db818fecda505cfab9beb999d8483aecb
7
+ data.tar.gz: 56a568c5aca9693534a46d1013a9fdd8cb168a92e10b6c947dc02bb345f0c0a4f5b812edac990ddaa84c0ba589c500d47b7841f22b8542b1f36a120d2c8a1756
data/README.md CHANGED
@@ -476,16 +476,21 @@ This ensures all thread pools are properly terminated and tasks are completed.
476
476
 
477
477
  **ActionMCP** runs as a standalone Rack application. **Do not attempt to mount it in your application's `routes.rb`**—it is not designed to be mounted as an engine at a custom path. When you use `run ActionMCP::Engine` in your `mcp.ru`, the MCP endpoint is always available at the root path (`/`).
478
478
 
479
- ### Installing the Configuration Generator
479
+ ### Installing ActionMCP
480
480
 
481
- ActionMCP includes a generator to help you create the configuration file:
481
+ ActionMCP includes generators to help you set up your project quickly. The install generator creates all necessary base classes and configuration files:
482
482
 
483
483
  ```bash
484
- # Generate the mcp.yml configuration file
485
- bin/rails generate action_mcp:config
484
+ # Install ActionMCP with base classes and configuration
485
+ bin/rails generate action_mcp:install
486
486
  ```
487
487
 
488
- This will create `config/mcp.yml` with example configurations for all environments.
488
+ This will create:
489
+ - `app/mcp/prompts/application_mcp_prompt.rb` - Base prompt class
490
+ - `app/mcp/tools/application_mcp_tool.rb` - Base tool class
491
+ - `app/mcp/resource_templates/application_mcp_res_template.rb` - Base resource template class
492
+ - `app/mcp/application_gateway.rb` - Gateway for authentication
493
+ - `config/mcp.yml` - Configuration file with example settings for all environments
489
494
 
490
495
  > **Note:** Authentication and authorization are not included. You are responsible for securing the endpoint.
491
496
 
@@ -647,14 +652,14 @@ location /mcp/ {
647
652
 
648
653
  ActionMCP includes Rails generators to help you quickly set up your MCP server components.
649
654
 
650
- You can generate the base classes for your MCP Prompt and Tool using the following command:
655
+ First, install ActionMCP to create base classes and configuration:
651
656
 
652
657
  ```bash
653
658
  bin/rails action_mcp:install:migrations # to copy the migrations
654
659
  bin/rails generate action_mcp:install
655
660
  ```
656
661
 
657
- This will create the base application classes in your app directory.
662
+ This will create the base application classes, configuration file, and authentication gateway in your app directory.
658
663
 
659
664
  ### Generate a New Prompt
660
665
 
@@ -4,17 +4,17 @@
4
4
  #
5
5
  # Table name: action_mcp_session_messages
6
6
  #
7
- # id :bigint not null, primary key
8
- # direction(The message recipient) :string default("client"), not null
9
- # is_ping(Whether the message is a ping) :boolean default(FALSE), not null
10
- # message_json :jsonb
11
- # message_type(The type of the message) :string not null
12
- # request_acknowledged :boolean default(FALSE), not null
13
- # request_cancelled :boolean default(FALSE), not null
14
- # created_at :datetime not null
15
- # updated_at :datetime not null
16
- # jsonrpc_id :string
17
- # session_id :string not null
7
+ # id :bigint not null, primary key
8
+ # direction :string default("client"), not null
9
+ # is_ping :boolean default(FALSE), not null
10
+ # message_json :json
11
+ # message_type :string not null
12
+ # request_acknowledged :boolean default(FALSE), not null
13
+ # request_cancelled :boolean default(FALSE), not null
14
+ # created_at :datetime not null
15
+ # updated_at :datetime not null
16
+ # jsonrpc_id :string
17
+ # session_id :string not null
18
18
  #
19
19
  # Indexes
20
20
  #
@@ -22,7 +22,7 @@
22
22
  #
23
23
  # Foreign Keys
24
24
  #
25
- # fk_action_mcp_session_messages_session_id (session_id => action_mcp_sessions.id) ON DELETE => cascade ON UPDATE => cascade
25
+ # fk_rails_... (session_id => action_mcp_sessions.id) ON DELETE => cascade ON UPDATE => cascade
26
26
  #
27
27
  module ActionMCP
28
28
  class Session
@@ -4,28 +4,28 @@
4
4
  #
5
5
  # Table name: action_mcp_sessions
6
6
  #
7
- # id :string not null, primary key
8
- # authentication_method :string default("none")
9
- # client_capabilities(The capabilities of the client) :jsonb
10
- # client_info(The information about the client) :jsonb
11
- # ended_at(The time the session ended) :datetime
12
- # initialized :boolean default(FALSE), not null
13
- # messages_count :integer default(0), not null
14
- # oauth_access_token :string
15
- # oauth_refresh_token :string
16
- # oauth_token_expires_at :datetime
17
- # oauth_user_context :jsonb
18
- # prompt_registry :jsonb
19
- # protocol_version :string
20
- # resource_registry :jsonb
21
- # role(The role of the session) :string default("server"), not null
22
- # server_capabilities(The capabilities of the server) :jsonb
23
- # server_info(The information about the server) :jsonb
24
- # sse_event_counter :integer default(0), not null
25
- # status :string default("pre_initialize"), not null
26
- # tool_registry :jsonb
27
- # created_at :datetime not null
28
- # updated_at :datetime not null
7
+ # id :string not null, primary key
8
+ # authentication_method :string default("none")
9
+ # client_capabilities :json
10
+ # client_info :json
11
+ # ended_at :datetime
12
+ # initialized :boolean default(FALSE), not null
13
+ # messages_count :integer default(0), not null
14
+ # oauth_access_token :string
15
+ # oauth_refresh_token :string
16
+ # oauth_token_expires_at :datetime
17
+ # oauth_user_context :json
18
+ # prompt_registry :json
19
+ # protocol_version :string
20
+ # resource_registry :json
21
+ # role :string default("server"), not null
22
+ # server_capabilities :json
23
+ # server_info :json
24
+ # sse_event_counter :integer default(0), not null
25
+ # status :string default("pre_initialize"), not null
26
+ # tool_registry :json
27
+ # created_at :datetime not null
28
+ # updated_at :datetime not null
29
29
  #
30
30
  # Indexes
31
31
  #
@@ -11,16 +11,16 @@ class ConsolidatedMigration < ActiveRecord::Migration[8.0]
11
11
  t.string :status, null: false, default: 'pre_initialize'
12
12
  t.datetime :ended_at, comment: 'The time the session ended'
13
13
  t.string :protocol_version
14
- t.jsonb :server_capabilities, comment: 'The capabilities of the server'
15
- t.jsonb :client_capabilities, comment: 'The capabilities of the client'
16
- t.jsonb :server_info, comment: 'The information about the server'
17
- t.jsonb :client_info, comment: 'The information about the client'
14
+ t.json :server_capabilities, comment: 'The capabilities of the server'
15
+ t.json :client_capabilities, comment: 'The capabilities of the client'
16
+ t.json :server_info, comment: 'The information about the server'
17
+ t.json :client_info, comment: 'The information about the client'
18
18
  t.boolean :initialized, null: false, default: false
19
19
  t.integer :messages_count, null: false, default: 0
20
20
  t.integer :sse_event_counter, default: 0, null: false
21
- t.jsonb :tool_registry, default: []
22
- t.jsonb :prompt_registry, default: []
23
- t.jsonb :resource_registry, default: []
21
+ t.json :tool_registry, default: []
22
+ t.json :prompt_registry, default: []
23
+ t.json :resource_registry, default: []
24
24
  t.timestamps
25
25
  end
26
26
  end
@@ -36,7 +36,7 @@ class ConsolidatedMigration < ActiveRecord::Migration[8.0]
36
36
  t.string :direction, null: false, comment: 'The message recipient', default: 'client'
37
37
  t.string :message_type, null: false, comment: 'The type of the message'
38
38
  t.string :jsonrpc_id
39
- t.jsonb :message_json
39
+ t.json :message_json
40
40
  t.boolean :is_ping, default: false, null: false, comment: 'Whether the message is a ping'
41
41
  t.boolean :request_acknowledged, default: false, null: false
42
42
  t.boolean :request_cancelled, null: false, default: false
@@ -98,15 +98,15 @@ class ConsolidatedMigration < ActiveRecord::Migration[8.0]
98
98
  end
99
99
 
100
100
  unless column_exists?(:action_mcp_sessions, :tool_registry)
101
- add_column :action_mcp_sessions, :tool_registry, :jsonb, default: []
101
+ add_column :action_mcp_sessions, :tool_registry, :json, default: []
102
102
  end
103
103
 
104
104
  unless column_exists?(:action_mcp_sessions, :prompt_registry)
105
- add_column :action_mcp_sessions, :prompt_registry, :jsonb, default: []
105
+ add_column :action_mcp_sessions, :prompt_registry, :json, default: []
106
106
  end
107
107
 
108
108
  unless column_exists?(:action_mcp_sessions, :resource_registry)
109
- add_column :action_mcp_sessions, :resource_registry, :jsonb, default: []
109
+ add_column :action_mcp_sessions, :resource_registry, :json, default: []
110
110
  end
111
111
  end
112
112
 
@@ -132,7 +132,10 @@ class ConsolidatedMigration < ActiveRecord::Migration[8.0]
132
132
 
133
133
  return unless column_exists?(:action_mcp_session_messages, :direction)
134
134
 
135
- change_column_comment :action_mcp_session_messages, :direction, 'The message recipient'
135
+ # SQLite3 doesn't support changing column comments
136
+ if connection.adapter_name.downcase != 'sqlite'
137
+ change_column_comment :action_mcp_session_messages, :direction, 'The message recipient'
138
+ end
136
139
  end
137
140
 
138
141
  private
@@ -2,8 +2,8 @@
2
2
 
3
3
  class AddOAuthToSessions < ActiveRecord::Migration[8.0]
4
4
  def change
5
- # Use jsonb for PostgreSQL, json for other databases (SQLite3, MySQL)
6
- json_type = connection.adapter_name.downcase == 'postgresql' ? :jsonb : :json
5
+ # Use json for all databases (PostgreSQL, SQLite3, MySQL) for consistency
6
+ json_type = :json
7
7
 
8
8
  add_column :action_mcp_sessions, :oauth_access_token, :string
9
9
  add_column :action_mcp_sessions, :oauth_refresh_token, :string
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative "gem_version"
4
4
  module ActionMCP
5
- VERSION = "0.53.0"
5
+ VERSION = "0.54.0"
6
6
 
7
7
  class << self
8
8
  alias version gem_version
@@ -7,6 +7,8 @@ module ActionMcp
7
7
  class InstallGenerator < Rails::Generators::Base
8
8
  source_root File.expand_path("templates", __dir__)
9
9
 
10
+ desc "Install ActionMCP with base classes and configuration"
11
+
10
12
  def create_application_prompt_file
11
13
  template "application_mcp_prompt.rb", File.join("app/mcp/prompts", "application_mcp_prompt.rb")
12
14
  end
@@ -20,13 +22,42 @@ module ActionMcp
20
22
  File.join("app/mcp/resource_templates", "application_mcp_res_template.rb")
21
23
  end
22
24
 
23
- def create_mcp_profile_file
25
+ def create_mcp_configuration_file
24
26
  template "mcp.yml", File.join("config", "mcp.yml")
25
27
  end
26
28
 
27
29
  def create_application_gateway_file
28
30
  template "application_gateway.rb", File.join("app/mcp", "application_gateway.rb")
29
31
  end
32
+
33
+ def show_instructions
34
+ say ""
35
+ say "ActionMCP has been installed successfully!"
36
+ say ""
37
+ say "Files created:"
38
+ say " - app/mcp/prompts/application_mcp_prompt.rb"
39
+ say " - app/mcp/tools/application_mcp_tool.rb"
40
+ say " - app/mcp/resource_templates/application_mcp_res_template.rb"
41
+ say " - app/mcp/application_gateway.rb"
42
+ say " - config/mcp.yml"
43
+ say ""
44
+ say "Configuration:"
45
+ say " The mcp.yml file contains authentication, profiles, and adapter settings."
46
+ say " You can customize authentication methods, OAuth settings, and PubSub adapters."
47
+ say ""
48
+ say "Available adapters:"
49
+ say " - simple : In-memory adapter for development"
50
+ say " - test : Test adapter for testing environments"
51
+ say " - solid_cable : Database-backed adapter (requires solid_cable gem)"
52
+ say " - redis : Redis-backed adapter (requires redis gem)"
53
+ say ""
54
+ say "Next steps:"
55
+ say " 1. Generate your first tool: rails generate action_mcp:tool MyTool"
56
+ say " 2. Generate your first prompt: rails generate action_mcp:prompt MyPrompt"
57
+ say " 3. Generate your first resource template: rails generate action_mcp:resource_template MyResource"
58
+ say " 4. Start the MCP server: bundle exec rails s -c mcp.ru -p 62770"
59
+ say ""
60
+ end
30
61
  end
31
62
  end
32
63
  end
@@ -1,21 +1,98 @@
1
+ # ActionMCP Configuration
2
+ # This file contains configuration for the ActionMCP server including
3
+ # authentication, profiles, and pub/sub system settings.
4
+
1
5
  shared:
2
- primary:
3
- tools:
4
- - all
5
- prompts:
6
- - all
7
- resources:
8
- - all
9
- options:
10
- list_changed: false
11
- resources_subscribe: false
6
+ # Authentication configuration - array of methods to try in order
7
+ authentication: ["none"] # No authentication required by default
8
+
9
+ # OAuth configuration (if using OAuth authentication)
10
+ # oauth:
11
+ # provider: "demo_oauth_provider"
12
+ # scopes_supported: ["mcp:tools", "mcp:resources", "mcp:prompts"]
13
+ # enable_dynamic_registration: true
14
+ # enable_token_revocation: true
15
+ # pkce_required: true
16
+ # issuer_url: <%= ENV.fetch("OAUTH_ISSUER_URL") { "https://yourapp.com" } %>
17
+
18
+ # MCP capability profiles
19
+ profiles:
20
+ primary:
21
+ tools:
22
+ - all
23
+ prompts:
24
+ - all
25
+ resources:
26
+ - all
27
+ options:
28
+ list_changed: false
29
+ logging_enabled: true
30
+ resources_subscribe: false
31
+
32
+ minimal:
33
+ tools: []
34
+ prompts: []
35
+ resources: []
36
+ options:
37
+ list_changed: false
38
+ logging_enabled: false
39
+ logging_level: :warn
40
+ resources_subscribe: false
41
+
42
+ # Development environment
43
+ development:
44
+ # Use simple pub/sub adapter for development
45
+ adapter: simple
46
+ # Thread pool configuration (optional)
47
+ # min_threads: 5 # Minimum number of threads in the pool
48
+ # max_threads: 10 # Maximum number of threads in the pool
49
+ # max_queue: 100 # Maximum number of tasks that can be queued
50
+
51
+ # Test environment
52
+ test:
53
+ # JWT authentication for testing environment
54
+ authentication: ["jwt"]
55
+
56
+ # Test adapter for testing
57
+ adapter: test
58
+
59
+ # Production environment
60
+ production:
61
+ # Multiple authentication methods - try OAuth first, fallback to JWT
62
+ authentication: ["oauth", "jwt"]
63
+
64
+ # OAuth configuration for production
65
+ oauth:
66
+ provider: "application_oauth_provider" # Your custom provider class
67
+ scopes_supported: ["mcp:tools", "mcp:resources", "mcp:prompts"]
68
+ enable_dynamic_registration: true
69
+ enable_token_revocation: true
70
+ pkce_required: true
71
+ issuer_url: <%= ENV.fetch("OAUTH_ISSUER_URL") { "https://yourapp.com" } %>
72
+
73
+ # Additional production profiles for external clients
74
+ profiles:
75
+ external_clients:
76
+ tools: ["WeatherForecastTool"] # Limited tool access for external clients
77
+ prompts: []
78
+ resources: []
79
+
80
+ # Choose one of the following adapters:
81
+
82
+ # 1. Database-backed adapter (recommended)
83
+ adapter: solid_cable
84
+ polling_interval: 0.5.seconds
85
+ # connects_to: cable # Optional: specify a different database connection
86
+
87
+ # Thread pool configuration (optional)
88
+ min_threads: 10 # Minimum number of threads in the pool
89
+ max_threads: 20 # Maximum number of threads in the pool
90
+ max_queue: 500 # Maximum number of tasks that can be queued
12
91
 
13
- # minimal:
14
- # tools: []
15
- # prompts: []
16
- # resources: []
17
- # options:
18
- # list_changed: false
19
- # logging_enabled: false
20
- # logging_level: :warn
21
- # resources_subscribe: false
92
+ # 2. Redis-backed adapter (alternative)
93
+ # adapter: redis
94
+ # url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
95
+ # channel_prefix: <%= Rails.application.class.module_parent_name.underscore %>_production
96
+ # min_threads: 10 # Minimum number of threads in the pool
97
+ # max_threads: 20 # Maximum number of threads in the pool
98
+ # max_queue: 500 # Maximum number of tasks that can be queued
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.53.0
4
+ version: 0.54.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Abdelkader Boudih
@@ -312,8 +312,6 @@ files:
312
312
  - lib/action_mcp/uri_ambiguity_checker.rb
313
313
  - lib/action_mcp/version.rb
314
314
  - lib/actionmcp.rb
315
- - lib/generators/action_mcp/config/config_generator.rb
316
- - lib/generators/action_mcp/config/templates/mcp.yml
317
315
  - lib/generators/action_mcp/install/install_generator.rb
318
316
  - lib/generators/action_mcp/install/templates/application_gateway.rb
319
317
  - lib/generators/action_mcp/install/templates/application_mcp_prompt.rb
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActionMCP
4
- module Generators
5
- class ConfigGenerator < Rails::Generators::Base
6
- namespace "action_mcp:config"
7
- source_root File.expand_path("templates", __dir__)
8
-
9
- desc "Creates ActionMCP configuration file (config/mcp.yml)"
10
-
11
- def create_mcp_yml
12
- template "mcp.yml", "config/mcp.yml"
13
- end
14
-
15
- def show_instructions
16
- say "ActionMCP configuration file created at config/mcp.yml"
17
- say "You can customize your PubSub adapters and other settings in this file."
18
- say ""
19
- say "Available adapters:"
20
- say " - simple : In-memory adapter for development"
21
- say " - test : Test adapter"
22
- say " - solid_cable : Database-backed adapter (requires solid_cable gem)"
23
- say " - redis : Redis-backed adapter (requires redis gem)"
24
- say ""
25
- end
26
- end
27
- end
28
- end
@@ -1,104 +0,0 @@
1
- # ActionMCP Configuration
2
- # This file contains configuration for the ActionMCP server including
3
- # authentication, profiles, and pub/sub system settings.
4
-
5
- development:
6
- # Authentication configuration - array of methods to try in order
7
- authentication: ["none"] # No authentication required for development
8
-
9
- # OAuth configuration (if using OAuth authentication)
10
- # oauth:
11
- # provider: "demo_oauth_provider"
12
- # scopes_supported: ["mcp:tools", "mcp:resources", "mcp:prompts"]
13
- # enable_dynamic_registration: true
14
- # enable_token_revocation: true
15
- # pkce_required: true
16
-
17
- # MCP capability profiles
18
- profiles:
19
- primary:
20
- tools: ["all"]
21
- prompts: ["all"]
22
- resources: ["all"]
23
- options:
24
- list_changed: false
25
- logging_enabled: true
26
- resources_subscribe: false
27
-
28
- minimal:
29
- tools: []
30
- prompts: []
31
- resources: []
32
- options:
33
- list_changed: false
34
- logging_enabled: false
35
- logging_level: :warn
36
- resources_subscribe: false
37
-
38
- # Pub/sub adapter configuration
39
- adapter: simple
40
- # Thread pool configuration (optional)
41
- # min_threads: 5 # Minimum number of threads in the pool
42
- # max_threads: 10 # Maximum number of threads in the pool
43
- # max_queue: 100 # Maximum number of tasks that can be queued
44
-
45
- test:
46
- # JWT authentication for testing
47
- authentication: ["jwt"]
48
-
49
- profiles:
50
- primary:
51
- tools: ["all"]
52
- prompts: ["all"]
53
- resources: ["all"]
54
-
55
- # Test adapter for testing
56
- adapter: test
57
-
58
- production:
59
- # Multiple authentication methods - try OAuth first, fallback to JWT
60
- authentication: ["oauth", "jwt"]
61
-
62
- # OAuth configuration for production
63
- oauth:
64
- provider: "application_oauth_provider" # Your custom provider class
65
- scopes_supported: ["mcp:tools", "mcp:resources", "mcp:prompts"]
66
- enable_dynamic_registration: true
67
- enable_token_revocation: true
68
- pkce_required: true
69
- # issuer_url: <%= ENV.fetch("OAUTH_ISSUER_URL") { "https://yourapp.com" } %>
70
-
71
- profiles:
72
- primary:
73
- tools: ["all"]
74
- prompts: ["all"]
75
- resources: ["all"]
76
- options:
77
- list_changed: false
78
- logging_enabled: true
79
- resources_subscribe: false
80
-
81
- external_clients:
82
- tools: ["WeatherForecastTool"] # Limited tool access for external clients
83
- prompts: []
84
- resources: []
85
-
86
- # Choose one of the following adapters:
87
-
88
- # 1. Database-backed adapter (recommended)
89
- adapter: solid_cable
90
- polling_interval: 0.5.seconds
91
- # connects_to: cable # Optional: specify a different database connection
92
-
93
- # Thread pool configuration (optional)
94
- min_threads: 10 # Minimum number of threads in the pool
95
- max_threads: 20 # Maximum number of threads in the pool
96
- max_queue: 500 # Maximum number of tasks that can be queued
97
-
98
- # 2. Redis-backed adapter (alternative)
99
- # adapter: redis
100
- # url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
101
- # channel_prefix: <%= Rails.application.class.module_parent_name.underscore %>_production
102
- # min_threads: 10 # Minimum number of threads in the pool
103
- # max_threads: 20 # Maximum number of threads in the pool
104
- # max_queue: 500 # Maximum number of tasks that can be queued