rails-active-mcp 3.1.3 → 3.1.4

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: cbc29cab9dac2a2f86b9c6c2f45e2df79ad898ad9f0abe5e739c1f24a7eadc14
4
- data.tar.gz: 166ced9027b707ec7d870e521b68ee03f9f862eb32a84eea830e7a09a674fcc0
3
+ metadata.gz: 9ffb5b6aa939b08d7b36865cdd2fc0f8d8e11d4284204291a1b12df98b1ac924
4
+ data.tar.gz: b8aef125e7fa0e41c84761b9f01f6b7e27db5bd22ccdb58369ba3eed3b265218
5
5
  SHA512:
6
- metadata.gz: bc890640b9c263293ad5627b60dc23da6589b4335ac158ce08176970e00cd89cea08c7ce013a425ab2aa98a028b53f0532ad2465f4662d7980100dee11b4d34d
7
- data.tar.gz: 673b5f4966bbe4ab2dfb6c3c26065ae29a3ef9ed6811eb1b8a7e6e6102bdf3717d0cb8ac4beed60ffe884632e46eb4d05d5e0a08e880a023648224fa79bbed52
6
+ metadata.gz: 74a929edbc48349b135449a9579ecd3c40a623e7a9ba7e05438f36d38acedd68b84ae2b5b13078a88c6d811fbb70bd1716f051f104ce925af108b69734eeab83
7
+ data.tar.gz: 4d73e8c4f26772cc4f3642d22e07f45e6e3ff87a7e3fd9f102a05ec75a04a393f48597d0bcc12fbf89364e9b01b1d1115bbb05bab3efcdf7532e933b6de50e32
@@ -1,89 +1,27 @@
1
1
  #!/usr/bin/env bash
2
2
 
3
3
  # Rails Active MCP Wrapper Script
4
- # This script ensures Rails Active MCP works reliably across different Ruby version managers
5
- # when launched from MCP hosts (Claude Desktop, Claude Code, etc.) which may not have
6
- # the user's shell profile loaded.
4
+ # Re-execs through the user's login shell to pick up Ruby version manager
5
+ # configuration (rbenv, asdf, mise, rvm, chruby, etc.) that MCP hosts
6
+ # don't load automatically.
7
7
 
8
- # Get the directory where this script is located
9
8
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10
9
  PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
10
+ USER_SHELL="${SHELL:-/bin/bash}"
11
11
 
12
- # Change to the Rails project directory
13
- cd "$PROJECT_ROOT" || {
14
- echo "Error: Cannot change to project root directory: $PROJECT_ROOT" >&2
15
- exit 1
16
- }
12
+ # Save real stdout to fd 3, redirect stdout to stderr during shell init
13
+ # to prevent profile output from corrupting MCP protocol
14
+ exec 3>&1 1>&2
17
15
 
18
- # Setup Ruby environment by adding version manager shims to PATH.
19
- # Shims are self-contained scripts that route to the correct Ruby version
20
- # without requiring full shell initialization (eval, source, etc.).
21
- # This works reliably even in non-interactive contexts like MCP hosts.
22
- setup_ruby_path() {
23
- # rbenv: shims directory handles version switching
24
- local rbenv_root="${RBENV_ROOT:-$HOME/.rbenv}"
25
- if [ -d "$rbenv_root/shims" ]; then
26
- export PATH="$rbenv_root/shims:$PATH"
27
- return
28
- fi
29
-
30
- # asdf: shims directory handles version switching
31
- local asdf_data="${ASDF_DATA_DIR:-$HOME/.asdf}"
32
- if [ -d "$asdf_data/shims" ]; then
33
- export PATH="$asdf_data/shims:$PATH"
34
- return
35
- fi
16
+ exec "$USER_SHELL" -l -c '
17
+ exec 1>&3 3>&- # restore real stdout for MCP server
36
18
 
37
- # mise (formerly rtx): shims directory
38
- local mise_data="${MISE_DATA_DIR:-$HOME/.local/share/mise}"
39
- if [ -d "$mise_data/shims" ]; then
40
- export PATH="$mise_data/shims:$PATH"
41
- return
42
- fi
43
-
44
- # rvm: requires sourcing but check for it
45
- if [ -d "$HOME/.rvm/rubies" ]; then
46
- if [ -f "$HOME/.rvm/scripts/rvm" ]; then
47
- source "$HOME/.rvm/scripts/rvm"
48
- fi
49
- return
50
- fi
19
+ cd "$1" || { echo "Error: Cannot cd to $1" >&2; exit 1; }
51
20
 
52
- # chruby: check common install locations
53
- if [ -f /usr/local/share/chruby/chruby.sh ]; then
54
- source /usr/local/share/chruby/chruby.sh
55
- [ -f /usr/local/share/chruby/auto.sh ] && source /usr/local/share/chruby/auto.sh
56
- return
21
+ if [ ! -f "Gemfile" ]; then
22
+ echo "Error: Gemfile not found" >&2; exit 1
57
23
  fi
58
- if [ -f /opt/homebrew/share/chruby/chruby.sh ]; then
59
- source /opt/homebrew/share/chruby/chruby.sh
60
- [ -f /opt/homebrew/share/chruby/auto.sh ] && source /opt/homebrew/share/chruby/auto.sh
61
- return
62
- fi
63
- }
64
-
65
- setup_ruby_path
66
-
67
- # Verify we have the necessary files
68
- if [ ! -f "Gemfile" ]; then
69
- echo "Error: Gemfile not found in $PROJECT_ROOT" >&2
70
- echo "Please ensure you're running this from a Rails application root" >&2
71
- exit 1
72
- fi
73
-
74
- if [ ! -f "config/environment.rb" ]; then
75
- echo "Warning: config/environment.rb not found. This may not be a Rails application." >&2
76
- fi
77
-
78
- # Set default environment if not specified
79
- export RAILS_ENV="${RAILS_ENV:-development}"
80
-
81
- # Ensure we have the rails-active-mcp gem available
82
- if ! bundle list 2>/dev/null | grep -q "rails-active-mcp"; then
83
- echo "Error: rails-active-mcp gem not found in bundle" >&2
84
- echo "Please run: bundle install" >&2
85
- exit 1
86
- fi
87
24
 
88
- # Execute the Rails Active MCP server
89
- exec bundle exec rails-active-mcp-server "$@"
25
+ export RAILS_ENV="${RAILS_ENV:-development}"
26
+ exec bundle exec rails-active-mcp-server "$@"
27
+ ' _ "$PROJECT_ROOT" "$@"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsActiveMcp
4
- VERSION = '3.1.3'
4
+ VERSION = '3.1.4'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-active-mcp
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.3
4
+ version: 3.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandyn Britton