mcp-postgres

v0.1.0
io.github.dockndevai/mcp-postgres Checked 13 hours ago Published 9 days ago

PostgreSQL schema exploration, read-only SQL & governed changes for AI agents.

Values you need

VariableWhat it is
POSTGRES_URLrequired secret libpq connection string, e.g. postgresql://user:pass@host:5432/db (or use PGHOST/PGUSER/PGPASSWORD/PGDATABASE).
POSTGRES_MODEoptional Access mode: read-only | read-write | admin.
POSTGRES_SCHEMA_ALLOWLISToptional Comma-separated schemas the agent may touch (empty = all).

npm (npx) discovery passed

Requires Node.js 18+

Run in a terminal
claude mcp add mcp-postgres -e 'POSTGRES_URL=<POSTGRES_URL>' -- npx -y @dockndevai/mcp-postgres@0.1.0
Add to claude_desktop_config.json
{
  "mcpServers": {
    "mcp-postgres": {
      "args": [
        "-y",
        "@dockndevai/mcp-postgres@0.1.0"
      ],
      "command": "npx",
      "env": {
        "POSTGRES_URL": "<POSTGRES_URL>"
      }
    }
  }
}
Add to ~/.cursor/mcp.json
{
  "mcpServers": {
    "mcp-postgres": {
      "args": [
        "-y",
        "@dockndevai/mcp-postgres@0.1.0"
      ],
      "command": "npx",
      "env": {
        "POSTGRES_URL": "<POSTGRES_URL>"
      }
    }
  }
}
Add to .vscode/mcp.json
{
  "inputs": [
    {
      "description": "POSTGRES_URL",
      "id": "postgres-url",
      "password": true,
      "type": "promptString"
    }
  ],
  "servers": {
    "mcp-postgres": {
      "args": [
        "-y",
        "@dockndevai/mcp-postgres@0.1.0"
      ],
      "command": "npx",
      "env": {
        "POSTGRES_URL": "${input:postgres-url}"
      },
      "type": "stdio"
    }
  }
}
Add to ~/.codex/config.toml
[mcp_servers.mcp-postgres]
command = "npx"
args = ["-y", "@dockndevai/mcp-postgres@0.1.0"]
env = { "POSTGRES_URL" = "<POSTGRES_URL>" }

For AI agents

  1. Ask the user for: POSTGRES_URL. 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. Verify: the server should expose these tools: get_server_info, list_schemas, list_tables, describe_table, select_rows, run_query, explain_query, list_active_queries, ….
  5. If it fails, check that the required runtime is installed (Node.js 18+) and that the values above are set.

Machine-readable: install.md · manifest.json