rails-active-mcp 2.0.12 → 3.1.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 +4 -4
- data/.dockerignore +38 -0
- data/.rubocop.yml +10 -10
- data/.ruby-version +1 -0
- data/Dockerfile +25 -0
- data/LICENSE.txt +21 -0
- data/README.md +70 -91
- data/changelog.md +70 -25
- data/docker-compose.yml +59 -0
- data/docs/DEBUGGING.md +3 -3
- data/docs/DOCKER_SETUP.md +263 -0
- data/gemfiles/rails_7.0.gemfile +4 -2
- data/gemfiles/rails_7.1.gemfile +4 -2
- data/gemfiles/rails_7.2.gemfile +4 -2
- data/gemfiles/{rails_6.0.gemfile → rails_8.0.gemfile} +6 -4
- data/gemfiles/{rails_6.1.gemfile → rails_8.1.gemfile} +6 -4
- data/lib/generators/rails_active_mcp/install/templates/initializer.rb +2 -8
- data/lib/rails_active_mcp/configuration.rb +2 -11
- data/lib/rails_active_mcp/console_executor.rb +39 -25
- data/lib/rails_active_mcp/engine.rb +2 -2
- data/lib/rails_active_mcp/garbage_collection_utils.rb +2 -0
- data/lib/rails_active_mcp/safety_checker.rb +6 -15
- data/lib/rails_active_mcp/sdk/server.rb +6 -2
- data/lib/rails_active_mcp/sdk/tools/console_execute_tool.rb +8 -6
- data/lib/rails_active_mcp/sdk/tools/dry_run_tool.rb +5 -4
- data/lib/rails_active_mcp/sdk/tools/model_info_tool.rb +37 -44
- data/lib/rails_active_mcp/sdk/tools/safe_query_tool.rb +4 -3
- data/lib/rails_active_mcp/tasks.rake +2 -0
- data/lib/rails_active_mcp/version.rb +1 -1
- data/lib/rails_active_mcp.rb +2 -2
- data/mcp.ru +2 -0
- data/rails_active_mcp.gemspec +6 -5
- metadata +29 -24
- data/claude_desktop_config.json +0 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5e6f12134560393b1599733a6930210fa87e4855256b6554395847d81e1690c0
|
|
4
|
+
data.tar.gz: cdec6fde55f4fcf3e0bcb78960dcd3464e84e358a1206baf7ebb41984a40ed21
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e7abbeeff33ad044bd08d73550c9dc1b24dcced7db200734c2842b0c7760533d2fdeb388c5e468e6216807a0bbca03c6dc36620495d335f71966d78d5e2b0557
|
|
7
|
+
data.tar.gz: 895df97ae5a0880df7b06781c64f9655b9464df36892174214a222079eff8825b3765f12278c51418a81b671831256ccf72ce3336213b3882504da7c0112b082
|
data/.dockerignore
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Git
|
|
2
|
+
.git
|
|
3
|
+
.gitignore
|
|
4
|
+
|
|
5
|
+
# Documentation
|
|
6
|
+
*.md
|
|
7
|
+
docs/
|
|
8
|
+
examples/
|
|
9
|
+
|
|
10
|
+
# Development files
|
|
11
|
+
.vscode/
|
|
12
|
+
.idea/
|
|
13
|
+
*.sublime-*
|
|
14
|
+
|
|
15
|
+
# Ruby/Rails
|
|
16
|
+
*.gem
|
|
17
|
+
.bundle/
|
|
18
|
+
vendor/bundle
|
|
19
|
+
log/
|
|
20
|
+
tmp/
|
|
21
|
+
.byebug_history
|
|
22
|
+
|
|
23
|
+
# Testing
|
|
24
|
+
coverage/
|
|
25
|
+
spec/reports/
|
|
26
|
+
|
|
27
|
+
# OS files
|
|
28
|
+
.DS_Store
|
|
29
|
+
Thumbs.db
|
|
30
|
+
|
|
31
|
+
# CI/CD
|
|
32
|
+
.github/
|
|
33
|
+
|
|
34
|
+
# Keep these for the build
|
|
35
|
+
!Gemfile
|
|
36
|
+
!Gemfile.lock
|
|
37
|
+
!rails_active_mcp.gemspec
|
|
38
|
+
!lib/rails_active_mcp/version.rb
|
data/.rubocop.yml
CHANGED
|
@@ -5,7 +5,7 @@ plugins:
|
|
|
5
5
|
AllCops:
|
|
6
6
|
NewCops: enable
|
|
7
7
|
SuggestExtensions: false
|
|
8
|
-
TargetRubyVersion: 3.
|
|
8
|
+
TargetRubyVersion: 3.2
|
|
9
9
|
Exclude:
|
|
10
10
|
- 'bin/bundle'
|
|
11
11
|
- 'bin/setup'
|
|
@@ -70,9 +70,8 @@ Style/SafeNavigation:
|
|
|
70
70
|
Style/StringLiterals:
|
|
71
71
|
EnforcedStyle: single_quotes
|
|
72
72
|
|
|
73
|
-
# Don't enforce frozen string literals in every file
|
|
74
73
|
Style/FrozenStringLiteralComment:
|
|
75
|
-
Enabled:
|
|
74
|
+
Enabled: true
|
|
76
75
|
|
|
77
76
|
# Allow numeric comparisons with zero
|
|
78
77
|
Style/NumericPredicate:
|
|
@@ -90,12 +89,9 @@ RSpec:
|
|
|
90
89
|
Gemspec/DevelopmentDependencies:
|
|
91
90
|
Enabled: false
|
|
92
91
|
|
|
93
|
-
# Allow some duplication in methods that handle similar cases
|
|
94
|
-
Lint/DuplicateMethods:
|
|
95
|
-
Enabled: false
|
|
96
|
-
|
|
97
92
|
Lint/DuplicateBranch:
|
|
98
|
-
|
|
93
|
+
Exclude:
|
|
94
|
+
- 'lib/rails_active_mcp/console_executor.rb'
|
|
99
95
|
|
|
100
96
|
# RSpec specific overrides for test quality
|
|
101
97
|
RSpec/MultipleExpectations:
|
|
@@ -131,9 +127,13 @@ RSpec/ScatteredSetup:
|
|
|
131
127
|
RSpec/SpecFilePathFormat:
|
|
132
128
|
Enabled: false
|
|
133
129
|
|
|
134
|
-
# Allow Time.zone vs Time.now flexibility
|
|
135
130
|
Rails/TimeZone:
|
|
136
|
-
Enabled:
|
|
131
|
+
Enabled: true
|
|
132
|
+
Exclude:
|
|
133
|
+
- 'exe/*'
|
|
134
|
+
- 'lib/rails_active_mcp/sdk/server.rb'
|
|
135
|
+
- 'lib/rails_active_mcp/console_executor.rb'
|
|
136
|
+
- 'spec/**/*'
|
|
137
137
|
|
|
138
138
|
# Naming conventions - allow short parameter names in specs/tools
|
|
139
139
|
Naming/MethodParameterName:
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.4.8
|
data/Dockerfile
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
FROM ruby:3.4-slim
|
|
2
|
+
|
|
3
|
+
# Install system dependencies
|
|
4
|
+
RUN apt-get update -qq && \
|
|
5
|
+
apt-get install -y --no-install-recommends \
|
|
6
|
+
build-essential \
|
|
7
|
+
git \
|
|
8
|
+
libsqlite3-dev \
|
|
9
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
10
|
+
|
|
11
|
+
# Set working directory
|
|
12
|
+
WORKDIR /app
|
|
13
|
+
|
|
14
|
+
# Copy gemspec and Gemfile first for better layer caching
|
|
15
|
+
COPY rails_active_mcp.gemspec Gemfile* ./
|
|
16
|
+
COPY lib/rails_active_mcp/version.rb ./lib/rails_active_mcp/
|
|
17
|
+
|
|
18
|
+
# Install gem dependencies
|
|
19
|
+
RUN bundle install
|
|
20
|
+
|
|
21
|
+
# Copy the rest of the application
|
|
22
|
+
COPY . .
|
|
23
|
+
|
|
24
|
+
# Default command
|
|
25
|
+
CMD ["bash"]
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Brandyn Britton
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
|
@@ -1,87 +1,43 @@
|
|
|
1
|
+
[](https://badge.fury.io/rb/rails-active-mcp)
|
|
2
|
+
|
|
3
|
+
Note: This is just a personal project and while it works for the most part, I am still developing it and actively trying to make it a bit more useful for my uses.
|
|
4
|
+
|
|
1
5
|
# Rails Active MCP
|
|
2
6
|
|
|
3
7
|
A Ruby gem that provides secure Rails console access through Model Context Protocol (MCP) for AI agents and development tools like Claude Desktop. Built using the official MCP Ruby SDK for professional protocol handling and future-proof compatibility.
|
|
4
8
|
|
|
5
|
-
## Features
|
|
6
9
|
|
|
7
|
-
- 🔒 **Safe Execution**: Advanced safety checks prevent dangerous operations
|
|
8
|
-
- 🚀 **Official MCP SDK**: Built with the official MCP Ruby SDK for robust protocol handling
|
|
9
|
-
- 📊 **Read-Only Queries**: Safe database querying with automatic result limiting
|
|
10
|
-
- 🔍 **Code Analysis**: Dry-run capabilities to analyze code before execution
|
|
11
|
-
- 📝 **Audit Logging**: Complete execution logging for security and debugging
|
|
12
|
-
- ⚙️ **Configurable**: Flexible configuration for different environments
|
|
13
|
-
- 🛡️ **Production Ready**: Strict safety modes for production environments
|
|
14
|
-
- ⚡ **Professional Implementation**: Built-in instrumentation, timing, and error handling
|
|
15
10
|
|
|
16
|
-
##
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
Get up and running in three steps:
|
|
14
|
+
|
|
15
|
+
### 1. Install the gem
|
|
17
16
|
|
|
18
|
-
Add
|
|
17
|
+
Add to your Rails application's `Gemfile`:
|
|
19
18
|
|
|
20
19
|
```ruby
|
|
21
20
|
gem 'rails-active-mcp'
|
|
22
21
|
```
|
|
23
22
|
|
|
24
|
-
And then execute:
|
|
25
|
-
|
|
26
23
|
```bash
|
|
27
24
|
bundle install
|
|
28
25
|
```
|
|
29
26
|
|
|
30
|
-
Run the installer
|
|
27
|
+
### 2. Run the installer
|
|
31
28
|
|
|
32
29
|
```bash
|
|
33
30
|
rails generate rails_active_mcp:install
|
|
34
31
|
```
|
|
35
32
|
|
|
36
|
-
This
|
|
37
|
-
|
|
38
|
-
- Create an initializer with configuration options
|
|
39
|
-
- Mount the MCP server for Rails integration
|
|
40
|
-
- Create a `mcp.ru` server file for standalone usage
|
|
41
|
-
- Set up audit logging
|
|
42
|
-
|
|
43
|
-
## Configuration
|
|
44
|
-
|
|
45
|
-
The gem is configured in `config/initializers/rails_active_mcp.rb`:
|
|
46
|
-
|
|
47
|
-
```ruby
|
|
48
|
-
RailsActiveMcp.configure do |config|
|
|
49
|
-
# Core configuration options
|
|
50
|
-
config.allowed_commands = %w[
|
|
51
|
-
ls pwd cat head tail grep find wc
|
|
52
|
-
rails console rails runner
|
|
53
|
-
bundle exec rspec bundle exec test
|
|
54
|
-
git status git log git diff
|
|
55
|
-
]
|
|
56
|
-
config.command_timeout = 30
|
|
57
|
-
config.enable_logging = true
|
|
58
|
-
config.log_level = :info
|
|
59
|
-
end
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## Running the MCP Server
|
|
63
|
-
|
|
64
|
-
The server runs in STDIO mode, perfect for Claude Desktop integration:
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
$ bundle exec rails-active-mcp-server
|
|
68
|
-
```
|
|
33
|
+
This creates an initializer, mounts the MCP engine, and generates a standalone server file.
|
|
69
34
|
|
|
70
|
-
|
|
71
|
-
- Loads your Rails application
|
|
72
|
-
- Initializes all models and configurations
|
|
73
|
-
- Provides secure access to your Rails environment
|
|
74
|
-
- Uses the official MCP Ruby SDK for protocol handling
|
|
35
|
+
### 3. Connect to Claude Desktop
|
|
75
36
|
|
|
76
|
-
|
|
37
|
+
Add the following to your Claude Desktop configuration file:
|
|
77
38
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
Add to your Claude Desktop configuration file:
|
|
81
|
-
|
|
82
|
-
**Location:**
|
|
83
|
-
- macOS/Linux: `~/.config/claude-desktop/claude_desktop_config.json`
|
|
84
|
-
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
39
|
+
- **macOS/Linux:** `~/.config/claude-desktop/claude_desktop_config.json`
|
|
40
|
+
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
85
41
|
|
|
86
42
|
```json
|
|
87
43
|
{
|
|
@@ -95,28 +51,54 @@ Add to your Claude Desktop configuration file:
|
|
|
95
51
|
}
|
|
96
52
|
```
|
|
97
53
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
```json
|
|
101
|
-
{
|
|
102
|
-
"mcpServers": {
|
|
103
|
-
"rails-active-mcp": {
|
|
104
|
-
"command": "rails-active-mcp-server",
|
|
105
|
-
"cwd": "/path/to/your/rails/project"
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
```
|
|
54
|
+
Restart Claude Desktop, and you're done. Four tools will appear automatically: `console_execute`, `model_info`, `safe_query`, and `dry_run`.
|
|
110
55
|
|
|
111
|
-
|
|
56
|
+
Try asking Claude:
|
|
112
57
|
|
|
113
58
|
- "Show me all users created in the last week"
|
|
114
59
|
- "What's the average order value?"
|
|
115
60
|
- "Check the User model schema and associations"
|
|
116
61
|
- "Analyze this code for safety: User.delete_all"
|
|
117
62
|
|
|
63
|
+
## Features
|
|
64
|
+
|
|
65
|
+
- 🔒 **Safe Execution**: Advanced safety checks prevent dangerous operations
|
|
66
|
+
- 🚀 **Official MCP SDK**: Built with the official MCP Ruby SDK for robust protocol handling
|
|
67
|
+
- 📊 **Read-Only Queries**: Safe database querying with automatic result limiting
|
|
68
|
+
- 🔍 **Code Analysis**: Dry-run capabilities to analyze code before execution
|
|
69
|
+
- 📝 **Audit Logging**: Complete execution logging for security and debugging
|
|
70
|
+
- ⚙️ **Configurable**: Flexible configuration for different environments
|
|
71
|
+
- 🛡️ **Production Ready**: Strict safety modes for production environments
|
|
72
|
+
- ⚡ **Professional Implementation**: Built-in instrumentation, timing, and error handling
|
|
73
|
+
|
|
74
|
+
## Configuration
|
|
75
|
+
|
|
76
|
+
The installer creates a default configuration at `config/initializers/rails_active_mcp.rb`. The defaults work out of the box, but you can customize behavior:
|
|
77
|
+
|
|
78
|
+
```ruby
|
|
79
|
+
RailsActiveMcp.configure do |config|
|
|
80
|
+
config.allowed_commands = %w[
|
|
81
|
+
ls pwd cat head tail grep find wc
|
|
82
|
+
rails console rails runner
|
|
83
|
+
bundle exec rspec bundle exec test
|
|
84
|
+
git status git log git diff
|
|
85
|
+
]
|
|
86
|
+
config.command_timeout = 30
|
|
87
|
+
config.enable_logging = true
|
|
88
|
+
config.log_level = :info
|
|
89
|
+
end
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Usage
|
|
93
|
+
|
|
94
|
+
### Claude Desktop (Recommended)
|
|
95
|
+
|
|
96
|
+
Once connected (see [Quick Start](#quick-start)), Claude Desktop automatically runs the MCP server for you. The server loads your Rails application, initializes models, and provides secure access to your Rails environment via STDIO transport.
|
|
97
|
+
|
|
118
98
|
### Direct Usage
|
|
119
99
|
|
|
100
|
+
You can also use the gem directly in Ruby:
|
|
101
|
+
|
|
120
102
|
```ruby
|
|
121
103
|
# Execute code safely
|
|
122
104
|
result = RailsActiveMcp.execute("User.count")
|
|
@@ -125,6 +107,17 @@ result = RailsActiveMcp.execute("User.count")
|
|
|
125
107
|
RailsActiveMcp.safe?("User.delete_all") # => false
|
|
126
108
|
```
|
|
127
109
|
|
|
110
|
+
### Running the Server Manually
|
|
111
|
+
|
|
112
|
+
If you need to run the server outside of Claude Desktop (e.g., for debugging):
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
bundle exec rails-active-mcp-server
|
|
116
|
+
|
|
117
|
+
# With debug logging
|
|
118
|
+
RAILS_MCP_DEBUG=1 bundle exec rails-active-mcp-server
|
|
119
|
+
```
|
|
120
|
+
|
|
128
121
|
## Available MCP Tools
|
|
129
122
|
|
|
130
123
|
The Rails Active MCP server provides four powerful tools that appear automatically in Claude Desktop:
|
|
@@ -249,26 +242,12 @@ All errors are properly reported through the MCP protocol with detailed messages
|
|
|
249
242
|
|
|
250
243
|
## Development and Testing
|
|
251
244
|
|
|
252
|
-
### Running Tests
|
|
253
|
-
|
|
254
|
-
```bash
|
|
255
|
-
$ bundle exec rspec
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
### Testing MCP Integration
|
|
259
|
-
|
|
260
245
|
```bash
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
This tests the MCP server output redirection and JSON protocol compliance.
|
|
246
|
+
# Run tests
|
|
247
|
+
bundle exec rspec
|
|
265
248
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
Set the debug environment variable for detailed logging:
|
|
269
|
-
|
|
270
|
-
```bash
|
|
271
|
-
$ RAILS_MCP_DEBUG=1 bundle exec rails-active-mcp-server
|
|
249
|
+
# Test MCP server protocol compliance
|
|
250
|
+
./bin/test-mcp-output
|
|
272
251
|
```
|
|
273
252
|
|
|
274
253
|
## Contributing
|
data/changelog.md
CHANGED
|
@@ -7,6 +7,51 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
### Changed
|
|
11
|
+
- CI: Expanded Rails matrix to include 8.0 and 8.1; added corresponding gemfiles.
|
|
12
|
+
- CI: Output JUnit XML via rspec_junit_formatter and ensure tmp/ exists for artifacts.
|
|
13
|
+
- CI: Fixed gem install step to use the correct hyphenated artifact name (rails-active-mcp-*.gem).
|
|
14
|
+
|
|
15
|
+
## [3.1.0] - 2026-02-09
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Updated MCP Ruby SDK from v0.4.0 to v0.7.0
|
|
20
|
+
- Added server metadata (websiteUrl, description) for improved discoverability in Claude Desktop
|
|
21
|
+
- Cleaned up duplicate gem declarations in Gemfile
|
|
22
|
+
- **BREAKING**: Removed Rails < 7.0 support
|
|
23
|
+
- Added Rails 8 support
|
|
24
|
+
|
|
25
|
+
### Internal
|
|
26
|
+
|
|
27
|
+
- Leveraged MCP SDK v0.7.0 (includes v0.6.0) icon optimization (omit when nil/empty)
|
|
28
|
+
- Aligned with MCP SDK v0.5.0 serverInfo enhancements
|
|
29
|
+
|
|
30
|
+
### Migration
|
|
31
|
+
|
|
32
|
+
Run `bundle update mcp` to upgrade.
|
|
33
|
+
|
|
34
|
+
## [3.0.0] - 2025-12-01
|
|
35
|
+
|
|
36
|
+
### Changed
|
|
37
|
+
|
|
38
|
+
- **BREAKING**: Updated to MCP Ruby SDK v0.4.0 (was v0.1.0)
|
|
39
|
+
- **BREAKING**: Requires Ruby >= 3.2.0 (was >= 3.1.0)
|
|
40
|
+
- **BREAKING**: Updated to MCP protocol version 2025-11-25
|
|
41
|
+
- Tool error responses now include `is_error: true` flag per MCP 2025-11-25 specification
|
|
42
|
+
|
|
43
|
+
### Fixed
|
|
44
|
+
|
|
45
|
+
- Input validation errors are now returned as Tool Execution Errors instead of Protocol Errors (MCP 2025-11-25 compliance)
|
|
46
|
+
|
|
47
|
+
### Migration Guide
|
|
48
|
+
|
|
49
|
+
For users upgrading from v2.x:
|
|
50
|
+
|
|
51
|
+
1. Ensure you are running Ruby 3.2.0 or higher
|
|
52
|
+
2. Run `bundle update rails-active-mcp` to update the gem and its dependencies
|
|
53
|
+
3. No configuration changes are required
|
|
54
|
+
|
|
10
55
|
## [2.0.0] - 2025-01-15
|
|
11
56
|
|
|
12
57
|
### Added
|
|
@@ -82,35 +127,35 @@ For users upgrading from v1.x:
|
|
|
82
127
|
|
|
83
128
|
- Initial release of Rails Active MCP gem
|
|
84
129
|
- Core MCP tools for Rails console access:
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
130
|
+
- `console_execute`: Execute Ruby code with safety checks
|
|
131
|
+
- `safe_query`: Execute read-only database queries
|
|
132
|
+
- `dry_run`: Analyze code safety without execution
|
|
133
|
+
- `model_info`: Get model schema and associations
|
|
89
134
|
- Advanced safety checking system:
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
135
|
+
- Pattern-based dangerous operation detection
|
|
136
|
+
- Configurable safety levels (critical, high, medium, low)
|
|
137
|
+
- Read-only operation detection
|
|
138
|
+
- Custom safety pattern support
|
|
94
139
|
- Comprehensive configuration system:
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
140
|
+
- Environment-specific presets (production, development, test)
|
|
141
|
+
- Model access control (allow/block lists)
|
|
142
|
+
- Timeout and result limiting
|
|
143
|
+
- Audit logging configuration
|
|
99
144
|
- Rails integration:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
145
|
+
- Rails engine for automatic setup
|
|
146
|
+
- Generator for easy installation
|
|
147
|
+
- Rake tasks for management and testing
|
|
148
|
+
- Active MCP integration
|
|
104
149
|
- Security features:
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
150
|
+
- Execution timeout protection
|
|
151
|
+
- Result size limiting
|
|
152
|
+
- Complete audit logging
|
|
153
|
+
- Environment-based safety modes
|
|
109
154
|
- Console executor with:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
155
|
+
- Output capturing
|
|
156
|
+
- Error handling
|
|
157
|
+
- Execution timing
|
|
158
|
+
- Context isolation
|
|
114
159
|
|
|
115
160
|
### Security
|
|
116
161
|
|
|
@@ -125,4 +170,4 @@ For users upgrading from v1.x:
|
|
|
125
170
|
|
|
126
171
|
- Project initialization
|
|
127
172
|
- Basic gem structure
|
|
128
|
-
- Initial safety checker implementation
|
|
173
|
+
- Initial safety checker implementation
|
data/docker-compose.yml
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
version: '3.8'
|
|
2
|
+
|
|
3
|
+
services:
|
|
4
|
+
# Service for running tests
|
|
5
|
+
test:
|
|
6
|
+
build: .
|
|
7
|
+
volumes:
|
|
8
|
+
- .:/app
|
|
9
|
+
- bundle_cache:/usr/local/bundle
|
|
10
|
+
environment:
|
|
11
|
+
- RAILS_ENV=test
|
|
12
|
+
command: bundle exec rspec
|
|
13
|
+
stdin_open: true
|
|
14
|
+
tty: true
|
|
15
|
+
|
|
16
|
+
# Service for the MCP server (for Claude Desktop integration)
|
|
17
|
+
mcp-server:
|
|
18
|
+
build: .
|
|
19
|
+
volumes:
|
|
20
|
+
- .:/app
|
|
21
|
+
- bundle_cache:/usr/local/bundle
|
|
22
|
+
working_dir: /app
|
|
23
|
+
stdin_open: true
|
|
24
|
+
tty: false
|
|
25
|
+
command: bundle exec rails-active-mcp-server
|
|
26
|
+
environment:
|
|
27
|
+
- RAILS_ENV=development
|
|
28
|
+
|
|
29
|
+
# Service for example Rails app
|
|
30
|
+
example-app:
|
|
31
|
+
build: .
|
|
32
|
+
volumes:
|
|
33
|
+
- .:/app
|
|
34
|
+
- bundle_cache:/usr/local/bundle
|
|
35
|
+
- example_db:/app/example/db
|
|
36
|
+
working_dir: /app/example
|
|
37
|
+
ports:
|
|
38
|
+
- "3000:3000"
|
|
39
|
+
environment:
|
|
40
|
+
- RAILS_ENV=development
|
|
41
|
+
command: bundle exec rails server -b 0.0.0.0
|
|
42
|
+
stdin_open: true
|
|
43
|
+
tty: true
|
|
44
|
+
|
|
45
|
+
# Interactive shell for development
|
|
46
|
+
dev:
|
|
47
|
+
build: .
|
|
48
|
+
volumes:
|
|
49
|
+
- .:/app
|
|
50
|
+
- bundle_cache:/usr/local/bundle
|
|
51
|
+
environment:
|
|
52
|
+
- RAILS_ENV=development
|
|
53
|
+
command: bash
|
|
54
|
+
stdin_open: true
|
|
55
|
+
tty: true
|
|
56
|
+
|
|
57
|
+
volumes:
|
|
58
|
+
bundle_cache:
|
|
59
|
+
example_db:
|
data/docs/DEBUGGING.md
CHANGED
|
@@ -204,7 +204,7 @@ bundle exec rails-active-mcp-server http --port 8080
|
|
|
204
204
|
3. Verify server process starts: `ps aux | grep rails-active-mcp`
|
|
205
205
|
4. Test basic JSON-RPC response:
|
|
206
206
|
```bash
|
|
207
|
-
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-
|
|
207
|
+
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}}}' | bundle exec rails-active-mcp-server stdio
|
|
208
208
|
```
|
|
209
209
|
|
|
210
210
|
## Logging Implementation
|
|
@@ -249,7 +249,7 @@ end
|
|
|
249
249
|
|
|
250
250
|
```bash
|
|
251
251
|
# Test initialize method
|
|
252
|
-
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-
|
|
252
|
+
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}}}' | bundle exec rails-active-mcp-server stdio
|
|
253
253
|
```
|
|
254
254
|
|
|
255
255
|
Expected response:
|
|
@@ -258,7 +258,7 @@ Expected response:
|
|
|
258
258
|
"jsonrpc":"2.0",
|
|
259
259
|
"id":1,
|
|
260
260
|
"result": {
|
|
261
|
-
"protocolVersion":"2025-
|
|
261
|
+
"protocolVersion":"2025-11-25",
|
|
262
262
|
"capabilities":{"tools":{},"resources":{}},
|
|
263
263
|
"serverInfo":{"name":"rails-active-mcp","version":"..."}
|
|
264
264
|
}
|