rails-pg-extras-mcp 0.2.3 → 0.2.5
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/README.md +1 -1
- data/lib/rails-pg-extras-mcp.rb +16 -5
- data/lib/rails_pg_extras_mcp/version.rb +1 -1
- data/rails-pg-extras-mcp.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1b4509d036ac44d7408f298e5809c97517b938a17b767b495ecc49a6829030dd
|
|
4
|
+
data.tar.gz: 4de56739fdb9f9a55246468c49389dd797a48f44fa140fd7928fbe0d67525701
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 748259151e1174a0352136ae9168978b19beea269cae6fb56b72e4afd9a8f07e818394174f26b14e1737f6e4c461de8aa2fa527c476b61f7a0178ab1074d772a
|
|
7
|
+
data.tar.gz: 0e4ca375b7e0366cc2a3b08c10915576de3fe97b5fbf5f8ebb545e153ce14298a7d38adb6e6da0c69e1b3aa5056991d343678ebeeb75b52558ecb8566137bfa3
|
data/README.md
CHANGED
|
@@ -67,7 +67,7 @@ You can enable them by setting the following `ENV` variables:
|
|
|
67
67
|
`ENV['PG_EXTRAS_MCP_EXPLAIN_ENABLED'] = 'true'`
|
|
68
68
|
`ENV['PG_EXTRAS_MCP_EXPLAIN_ANALYZE_ENABLED'] = 'true'`
|
|
69
69
|
|
|
70
|
-
Enabling these features means that an LLM, can run arbitrary queries in your database. The execution context is wrapped in a transaction and rolled back, so, in theory, any data modification should not be possible. But it's advised to configure a read-only permission if you want to use these features. By specifying `ENV['
|
|
70
|
+
Enabling these features means that an LLM, can run arbitrary queries in your database. The execution context is wrapped in a transaction and rolled back, so, in theory, any data modification should not be possible. But it's advised to configure a read-only permission if you want to use these features. By specifying `ENV['RAILS_PG_EXTRAS_MCP_DATABASE_URL']` you can overwrite the default Rails ActiveRecord database connection to restrict an access scope:
|
|
71
71
|
|
|
72
72
|
## Status
|
|
73
73
|
|
data/lib/rails-pg-extras-mcp.rb
CHANGED
|
@@ -85,11 +85,18 @@ class ExplainBaseTool < FastMcp::Tool
|
|
|
85
85
|
raise "This query is not allowed. It contains a denied keyword. Denylist: #{DENYLIST.join(", ")}"
|
|
86
86
|
end
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
# Prevent multiple queries in one request
|
|
89
|
+
sql_query = sql_query.gsub(/;/, "")
|
|
90
|
+
|
|
91
|
+
connection.execute("BEGIN;")
|
|
92
|
+
begin
|
|
93
|
+
result = connection.execute("#{sql_query}")
|
|
94
|
+
connection.execute("ROLLBACK;")
|
|
95
|
+
result.to_a
|
|
96
|
+
rescue => e
|
|
97
|
+
connection.execute("ROLLBACK;") rescue nil
|
|
98
|
+
raise e
|
|
99
|
+
end
|
|
93
100
|
end
|
|
94
101
|
end
|
|
95
102
|
|
|
@@ -222,6 +229,10 @@ module RailsPgExtrasMcp
|
|
|
222
229
|
server.register_tools(ExplainAnalyzeTool) if ENV["PG_EXTRAS_MCP_EXPLAIN_ANALYZE_ENABLED"] == "true"
|
|
223
230
|
|
|
224
231
|
server.register_resource(ReadmeResource)
|
|
232
|
+
|
|
233
|
+
if !ENV["RAILS_PG_EXTRAS_MCP_DATABASE_URL"].to_s.empty?
|
|
234
|
+
RailsPgExtras.database_url = ENV["RAILS_PG_EXTRAS_MCP_DATABASE_URL"]
|
|
235
|
+
end
|
|
225
236
|
end
|
|
226
237
|
end
|
|
227
238
|
end
|
data/rails-pg-extras-mcp.gemspec
CHANGED
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
|
|
|
15
15
|
s.test_files = s.files.grep(%r{^(spec)/})
|
|
16
16
|
s.require_paths = ["lib"]
|
|
17
17
|
s.license = "MIT"
|
|
18
|
-
s.add_dependency "rails-pg-extras", "~> 5.6"
|
|
18
|
+
s.add_dependency "rails-pg-extras", "~> 5.6.12"
|
|
19
19
|
s.add_dependency "rails"
|
|
20
20
|
s.add_dependency "fast-mcp"
|
|
21
21
|
s.add_development_dependency "rake"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rails-pg-extras-mcp
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- pawurb
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-07-
|
|
11
|
+
date: 2025-07-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails-pg-extras
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
19
|
+
version: 5.6.12
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
26
|
+
version: 5.6.12
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: rails
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|