rails-active-mcp 0.1.7 → 2.0.8

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.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +106 -279
  3. data/changelog.md +69 -0
  4. data/docs/DEBUGGING.md +5 -5
  5. data/docs/README.md +130 -142
  6. data/examples/rails_app_integration.md +405 -0
  7. data/exe/rails-active-mcp-server +153 -76
  8. data/gemfiles/rails_7.1.gemfile +34 -0
  9. data/lib/generators/rails_active_mcp/install/install_generator.rb +19 -39
  10. data/lib/generators/rails_active_mcp/install/templates/README.md +134 -188
  11. data/lib/generators/rails_active_mcp/install/templates/initializer.rb +65 -28
  12. data/lib/generators/rails_active_mcp/install/templates/mcp.ru +7 -3
  13. data/lib/rails_active_mcp/configuration.rb +37 -98
  14. data/lib/rails_active_mcp/console_executor.rb +13 -3
  15. data/lib/rails_active_mcp/engine.rb +36 -24
  16. data/lib/rails_active_mcp/sdk/server.rb +183 -0
  17. data/lib/rails_active_mcp/sdk/tools/console_execute_tool.rb +103 -0
  18. data/lib/rails_active_mcp/sdk/tools/dry_run_tool.rb +73 -0
  19. data/lib/rails_active_mcp/sdk/tools/model_info_tool.rb +106 -0
  20. data/lib/rails_active_mcp/sdk/tools/safe_query_tool.rb +77 -0
  21. data/lib/rails_active_mcp/tasks.rake +236 -80
  22. data/lib/rails_active_mcp/version.rb +1 -1
  23. data/lib/rails_active_mcp.rb +5 -11
  24. data/rails_active_mcp.gemspec +62 -11
  25. metadata +83 -24
  26. data/app/controllers/rails_active_mcp/mcp_controller.rb +0 -80
  27. data/lib/rails_active_mcp/mcp_server.rb +0 -383
  28. data/lib/rails_active_mcp/railtie.rb +0 -70
  29. data/lib/rails_active_mcp/stdio_server.rb +0 -517
  30. data/lib/rails_active_mcp/tools/console_execute_tool.rb +0 -61
  31. data/lib/rails_active_mcp/tools/dry_run_tool.rb +0 -41
  32. data/lib/rails_active_mcp/tools/model_info_tool.rb +0 -70
  33. data/lib/rails_active_mcp/tools/safe_query_tool.rb +0 -41
@@ -0,0 +1,34 @@
1
+ # Rails 7.1 Gemfile for CI testing
2
+ source 'https://rubygems.org'
3
+
4
+ # Specify the Rails version
5
+ gem 'rails', '~> 7.1.0'
6
+
7
+ # Include the main gemspec
8
+ gemspec path: '../'
9
+
10
+ # Rails 7.1 specific dependencies
11
+ gem 'importmap-rails', '>= 1.0'
12
+ gem 'sprockets-rails', '>= 3.4.0'
13
+ gem 'stimulus-rails', '>= 1.0'
14
+ gem 'turbo-rails', '>= 1.0'
15
+
16
+ # Database adapters
17
+ gem 'mysql2', '~> 0.5'
18
+ gem 'pg', '~> 1.1'
19
+ gem 'sqlite3', '~> 1.6'
20
+
21
+ # Testing gems
22
+ gem 'factory_bot_rails', '~> 6.0'
23
+ gem 'faker', '~> 3.0'
24
+ gem 'rspec-rails', '~> 6.0'
25
+
26
+ # Development and debugging
27
+ gem 'debug', '>= 1.0.0'
28
+ gem 'web-console', '>= 4.0'
29
+
30
+ group :development, :test do
31
+ gem 'rubocop'
32
+ gem 'rubocop-rails'
33
+ gem 'rubocop-rspec'
34
+ end
@@ -20,30 +20,24 @@ module RailsActiveMcp
20
20
  # This ensures the server runs within the Rails project context
21
21
 
22
22
  require 'bundler/setup'
23
- require 'stringio'
24
23
 
25
24
  # Set Rails environment
26
25
  ENV['RAILS_ENV'] ||= 'development'
27
26
 
28
- # Suppress Rails loading output for MCP JSON protocol
29
- unless ENV['RAILS_MCP_DEBUG'] == '1'
30
- original_stdout = $stdout
31
- original_stderr = $stderr
32
- $stdout = StringIO.new
33
- $stderr = StringIO.new
34
- end
35
-
36
- # Load Rails application
27
+ # Load Rails application first
37
28
  require_relative '../config/environment'
