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 +4 -4
- data/exe/rails-active-mcp-server +16 -5
- data/lib/rails_active_mcp/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b477f00244c6b1b3370cc65295e401e4976d2c793e6d7344350866f5a21156eb
|
4
|
+
data.tar.gz: 38f43074ef26d934177dbd4a169efcd2f4b7c5cccac8b276e4927de7e5cca4cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de2f7f0d0d4a2122dc2e83da7f3d3e9da08fc0d94ea93c61cf63fa2f4861695624c30da605ada7ff81f6a50dd8698b211f7b01bd54c128815d851f812e622d12
|
7
|
+
data.tar.gz: de6ce9166bb2da50fc492a784bac432e632d0d26dec52c1c506a49038d99c05dfe042819b67b70c98ff2371a3d0f1fc1e042f32ba48fc0470023ed0f011be3cd
|
data/exe/rails-active-mcp-server
CHANGED
@@ -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
|
-
|
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
|