rails-pg-extras-mcp 0.1.2 → 0.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 +4 -4
- data/README.md +7 -4
- data/lib/rails-pg-extras-mcp.rb +5 -6
- data/lib/rails_pg_extras_mcp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d49b854cf56a160369f69fbc1d237e6ffc5ece9a82216c8689346927bc5f93f
|
4
|
+
data.tar.gz: 935a608f0ff2f97d597e07dcd7301ddb44bef0251ebe08e23edf4626729cc3a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17963ea878ccb01318f4437dce9730fa6133f2bce70e6abee35366fc29bb67982c69c4c1523ecc4fc9018bf5253d4c3a03166160cba8af1b84cc851ed8245232
|
7
|
+
data.tar.gz: 016f5702235ba3b59502213327d0d44937958ba1a984b92d82f696c95ae431c752e9715a2fb41285add7c8631fe684d57341c6bdf6e5edf0119a5c9779bd738a
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Rails PG Extras MCP [](https://badge.fury.io/rb/rails-pg-extras-mcp) [](https://github.com/pawurb/rails-pg-extras-mcp/actions)
|
2
2
|
|
3
|
-
MCP ([Model Context Protocol](https://modelcontextprotocol.io/introduction)) interface for [rails-pg-extras](https://github.com/pawurb/rails-pg-extras) gem.
|
3
|
+
MCP ([Model Context Protocol](https://modelcontextprotocol.io/introduction)) interface for [rails-pg-extras](https://github.com/pawurb/rails-pg-extras) gem. Easily explore PostgreSQL performance and metadata. Check for table bloat, slow queries, unused indexes, and more. Run `EXPLAIN ANALYZE` on bottlenecks and get clear, LLM-powered insights to optimize your database.
|
4
4
|
|
5
5
|

|
6
6
|
|
@@ -16,16 +16,19 @@ The library supports MCP protocol via HTTP SSE interface.
|
|
16
16
|
`config/routes.rb`
|
17
17
|
|
18
18
|
```ruby
|
19
|
-
mount
|
19
|
+
mount RailsPgExtrasMcp::App.build, at: "pg-extras-mcp"
|
20
20
|
```
|
21
21
|
|
22
22
|
with optional authorization:
|
23
23
|
|
24
24
|
```ruby
|
25
|
-
|
25
|
+
opts = { auth_token: "secret" }
|
26
|
+
mount RailsPgExtrasMcp::App.build(opts), at: "pg-extras-mcp"
|
26
27
|
```
|
27
28
|
|
28
|
-
|
29
|
+
Refer to the [fast-mcp docs](https://github.com/yjacquin/fast-mcp) for a complete list of supported options (the `opts` hash is passed directly as-is). For real-world deployments, you'll likely need to configure the `:allowed_origins` setting.
|
30
|
+
|
31
|
+
Next, install [mcp-remote](https://github.com/geelen/mcp-remote):
|
29
32
|
|
30
33
|
```bash
|
31
34
|
npm install -g mcp-remote
|
data/lib/rails-pg-extras-mcp.rb
CHANGED
@@ -4,6 +4,7 @@ require "fast_mcp"
|
|
4
4
|
require "rack"
|
5
5
|
require "ruby-pg-extras"
|
6
6
|
require "rails-pg-extras"
|
7
|
+
require "rails_pg_extras_mcp/version"
|
7
8
|
|
8
9
|
SKIP_QUERIES = %i[
|
9
10
|
add_extensions
|
@@ -138,24 +139,22 @@ end
|
|
138
139
|
|
139
140
|
module RailsPgExtrasMcp
|
140
141
|
class App
|
141
|
-
def self.build(
|
142
|
+
def self.build(opts = {})
|
142
143
|
app = lambda do |_env|
|
143
144
|
[200, { "Content-Type" => "text/html" },
|
144
145
|
["<html><body><h1>Hello from Rack!</h1><p>This is a simple Rack app with MCP middleware.</p></body></html>"]]
|
145
146
|
end
|
146
147
|
|
147
|
-
|
148
|
+
default_opts = {
|
148
149
|
name: "rails-pg-extras-mcp",
|
149
150
|
version: RailsPgExtrasMcp::VERSION,
|
150
151
|
path_prefix: "/pg-extras-mcp",
|
151
152
|
logger: Logger.new($stdout),
|
152
153
|
}
|
153
154
|
|
154
|
-
|
155
|
-
opts[:auth_token] = auth_token
|
156
|
-
end
|
155
|
+
opts = default_opts.merge(opts)
|
157
156
|
|
158
|
-
rack_method_name = auth_token.present? ? :authenticated_rack_middleware : :rack_middleware
|
157
|
+
rack_method_name = opts[:auth_token].present? ? :authenticated_rack_middleware : :rack_middleware
|
159
158
|
|
160
159
|
# Create the MCP middleware
|
161
160
|
mcp_app = FastMcp.public_send(rack_method_name,
|
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.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pawurb
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-06-
|
11
|
+
date: 2025-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails-pg-extras
|