rails-active-mcp 0.1.5 → 0.1.6

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: ab07c3ba6b1a97791cbaa3345aadb3cc43fb2c28b6c5008bace92f1c4dc089f3
4
- data.tar.gz: c1489640a38d8c4ee0e886ab0b311bb6ee1e7a2cfb06b71bdef2ef8a7b329d6d
3
+ metadata.gz: b477f00244c6b1b3370cc65295e401e4976d2c793e6d7344350866f5a21156eb
4
+ data.tar.gz: 38f43074ef26d934177dbd4a169efcd2f4b7c5cccac8b276e4927de7e5cca4cd
5
5
  SHA512:
6
- metadata.gz: aac5e4ebc969fb723c24f48ba7f00e33b3b374df75816d4ce6c1af85278eff95575005a4c045a1c47c6ffa87cf4d1802e98a738af3860291e1b5f38bdaa57f1a
7
- data.tar.gz: aa77ab523129a8419dc70f562915a2a78e8cd57dc9a6a64dbe29810131797a56ee66e7d92dda5d85dd903217128fe29202e44077b84d6e47da9bb99333fe6cd5
6
+ metadata.gz: de2f7f0d0d4a2122dc2e83da7f3d3e9da08fc0d94ea93c61cf63fa2f4861695624c30da605ada7ff81f6a50dd8698b211f7b01bd54c128815d851f812e622d12
7
+ data.tar.gz: de6ce9166bb2da50fc492a784bac432e632d0d26dec52c1c506a49038d99c05dfe042819b67b70c98ff2371a3d0f1fc1e042f32ba48fc0470023ed0f011be3cd
@@ -3,11 +3,9 @@
3
3
 
4
4
  require 'rack'
5
5
  require 'json'
6
+ require 'stringio'
6
7
  require_relative '../lib/rails_active_mcp'
7
8
 
8
- # Load Rails configuration if available
9
- require_relative '../config/environment' if File.exist?('config/environment.rb')
10
-
11
9
  # Parse command line options with config defaults
12
10
  default_mode = if defined?(RailsActiveMcp) && RailsActiveMcp.respond_to?(:config)
13
11
  RailsActiveMcp.config.server_mode.to_s
@@ -35,8 +33,21 @@ when 'stdio'
35
33
  require_relative '../lib/rails_active_mcp/stdio_server'
36
34
 
37
35
  begin
38
- # Initialize Rails environment if available
39
- require_relative '../config/environment' if File.exist?('config/environment.rb')
36
+ # Initialize Rails environment if available (from current working directory)
37
+ if File.exist?('config/environment.rb')
38
+ # Suppress Rails output to avoid interfering with MCP JSON protocol
39
+ original_stdout = $stdout
40
+ $stdout = StringIO.new
41
+
42
+ begin
43
+ require './config/environment'
44
+ rescue StandardError => e
45
+ # Log to stderr but don't fail - the server can work without Rails
46
+ warn "Warning: Could not load Rails environment: #{e.message}"
47
+ ensure
48
+ $stdout = original_stdout
49
+ end
50
+ end
40
51
 
41
52
  stdio_server = RailsActiveMcp::StdioServer.new
42
53
  stdio_server.run
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsActiveMcp
4
- VERSION = '0.1.5'
4
+ VERSION = '0.1.6'
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: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandyn Britton