rails-active-mcp 0.1.1 → 0.1.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bec983e79b11a278a9f7c39de53d6eff389f4ebbd951e9a613ce313ea3a48ba2
|
4
|
+
data.tar.gz: ed94322b6c2bb06cff349166dbdf4d95babeea80ac6ae2c355683c19c0dc682e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2281c14e99c4f2ad588fe0b222e060cb0b04e9bf0b3b874c284d6f6d6db8757a91d46a1aba7a77f365fe45c518d3a9e9bc58e2e2fbd6738c167334adfd252436
|
7
|
+
data.tar.gz: '0178374d4a7e8c365c582f8cc11ffce5c28d23b3ea8d0d35078cea47eaff5a3d316749ec28b7e724815e293c439b05c989be20187abed0f076d443463da4afbb'
|
@@ -1,37 +1,40 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
3
|
+
module RailsActiveMcp
|
4
|
+
module Generators
|
5
|
+
class InstallGenerator < Rails::Generators::Base
|
6
|
+
source_root File.expand_path('templates', __dir__)
|
7
|
+
|
8
|
+
desc 'Install Rails Active MCP'
|
9
|
+
|
10
|
+
def create_initializer
|
11
|
+
template 'initializer.rb', 'config/initializers/rails_active_mcp.rb'
|
12
|
+
end
|
13
|
+
|
14
|
+
def create_mcp_route
|
15
|
+
route "mount RailsActiveMcp::McpServer.new, at: '/mcp' # Rails Active MCP"
|
16
|
+
end
|
17
|
+
|
18
|
+
def create_mcp_config
|
19
|
+
template 'mcp.ru', 'mcp.ru'
|
20
|
+
end
|
21
|
+
|
22
|
+
def show_readme
|
23
|
+
readme 'README.md' if behavior == :invoke
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def readme(path)
|
29
|
+
readme_path = File.join(self.class.source_root, path)
|
30
|
+
if File.exist?(readme_path)
|
31
|
+
say IO.read(readme_path), :green
|
32
|
+
else
|
33
|
+
say "README file not found at #{readme_path}", :yellow
|
34
|
+
end
|
35
|
+
rescue StandardError => e
|
36
|
+
say "Error reading README: #{e.message}", :red
|
37
|
+
end
|
32
38
|
end
|
33
|
-
rescue => e
|
34
|
-
say "Error reading README: #{e.message}", :red
|
35
39
|
end
|
36
|
-
|
37
40
|
end
|
@@ -6,6 +6,13 @@ module RailsActiveMcp
|
|
6
6
|
|
7
7
|
config.rails_active_mcp = ActiveSupport::OrderedOptions.new
|
8
8
|
|
9
|
+
# Add generators configuration
|
10
|
+
config.generators do |g|
|
11
|
+
g.test_framework :rspec, fixture: false
|
12
|
+
g.assets false
|
13
|
+
g.helper false
|
14
|
+
end
|
15
|
+
|
9
16
|
initializer 'rails_active_mcp.configure' do |app|
|
10
17
|
# Load configuration from Rails config if present
|
11
18
|
if app.config.respond_to?(:rails_active_mcp)
|
@@ -28,5 +35,31 @@ module RailsActiveMcp
|
|
28
35
|
|
29
36
|
# Ensure our tools are eager loaded in production
|
30
37
|
config.eager_load_paths << root.join('lib', 'rails_active_mcp', 'tools')
|
38
|
+
|
39
|
+
# Add rake tasks
|
40
|
+
rake_tasks do
|
41
|
+
load 'rails_active_mcp/tasks.rake'
|
42
|
+
end
|
43
|
+
|
44
|
+
# Console hook for easier access
|
45
|
+
console do
|
46
|
+
# Add convenience methods to console
|
47
|
+
Rails::ConsoleMethods.include(RailsActiveMcp::ConsoleMethods) if defined?(Rails::ConsoleMethods)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# Console convenience methods
|
52
|
+
module ConsoleMethods
|
53
|
+
def mcp_execute(code, **options)
|
54
|
+
RailsActiveMcp.execute(code, **options)
|
55
|
+
end
|
56
|
+
|
57
|
+
def mcp_safe?(code)
|
58
|
+
RailsActiveMcp.safe?(code)
|
59
|
+
end
|
60
|
+
|
61
|
+
def mcp_config
|
62
|
+
RailsActiveMcp.config
|
63
|
+
end
|
31
64
|
end
|
32
65
|
end
|
data/lib/rails_active_mcp.rb
CHANGED
@@ -6,8 +6,9 @@ require_relative 'rails_active_mcp/configuration'
|
|
6
6
|
require_relative 'rails_active_mcp/safety_checker'
|
7
7
|
require_relative 'rails_active_mcp/console_executor'
|
8
8
|
require_relative 'rails_active_mcp/mcp_server'
|
9
|
-
require_relative 'rails_active_mcp/engine' if defined?(Rails)
|
10
9
|
|
10
|
+
# Load Engine for Rails integration
|
11
|
+
require_relative 'rails_active_mcp/engine' if defined?(Rails)
|
11
12
|
|
12
13
|
module RailsActiveMcp
|
13
14
|
class Error < StandardError; end
|
@@ -54,6 +55,3 @@ module RailsActiveMcp
|
|
54
55
|
end
|
55
56
|
end
|
56
57
|
end
|
57
|
-
|
58
|
-
# Auto-configure for Rails
|
59
|
-
require_relative 'rails_active_mcp/railtie' if defined?(Rails)
|