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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b57d865e11d3ed07608432c2ccd25a067fa7543107fca64363988d377e05adb
4
- data.tar.gz: e4cbc30b81b2fc09315c212f55bc99117643db0b3feaf841d314f117c5d13bf4
3
+ metadata.gz: 3d49b854cf56a160369f69fbc1d237e6ffc5ece9a82216c8689346927bc5f93f
4
+ data.tar.gz: 935a608f0ff2f97d597e07dcd7301ddb44bef0251ebe08e23edf4626729cc3a4
5
5
  SHA512:
6
- metadata.gz: be8e2c87865728bbfb73bd78c1731932f08f55c7792efd2df934d505b4470d3c2002a9a2c86112fdc043aaaf6f69262dbf857cd55c16041d384d6d542f900f70
7
- data.tar.gz: 1f885e3663310dfc73f8e73e7d2b6af97334c1eea9ab885f6100153775c4a7227c34a13afa2c78b46bc4968c2171d6a63f5ba4eb6c7cc25f9ca45472c824607d
6
+ metadata.gz: 17963ea878ccb01318f4437dce9730fa6133f2bce70e6abee35366fc29bb67982c69c4c1523ecc4fc9018bf5253d4c3a03166160cba8af1b84cc851ed8245232
7
+ data.tar.gz: 016f5702235ba3b59502213327d0d44937958ba1a984b92d82f696c95ae431c752e9715a2fb41285add7c8631fe684d57341c6bdf6e5edf0119a5c9779bd738a
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Rails PG Extras MCP [![Gem Version](https://badge.fury.io/rb/rails-pg-extras-mcp.svg)](https://badge.fury.io/rb/rails-pg-extras-mcp) [![GH Actions](https://github.com/pawurb/rails-pg-extras-mcp/actions/workflows/ci.yml/badge.svg)](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. It enables PostgreSQL metadata and performance analysis with a simple LLM prompt.
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
  ![LLM interface](https://github.com/pawurb/rails-pg-extras/raw/main/pg-extras-mcp.png)
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 RailsPgExtras.mcp_app, at: "pg-extras-mcp"
19
+ mount RailsPgExtrasMcp::App.build, at: "pg-extras-mcp"
20
20
  ```
21
21
 
22
22
  with optional authorization:
23
23
 
24
24
  ```ruby
25
- mount RailsPgExtras.mcp_app(auth_token: "secret"), at: "pg-extras-mcp"
25
+ opts = { auth_token: "secret" }
26
+ mount RailsPgExtrasMcp::App.build(opts), at: "pg-extras-mcp"
26
27
  ```
27
28
 
28
- Install [mcp-remote](https://github.com/geelen/mcp-remote):
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
@@ -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(auth_token: nil)
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
- opts = {
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
- if auth_token.present?
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,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsPgExtrasMcp
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.4"
5
5
  end
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.2
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-23 00:00:00.000000000 Z
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