pg-readonly-mcp

v0.1.1
io.github.les-k/pg-readonly-mcp Checked 1 day ago Published 2 months ago

A read-only Postgres MCP server that parses SQL rather than pattern-matching it.

Values you need

VariableWhat it is
PG_READONLY_MCP_DSNrequired 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.1
Add 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

  1. Ask the user for: PG_READONLY_MCP_DSN. Never invent or guess these values; secrets go into the client config, not into chat logs.
  2. 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).
  3. Restart or reload the client so it starts the server.
  4. 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