Install pg Readonly in Claude Code
claude mcp add pg-readonly -e PG_READONLY_MCP_DSN=... -- uvx pg-readonly-mcp{
"mcpServers": {
"pg-readonly": {
"command": "uvx",
"args": [
"pg-readonly-mcp"
],
"env": {
"PG_READONLY_MCP_DSN": "..."
}
}
}
}Replace each ... with your own value.
Frequently asked questions
What does the pg Readonly MCP server do?
A read-only Postgres MCP server that parses SQL rather than pattern-matching it.
Is the pg Readonly MCP server free?
Yes, most likely. Open source and no paid account or API key is mentioned in the listing. Check the provider for current pricing.
Does pg Readonly run locally or remotely?
Local. Runs on your machine (stdio). You install it with npx, uvx, Docker or from source.
How do I add pg Readonly to Claude Code?
Run: claude mcp add pg-readonly -e PG_READONLY_MCP_DSN=... -- uvx pg-readonly-mcp
More databases MCP servers
View allpgbrake
lexang/pgbrake
Postgres brake for AI agents: risky SQL waits for approval, UPDATE/DELETE get one-command undo.
Pensieve
praveen-ilangovan/pensieve
Manually-triggered, self-organising personal memory for AI agents; SQLite, no vector DB.
pgmcp
pascalallen/pgmcp
Read-only Postgres ops/DBA diagnostics: slow queries, EXPLAIN, locks, index and table health.
Peeringdb
pipeworx-io/mcp-peeringdb
PeeringDB MCP — the peering ecosystem database. Look up networks by name or ASN, find internet…
Pgmoat
Kitalon-Labs-LLC/pgmoat
Governed, read-only Postgres access for AI agents: SQL safety, RLS, budgets, tamper-evident audit.
Orionbelt Semantic Layer
ralfbecher/orionbelt-semantic-layer
API-first semantic layer MCP server compiling YAML models into dialect-specific SQL