38
29
 
39
- # Restore output streams
40
- unless ENV['RAILS_MCP_DEBUG'] == '1'
41
- $stdout = original_stdout
42
- $stderr = original_stderr
43
- end
30
+ # Now start the MCP server using the SDK implementation
31
+ require 'rails_active_mcp/sdk/server'
44
32
 
45
- # Now run the actual MCP server
46
- load Gem.bin_path('rails_active_mcp', 'rails-active-mcp-server')
33
+ begin
34
+ server = RailsActiveMcp::SDK::Server.new
35
+ server.run
36
+ rescue StandardError => e
37
+ warn "Error starting Rails Active MCP server: \#{e.message}"
38
+ warn e.backtrace if ENV['RAILS_MCP_DEBUG'] == '1'
39
+ exit 1
40
+ end
47
41
  RUBY
48
42
 
49
43
  chmod 'bin/rails-active-mcp-server', 0o755
@@ -57,7 +51,6 @@ module RailsActiveMcp
57
51
 
58
52
  # Rails Active MCP Wrapper Script
59
53
  # Ensures correct Ruby environment for Claude Desktop execution
60
- # Research-based solution for version manager compatibility
61
54
 
62
55
  # Fix Claude Desktop environment isolation issues
63
56
  export HOME="${HOME:-#{ENV['HOME']}}"
@@ -95,24 +88,6 @@ module RailsActiveMcp
95
88
  say 'Created environment wrapper at bin/rails-active-mcp-wrapper', :green
96
89
  end
97
90
 
98
- def create_mcp_route
99
- # Check if routes file exists and is writable
100
- routes_file = 'config/routes.rb'
101
- return unless File.exist?(routes_file)
102
-
103
- # Read current routes to check for conflicts
104
- routes_content = File.read(routes_file)
105
-
106
- if routes_content.include?('/mcp')
107
- say "Warning: Route '/mcp' already exists. Skipping route creation.", :yellow
108
- say "Manual setup: Add 'mount RailsActiveMcp::Engine, at: \"/mcp\"' to your routes.rb", :yellow
109
- else
110
- # Use Engine mounting instead of direct server mounting
111
- route "mount RailsActiveMcp::Engine, at: '/mcp'"
112
- say "Added MCP route at '/mcp'. You can change this in config/routes.rb", :green
113
- end
114
- end
115
-
116
91
  def create_mcp_config
117
92
  template 'mcp.ru', 'mcp.ru'
118
93
  end
@@ -134,7 +109,6 @@ module RailsActiveMcp
134
109
  say ' "mcpServers": {', :cyan
135
110
  say ' "rails-active-mcp": {', :cyan
136
111
  say " \"command\": \"#{Rails.root}/bin/rails-active-mcp-wrapper\",", :cyan
137
- say ' "args": ["stdio"],', :cyan
138
112
  say " \"cwd\": \"#{Rails.root}\",", :cyan
139
113
  say ' "env": {', :cyan
140
114
  say ' "RAILS_ENV": "development",', :cyan
@@ -144,6 +118,12 @@ module RailsActiveMcp
144
118
  say ' }', :cyan
145
119
  say '}', :cyan
146
120
  say '', :green
121
+ say "\nAvailable Tools in Claude Desktop:", :green
122
+ say '- console_execute: Execute Ruby code with safety checks', :yellow
123
+ say '- model_info: Get detailed information about Rails models', :yellow
124
+ say '- safe_query: Execute safe read-only database queries', :yellow
125
+ say '- dry_run: Analyze Ruby code for safety without execution', :yellow
126
+ say '', :green
147
127
  say "\nWhy use the wrapper?", :green
148
128
  say '- Handles Ruby version manager environments (asdf, rbenv, etc.)', :yellow
149
129
  say '- Prevents "bundler version" and "Ruby version" conflicts', :yellow
@@ -151,8 +131,8 @@ module RailsActiveMcp
151
131
  say "\nAlternative (if wrapper doesn't work):", :green
152
132
  say 'Use bin/rails-active-mcp-server instead of the wrapper', :yellow
153
133
  say "\nTesting:", :green
154
- say '1. Test manually: bin/rails-active-mcp-wrapper stdio', :yellow
155
- say '2. Should output JSON (not plain text)', :yellow
134
+ say '1. Test manually: bin/rails-active-mcp-wrapper', :yellow
135
+ say '2. Should output JSON responses (not plain text)', :yellow
156
136
  say '3. Restart Claude Desktop after config changes', :yellow
