pg-readonly-mcp
v0.1.1A read-only Postgres MCP server that parses SQL rather than pattern-matching it.
Values you need
| Variable | What it is | |
|---|---|---|
PG_READONLY_MCP_DSN | required secret | Postgres connection string for a role that holds only SELECT. The server refuses to start otherwise. |
PyPI (uvx)
Requires uv (https://docs.astral.sh/uv/)
Run in a terminal
claude mcp add pg-readonly-mcp -e 'PG_READONLY_MCP_DSN=<PG_READONLY_MCP_DSN>' -- uvx pg-readonly-mcp==0.1.1Add to
claude_desktop_config.json{
"mcpServers": {
"pg-readonly-mcp": {
"args": [
"pg-readonly-mcp==0.1.1"
],
"command": "uvx",
"env": {
"PG_READONLY_MCP_DSN": "<PG_READONLY_MCP_DSN>"
}
}
}
}Add to
~/.cursor/mcp.json{
"mcpServers": {
"pg-readonly-mcp": {
"args": [
"pg-readonly-mcp==0.1.1"
],
"command": "uvx",
"env": {
"PG_READONLY_MCP_DSN": "<PG_READONLY_MCP_DSN>"
}
}
}
}Add to
.vscode/mcp.json{
"inputs": [
{
"description": "PG_READONLY_MCP_DSN",
"id": "pg-readonly-mcp-dsn",
"password": true,
"type": "promptString"
}
],
"servers": {
"pg-readonly-mcp": {
"args": [
"pg-readonly-mcp==0.1.1"
],
"command": "uvx",
"env": {
"PG_READONLY_MCP_DSN": "${input:pg-readonly-mcp-dsn}"
},
"type": "stdio"
}
}
}Add to
~/.codex/config.toml[mcp_servers.pg-readonly-mcp]
command = "uvx"
args = ["pg-readonly-mcp==0.1.1"]
env = { "PG_READONLY_MCP_DSN" = "<PG_READONLY_MCP_DSN>" }For AI agents
- Ask the user for: PG_READONLY_MCP_DSN. Never invent or guess these values; secrets go into the client config, not into chat logs.
- Pick the user's MCP client and apply the matching config from the first install method (it is the one verified by the smoke test when available).
- Restart or reload the client so it starts the server.
- If it fails, check that the required runtime is installed (uv (https://docs.astral.sh/uv/)) and that the values above are set.
Machine-readable: install.md · manifest.json