pgmoat 0.0.0-stage → 0.1.1

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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +100 -2
  3. package/dist/bin.mjs +58526 -0
  4. package/package.json +59 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kitalon Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,101 @@
1
- # Temporary Holding Version
1
+ # pgmoat
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ > Governed Postgres access for AI agents.
4
+
5
+ pgmoat is an open-source MCP server that gives AI agents read-only access to Postgres. It checks every query with the real Postgres parser, hides the tables and columns you mark hidden, applies row limits and timeouts, binds Row-Level Security to the caller's identity, and writes a tamper-evident audit log.
6
+
7
+ Requires Node.js 22.12 or newer and Postgres 15 to 18.
8
+
9
+ ## Quickstart
10
+
11
+ Run it against your database with safe defaults, no config file needed:
12
+
13
+ ```bash
14
+ npx -y pgmoat postgresql://readonly_user:password@localhost:5432/mydb
15
+ ```
16
+
17
+ Add it to Claude Code:
18
+
19
+ ```bash
20
+ claude mcp add pgmoat -- npx -y pgmoat postgresql://readonly_user:password@localhost:5432/mydb
21
+ ```
22
+
23
+ Or to Claude Desktop (`claude_desktop_config.json`):
24
+
25
+ ```json
26
+ {
27
+ "mcpServers": {
28
+ "pgmoat": {
29
+ "command": "npx",
30
+ "args": ["-y", "pgmoat", "--url-env", "PGMOAT_DATABASE_URL"],
31
+ "env": { "PGMOAT_DATABASE_URL": "postgresql://readonly_user:password@localhost:5432/mydb" }
32
+ }
33
+ }
34
+ }
35
+ ```
36
+
37
+ Passing the URL through `--url-env` keeps the password out of process listings.
38
+
39
+ Use a dedicated read-only role. pgmoat warns at startup if the role is a superuser or can write.
40
+
41
+ ## Add descriptions and hide sensitive data
42
+
43
+ ```bash
44
+ export PGMOAT_DATABASE_URL=postgresql://readonly_user:password@localhost:5432/mydb
45
+ npx pgmoat init # writes pgmoat.yaml; auto-hides columns like password_hash and token_hash
46
+ npx pgmoat validate # checks the file against the schema and the database
47
+ npx pgmoat doctor # checks the role for unsafe privileges
48
+ npx pgmoat start # starts the server with ./pgmoat.yaml
49
+ ```
50
+
51
+ A `pgmoat.yaml` looks like this:
52
+
53
+ ```yaml
54
+ version: 1
55
+ server:
56
+ name: mydb
57
+ connection:
58
+ url: ${PGMOAT_DATABASE_URL}
59
+ schemas: [public]
60
+ mode: read-only
61
+ budgets:
62
+ max_rows: 200
63
+ max_query_ms: 5000
64
+ tables:
65
+ users:
66
+ description: "One row per login account"
67
+ columns:
68
+ password_hash: { hidden: true }
69
+ email: { sensitive: high }
70
+ ```
71
+
72
+ ## Commands
73
+
74
+ | Command | What it does |
75
+ |---|---|
76
+ | `pgmoat <postgres-url>` | Start with safe defaults (no config file) |
77
+ | `pgmoat init` | Create `pgmoat.yaml` from your database |
78
+ | `pgmoat start` | Start the MCP server from `pgmoat.yaml` |
79
+ | `pgmoat validate` | Check `pgmoat.yaml` against the schema and the database |
80
+ | `pgmoat doctor` | Check the database role for unsafe privileges |
81
+ | `pgmoat audit verify` | Verify the audit log hash chain |
82
+ | `pgmoat schema-export` | Write the visible schema as Markdown |
83
+
84
+ Run `pgmoat --help` for all options.
85
+
86
+ ## What pgmoat does not do
87
+
88
+ - **It does not stop prompt injection.** It removes the write path, hides what you mark hidden, and labels returned data as untrusted, but an agent with other tools (web access, email) can still be tricked into sending readable data elsewhere.
89
+ - **It does not replace Postgres permissions.** The strongest control is a dedicated role with only the grants it needs.
90
+ - **It does not make RLS policies correct.** It sets the session variables your policies read. A flawed policy stays flawed.
91
+ - **It does not guarantee audit delivery to a remote destination during an outage.** It buffers, alarms, and records drops.
92
+
93
+ ## Links
94
+
95
+ - Docs: https://kitalonlabs.com/pgmoat/docs
96
+ - Source and issues: https://github.com/Kitalon-Labs-LLC/pgmoat
97
+ - Security reports: security@kitalonlabs.com
98
+
99
+ ## License
100
+
101
+ MIT (c) 2026 Kitalon Labs