157
137
  say "\nTroubleshooting:", :green
158
138
  say '- Set RAILS_MCP_DEBUG=1 for verbose logging', :yellow
@@ -1,188 +1,134 @@
1
- ================================================================================
2
- Rails Active MCP has been installed!
3
- ================================================================================
4
-
5
- Configuration:
6
- - Initializer created at: config/initializers/rails_active_mcp.rb
7
- - Custom MCP server mounted at: /mcp
8
- - MCP server configuration: mcp.ru
9
- - Audit log will be created at: log/rails_active_mcp.log
10
-
11
- Next Steps:
12
-
13
- 1. Review and customize the configuration in config/initializers/rails_active_mcp.rb
14
-
15
- 2. Configure server mode in config/initializers/rails_active_mcp.rb:
16
- config.server_mode = :stdio # For Claude Desktop (default)
17
- config.server_mode = :http # For HTTP-based integrations
18
- config.server_host = 'localhost'
19
- config.server_port = 3001
20
-
21
- 3. Start the MCP server:
22
- Option A: Use configured mode (RECOMMENDED)
23
- $ bundle exec rails-active-mcp-server
24
-
25
- Option B: Override mode via command line
26
- $ bundle exec rails-active-mcp-server stdio # Force stdio mode
27
- $ bundle exec rails-active-mcp-server http # Force HTTP mode
28
-
29
- Option C: Rails-mounted server (HTTP)
30
- $ rails server
31
-
32
- Option D: Using rackup
33
- $ rackup mcp.ru -p 3001
34
-
35
- 4. For Claude Desktop integration, add this to your Claude Desktop configuration:
36
-
37
- Location: ~/.config/claude-desktop/claude_desktop_config.json (Linux/macOS)
38
- Location: %APPDATA%\Claude\claude_desktop_config.json (Windows)
39
-
40
- {
41
- "mcpServers": {
42
- "rails-active-mcp": {
43
- "command": "<%= Rails.root %>/bin/rails-active-mcp-wrapper",
44
- "args": ["stdio"],
45
- "cwd": "<%= Rails.root %>",
46
- "env": {
47
- "RAILS_ENV": "development",
48
- "HOME": "/Users/your-username"
49
- }
50
- }
51
- }
52
- }
53
-
54
- OR if you've installed the gem globally:
55
-
56
- {
57
- "mcpServers": {
58
- "rails-active-mcp": {
59
- "command": "rails-active-mcp-server",
60
- "args": ["stdio"],
61
- "cwd": "/path/to/your/rails/project"
62
- }
63
- }
64
- }
65
-
66
- 5. For other MCP clients (HTTP-based), add this to your MCP configuration:
67
- {
68
- "mcpServers": {
69
- "rails-console": {
70
- "command": "curl",
71
- "args": ["-X", "POST", "-H", "Content-Type: application/json", "-d", "@-", "http://localhost:3000/mcp"]
72
- }
73
- }
74
- }
75
-
76
- 6. Test the installation:
77
- $ rails console
78
- > RailsActiveMcp.safe?("User.count")
79
- > RailsActiveMcp.execute("User.count")
80
-
81
- Built-in Tools Available in Claude:
82
- - rails_console_execute: Execute Ruby code in Rails console with safety checks
83
- - rails_model_info: Get detailed information about Rails models
84
- - rails_safe_query: Execute safe read-only database queries
85
- - rails_dry_run: Analyze Ruby code for safety without execution
86
-
87
- Extend with custom tools by modifying the MCP server implementation.
88
-
89
- Security Notes:
90
- - Production mode enables strict safety by default
91
- - All executions are logged to the audit file
92
- - Dangerous operations are blocked in safe mode
93
- - Review the safety patterns in the configuration
94
-
95
- Transport Modes:
96
- - stdio: For Claude Desktop and compatible MCP clients (recommended)
97
- - http: For HTTP-based integrations and web applications
98
-
99
- Configuration Examples:
100
-
101
- For Claude Desktop (default):
102
- config.server_mode = :stdio
103
-
104
- For HTTP web integrations:
105
- config.server_mode = :http
106
- config.server_host = 'localhost'
107
- config.server_port = 3001
108
-
109
- For Docker/remote access:
110
- config.http_mode!(host: '0.0.0.0', port: 8080)
111
-
112
- For development with multiple transport modes:
113
- if Rails.env.development?
114
- config.stdio_mode! # Claude Desktop
115
- else
116
- config.http_mode!(host: '0.0.0.0', port: 3001) # Production HTTP
117
- end
118
-
119
- Custom MCP Server Benefits:
120
- - No external dependencies
121
- - Full control over implementation
122
- - Simplified deployment
123
- - Enhanced security
124
- - Works with Claude Desktop
125
-
126
- Debugging and Troubleshooting:
127
-
128
- For interactive debugging, use the MCP Inspector:
129
- $ bin/debug-mcp-server --mode inspector
130
-
131
- This will:
132
- - Launch the MCP Inspector connected to your server
133
- - Allow interactive testing of all tools
134
- - Show real-time debug output and logs
135
-
136
- Debug logging:
137
- $ RAILS_MCP_DEBUG=1 bundle exec rails-active-mcp-server stdio
138
-
139
- View Claude Desktop logs:
140
- $ tail -f ~/Library/Logs/Claude/mcp*.log # macOS
141
- $ tail -f ~/.config/claude-desktop/logs/*.log # Linux
142
-
143
- Common issues:
144
-
145
- 1. Ruby Version Manager Conflicts (Most Common Issue):
146
- If you see errors like "Could not find 'bundler' (X.X.X)" or "Your Ruby version is X.X.X, but your Gemfile specified Y.Y.Y":
147
-
148
- This happens because Claude Desktop uses system Ruby instead of your project's Ruby version.
149
-
150
- Solution A - Use the wrapper script (Recommended):
151
- In claude_desktop_config.json, use:
152
- "command": "<%= Rails.root %>/bin/rails-active-mcp-wrapper"
153
-
154
- Solution B - Create system symlink:
155
- $ sudo ln -sf $(which ruby) /usr/local/bin/ruby
156
-
157
- Solution C - Use absolute Ruby path:
158
- In claude_desktop_config.json, change "command" to your full Ruby path:
159
- "command": "$(which ruby)"
160
- "args": ["<%= Rails.root %>/bin/rails-active-mcp-server", "stdio"]
161
-
162
- 2. Environment Variable Issues:
163
- If you see "error loading config: $HOME is not defined":
164
-
165
- This happens because Claude Desktop doesn't inherit all environment variables.
166
-
167
- Solution: Add HOME to your env section in claude_desktop_config.json:
168
- "env": {
169
- "RAILS_ENV": "development",
170
- "HOME": "/Users/your-username"
171
- }
172
-
173
- 3. General Environment Issues:
174
- - Ensure your Rails environment loads properly in the project directory
175
- - Check that the gem is properly installed and configured
176
- - Verify the Rails application starts without errors
177
- - Make sure the cwd path in Claude Desktop config is correct
178
-
179
- 4. Debug Steps:
180
- - Test manually: $ ./bin/rails-active-mcp-wrapper stdio
181
- - Should output JSON (not plain text)
182
- - Enable debug logging with RAILS_MCP_DEBUG=1 for detailed output
183
- - Check Claude logs: $ tail -f ~/Library/Logs/Claude/mcp*.log
184
- - Test environment variables: $ echo $HOME (should show your home directory)
185
-
186
- For more information: https://github.com/goodpie/rails-active-mcp
187
-
188
- ================================================================================
1
+ # Rails Active MCP Integration
2
+
3
+ This Rails application is configured with Rails Active MCP for secure AI-powered database querying and model inspection.
4
+
5
+ ## What is Rails Active MCP?
6
+
7
+ Rails Active MCP enables secure Rails console access through Model Context Protocol (MCP) for AI agents and development tools like Claude Desktop. It provides four main tools:
8
+
9
+ - **console_execute**: Execute Ruby/Rails code with safety checks
10
+ - **model_info**: Inspect Rails models (schema, associations, validations)
11
+ - **safe_query**: Run read-only database queries
12
+ - **dry_run**: Analyze code safety without execution
13
+
14
+ ## Quick Start
15
+
16
+ ### 1. Test the Installation
17
+
18
+ ```bash
19
+ # Test the server starts correctly
20
+ bin/rails-active-mcp-wrapper
21
+
22
+ # Enable debug mode for troubleshooting
23
+ RAILS_MCP_DEBUG=1 bin/rails-active-mcp-server
24
+ ```
25
+
26
+ ### 2. Configure Claude Desktop
27
+
28
+ Add this to your Claude Desktop configuration:
29
+
30
+ **macOS/Linux**: `~/.config/claude-desktop/claude_desktop_config.json`
31
+ **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
32
+
33
+ ```json
34
+ {
35
+ "mcpServers": {
36
+ "rails-active-mcp": {
37
+ "command": "/path/to/your/rails/app/bin/rails-active-mcp-wrapper",
38
+ "cwd": "/path/to/your/rails/app",
39
+ "env": {
40
+ "RAILS_ENV": "development"
41
+ }
42
+ }
43
+ }
44
+ }
45
+ ```
46
+
47
+ ### 3. Try These Commands in Claude Desktop
48
+
49
+ - "Show me the User model structure"
50
+ - "How many users were created in the last week?"
51
+ - "What are the most recent orders?"
52
+ - "Check if this code is safe: `User.delete_all`"
53
+
54
+ ## Configuration
55
+
56
+ Your MCP integration is configured in `config/initializers/rails_active_mcp.rb`.
57
+
58
+ ### Environment-Specific Settings
59
+
60
+ - **Development**: More permissive, verbose logging
61
+ - **Production**: Strict safety, limited results, audit logging
62
+ - **Test**: Minimal logging, safety enabled
63
+
64
+ ### Customizing Safety Rules
65
+
66
+ ```ruby
67
+ # Add custom safety patterns
68
+ config.custom_safety_patterns = [
69
+ { pattern: /YourDangerousMethod/, description: "Custom dangerous operation" }
70
+ ]
71
+
72
+ # Restrict model access (empty = allow all)
73
+ config.allowed_models = %w[User Post Comment]
74
+ ```
75
+
76
+ ## Available Rake Tasks
77
+
78
+ ```bash
79
+ # Check code safety
80
+ rails rails_active_mcp:check_safety['User.count']
81
+
82
+ # Execute code with safety checks
83
+ rails rails_active_mcp:execute['User.count']
84
+
85
+ # Test MCP tools
86
+ rails rails_active_mcp:test_tools
87
+ ```
88
+
89
+ ## Troubleshooting
90
+
91
+ ### Server Won't Start
92
+ - Ensure your Rails app starts without errors: `rails console`
93
+ - Check Ruby version compatibility
94
+ - Verify all gems are installed: `bundle install`
95
+
96
+ ### Claude Desktop Connection Issues
97
+ - Restart Claude Desktop after configuration changes
98
+ - Check logs: `~/Library/Logs/Claude/mcp*.log` (macOS)
99
+ - Test server manually: `bin/rails-active-mcp-wrapper`
100
+
101
+ ### Permission Errors
102
+ - Ensure wrapper script is executable: `chmod +x bin/rails-active-mcp-wrapper`
103
+ - Check Ruby path in wrapper script matches your setup
104
+
105
+ ## Security Notes
106
+
107
+ - All dangerous operations are blocked by default in safe mode
108
+ - Production mode enables the strictest safety settings
109
+ - All executions can be logged for audit purposes
110
+ - Model access can be restricted via configuration
111
+
112
+ ## Examples
113
+
114
+ ### Safe Operations (Always Allowed)
115
+ ```ruby
116
+ User.count
117
+ Post.where(published: true).limit(10)
118
+ User.find(1).posts.includes(:comments)
119
+ Rails.env
120
+ ```
121
+
122
+ ### Risky Operations (Blocked in Safe Mode)
123
+ ```ruby
124
+ User.delete_all # Mass deletion
125
+ system('rm -rf /') # System commands
126
+ eval(user_input) # Code evaluation
127
+ File.delete('file') # File operations
128
+ ```
129
+
130
+ ## Getting Help
131
+
132
+ - **Documentation**: https://github.com/goodpie/rails-active-mcp
133
+ - **Issues**: https://github.com/goodpie/rails-active-mcp/issues
134
+ - **MCP Protocol**: https://modelcontextprotocol.io
@@ -1,43 +1,80 @@
1
1
  require 'rails_active_mcp'
2
2
 
3
3
  RailsActiveMcp.configure do |config|
4
- # Enable/disable the MCP server
5
- config.enabled = true
4
+ # Core configuration options
5
+ config.allowed_commands = %w[
6
+ ls pwd cat head tail grep find wc
7
+ rails console rails runner
8
+ bundle exec rspec bundle exec test
9
+ git status git log git diff
10
+ ]
6
11
 
7
- # Safety configuration
8
- config.safe_mode = Rails.env.production? # Always safe in production
9
- config.default_timeout = 30 # seconds
10
- config.max_results = 100
12
+ # Execution timeout in seconds
13
+ config.command_timeout = 30
11
14
 
12
- # Model access control
13
- # config.allowed_models = %w[User Post Comment] # Empty means all allowed
14
- # config.blocked_models = %w[AdminUser Secret] # Models to never allow access
15
+ # Logging configuration
16
+ config.enable_logging = true
17
+ config.log_level = :info # :debug, :info, :warn, :error
15
18
 
16
- # Mutation tools (dangerous operations)
17
- config.enable_mutation_tools = !Rails.env.production?
19
+ # Safety configuration
20
+ config.safe_mode = true # Enable safety checks by default
21
+ config.max_results = 100 # Limit query results to prevent large dumps
22
+ config.log_executions = true # Log all executions for audit trail
18
23
 
19
- # Logging and auditing
20
- config.log_executions = true
21
- config.audit_file = Rails.root.join('log', 'rails_active_mcp.log')
24
+ # Model access control (empty arrays allow all)
25
+ config.allowed_models = [] # Whitelist specific models if needed
26
+ # config.allowed_models = %w[User Post Comment] # Example: restrict to specific models
22
27
 
23
- # Server configuration
24
- config.server_mode = :stdio # :stdio for Claude Desktop, :http for web integrations
25
- config.server_host = 'localhost'
26
- config.server_port = 3001
28
+ # Custom safety patterns for your application
29
+ # config.custom_safety_patterns = [
30
+ # { pattern: /YourDangerousMethod/, description: "Your custom dangerous operation" }
31
+ # ]
27
32
 
28
- # Environment-specific settings
33
+ # Environment-specific adjustments
29
34
  case Rails.env
30
35
  when 'production'
31
- config.production_mode! # Very strict settings
36
+ # Strict settings for production
37
+ config.safe_mode = true
38
+ config.log_level = :warn
39
+ config.command_timeout = 15
40
+ config.max_results = 50
41
+ config.log_executions = true
42
+ config.allowed_models = [] # Consider restricting models in production
43
+
32
44
  when 'development'
33
- config.permissive_mode! # More relaxed for development
45
+ # More permissive settings for development
46
+ config.safe_mode = false # Allow more operations during development
47
+ config.log_level = :debug
48
+ config.command_timeout = 60
49
+ config.max_results = 200
50
+ config.log_executions = false
51
+
34
52
  when 'test'
35
- config.strict_mode! # Safe for testing
53
+ # Test-friendly settings
54
+ config.safe_mode = true
55
+ config.log_level = :error
56
+ config.command_timeout = 30
57
+ config.log_executions = false
36
58
  end
37
-
38
- # Add custom safety patterns
39
- # config.add_safety_pattern(/CustomDangerousMethod/, "Custom dangerous operation")
40
-
41
- # Operations that require manual confirmation
42
- config.require_confirmation_for = %i[delete destroy update_all delete_all]
43
59
  end
60
+
61
+ # Rails Active MCP is now ready!
62
+ #
63
+ # Available MCP Tools:
64
+ # - console_execute: Execute Ruby code with safety checks
65
+ # - model_info: Get detailed information about Rails models
66
+ # - safe_query: Execute safe read-only database queries
67
+ # - dry_run: Analyze Ruby code for safety without execution
68
+ #
69
+ # Quick Start:
70
+ # 1. Start the server: bin/rails-active-mcp-server
71
+ # 2. Configure Claude Desktop (see post-install instructions)
72
+ # 3. Try asking Claude: "Show me all users created in the last week"
73
+ #
74
+ # Testing the installation:
75
+ # - Run: bin/rails-active-mcp-wrapper (should output JSON responses)
76
+ # - Test with: RAILS_MCP_DEBUG=1 bin/rails-active-mcp-server
77
+ # - Check rake tasks: rails -T rails_active_mcp
78
+ #
79
+ # Documentation: https://github.com/goodpie/rails-active-mcp
80
+ # Need help? Create an issue or check the troubleshooting guide.
@@ -1,7 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'config/environment'
4
- require 'rails_active_mcp'
4
+ require 'rails_active_mcp/sdk/server'
5
5
 
6
- # Run the Rails Active MCP server
7
- run RailsActiveMcp::McpServer.new
6
+ # Run the Rails Active MCP server using the official MCP Ruby SDK
7
+ # Note: This file is primarily for reference. The recommended way to run
8
+ # the server is using: bin/rails-active-mcp-server
9
+
10
+ server = RailsActiveMcp::SDK::Server.new
11
+ server.run