Governed, read-only Postgres access for AI agents: SQL safety, RLS, budgets, tamper-evident audit.
MCPpedia last refreshed this data
io.github.Kitalon-Labs-LLC/pgmoat is an MCP server that governed, read-only Postgres access for AI agents: SQL safety, RLS, budgets, tamper-evident audit. Its tool list has not been published yet over stdio, requires no API key, and scores 87/100 on MCPpedia's security, maintenance and efficiency rubric.
Config is the same across clients - only the file and path differ.
{
"mcpServers": {
"pgmoat": {
"env": {
"PGMOAT_DATABASE_URL": "postgresql://readonly_user:password@localhost:5432/mydb"
},
"args": [
"-y",
"pgmoat",
"--url-env",
"PGMOAT_DATABASE_URL"
],
"command": "npx"
}
}
}Are you the author?
Add this badge to your README to show your security score and help users find safe servers.
Governed, read-only Postgres access for AI agents: SQL safety, RLS, budgets, tamper-evident audit.
Run this in your terminal to verify the server starts. Then let us know if it worked - your result helps other developers.
npx -y 'pgmoat' 2>&1 | head -1 && echo "✓ Server started successfully"
After testing, let us know if it worked:
Five weighted categories - click any category to see the underlying evidence.
No known CVEs.
Checked pgmoat against OSV.dev.
Click any tool to inspect its schema.
Be the first to review
Have you used this server?
Share your experience - it helps other developers decide.
Sign in to write a review.
Others in data / ai-ml
MCP server for mobile app automation: verify, control, and debug iOS, Android, TV, and desktop apps
Token-efficient database MCP server for PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, SQLite
2,700+ scientific tools for AI scientists: life science, research, literature, and more.
Analyze the Indonesian stock market (IDX/IHSG) from web terminal, CLI, or any AI agents via MCP server. IHSG Prices, Fundamentals, and Screening. Free and No API keys required. Changelog: https://github.com/fzn0x/idx/blob/main/CHANGELOG.md
MCP Security Weekly
Get CVE alerts and security updates for io.github.Kitalon-Labs-LLC/pgmoat and similar servers.
Start a conversation
Ask a question, share a tip, or report an issue.
Sign in to join the discussion.
Governed Postgres access for AI agents.
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.
Requires Node.js 22.12 or newer and Postgres 15 to 18.
Run it against your database with safe defaults, no config file needed:
npx -y pgmoat postgresql://readonly_user:password@localhost:5432/mydb
Add it to Claude Code:
claude mcp add pgmoat -- npx -y pgmoat postgresql://readonly_user:password@localhost:5432/mydb
Or to Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"pgmoat": {
"command": "npx",
"args": ["-y", "pgmoat", "--url-env", "PGMOAT_DATABASE_URL"],
"env": { "PGMOAT_DATABASE_URL": "postgresql://readonly_user:password@localhost:5432/mydb" }
}
}
}
Passing the URL through --url-env keeps the password out of process listings.
Use a dedicated read-only role. pgmoat warns at startup if the role is a superuser or can write.
export PGMOAT_DATABASE_URL=postgresql://readonly_user:password@localhost:5432/mydb
npx pgmoat init # writes pgmoat.yaml; auto-hides columns like password_hash and token_hash
npx pgmoat validate # checks the file against the schema and the database
npx pgmoat doctor # checks the role for unsafe privileges
npx pgmoat start # starts the server with ./pgmoat.yaml
A pgmoat.yaml looks like this:
version: 1
server:
name: mydb
connection:
url: ${PGMOAT_DATABASE_URL}
schemas: [public]
mode: read-only
budgets:
max_rows: 200
max_query_ms: 5000
tables:
users:
description: "One row per login account"
columns:
password_hash: { hidden: true }
email: { sensitive: high }
| Command | What it does |
|---|---|
pgmoat <postgres-url> | Start with safe defaults (no config file) |
pgmoat init | Create pgmoat.yaml from your database |
pgmoat start | Start the MCP server from pgmoat.yaml |
pgmoat validate | Check pgmoat.yaml against the schema and the database |
pgmoat doctor | Check the database role for unsafe privileges |
pgmoat audit verify | Verify the audit log hash chain |
pgmoat schema-export | Write the visible schema as Markdown |
Run pgmoat --help for all options.
docker run -i --rm \
-e PGMOAT_DATABASE_URL="postgresql://readonly_user:password@host.docker.internal:5432/mydb" \
ghcr.io/kitalon-labs-llc/pgmoat:latest
See CONTRIBUTING.md. Report vulnerabilities privately as described in SECURITY.md.