Databases / database-mcp-postgres

database-mcp-postgres

io.github.arifulislamat/database-mcp-postgres · v0.5.0

MCP server for PostgreSQL. Read-only by default, row caps, timeouts, secrets never logged.

Description supplied by the publisher in the MCP Registry. We have not tested this server.

Ranks #24 of 196 Databases servers on Socketlist by score, with 5 GitHub stars and a last code push 28d ago.

Install

npx -y @database-mcp/postgres
uvx database-mcp-postgres

Assembled from the package metadata in the official MCP Registry (including any subcommand or flag the publisher lists). Some publishers do not list the subcommand that starts MCP mode, so confirm the command in the README, along with any required configuration and credentials, before connecting it to real data.

Connect database-mcp-postgres to Claude Code, Cursor or VS Code

Built from what the publisher declared in the official MCP Registry (the launch command above). We have not run this server. Replace anything in <angle brackets>, and keep keys and tokens in your environment, not in a shared file.

Claude Code

Run in a terminal. Adds the server at local scope; add --scope project or --scope user to share it. Secret variables the publisher declares are included; drop any the README says are optional. Claude Code setup guide.

claude mcp add --env POSTGRES_HOST=<postgres_host> --env POSTGRES_USER=<postgres_user> --env POSTGRES_PASSWORD=<postgres_password> --env POSTGRES_DATABASE=<postgres_database> --transport stdio database-mcp-postgres -- npx -y @database-mcp/postgres

.mcp.json (Claude Code project scope, VS Code with Copilot)

Put this in a .mcp.json file at the project root. ${NAME} reads the value from your environment, so no secret is written to the file. VS Code and .mcp.json guide.

{
  "mcpServers": {
    "database-mcp-postgres": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@database-mcp/postgres"
      ],
      "env": {
        "POSTGRES_HOST": "${POSTGRES_HOST}",
        "POSTGRES_USER": "${POSTGRES_USER}",
        "POSTGRES_PASSWORD": "${POSTGRES_PASSWORD}",
        "POSTGRES_DATABASE": "${POSTGRES_DATABASE}"
      }
    }
  }
}

Cursor

Put this in .cursor/mcp.json in the project, or ~/.cursor/mcp.json for every project. Cursor mcp.json guide.

{
  "mcpServers": {
    "database-mcp-postgres": {
      "command": "npx",
      "args": [
        "-y",
        "@database-mcp/postgres"
      ],
      "env": {
        "POSTGRES_HOST": "${env:POSTGRES_HOST}",
        "POSTGRES_USER": "${env:POSTGRES_USER}",
        "POSTGRES_PASSWORD": "${env:POSTGRES_PASSWORD}",
        "POSTGRES_DATABASE": "${env:POSTGRES_DATABASE}"
      }
    }
  }
}

Configuration the publisher declares

Environment variableRequiredSecretPublisher's note
POSTGRES_HOSTYesNoDatabase host
POSTGRES_USERYesNoDatabase user (a read-only user is recommended)
POSTGRES_PASSWORDNoYesDatabase password (or use POSTGRES_PASSWORD_FILE)
POSTGRES_DATABASEYesNoDatabase name

"Required" and "secret" are the publisher's own flags in the registry, and many publishers leave them unset, so check the README too.

Allowlist entry

If your organisation restricts MCP servers, this is the entry an admin adds to allowedMcpServers in Claude Code managed settings or a GitHub Copilot enterprise managed-settings.json. A serverCommand entry must match the configured command and arguments exactly, so change both together.

{
  "allowedMcpServers": [
    {
      "serverCommand": [
        "npx",
        "-y",
        "@database-mcp/postgres"
      ]
    }
  ]
}

How allowlists work in each client: MCP server allowlists for Claude Code, GitHub Copilot and Cursor. Before you connect it to real data: 10 security checks for MCP servers.

Signals

GitHub stars5
npm weekly downloads163
Last push28d ago
LicenceMIT
Open issues1
SECURITY.mdYes
LanguageRust
Latest version published2026-10-17

Signals captured from GitHub, npm and the official MCP Registry on November 11, 2026. See the scoring method.

Similar servers compare all →

database-mcp-mysql

Score 82

MCP server for MySQL. Read-only by default, row caps, statement timeouts, secrets never logged.

★ 5↓ 82/wkMITpushed 28d ago
DatabasesSecurity

database-mcp-sqlite

Score 83

MCP server for SQLite databases. Read-only by default, row caps, statement timeouts.

★ 5↓ 200/wkMITpushed 28d ago
Databases

read-only-local-postgres-mcp-server

Score 76

MCP server for read-only PostgreSQL database queries in Claude Desktop

★ 2MITpushed 26d ago
Databases

Five MCP servers worth your time, every week

The Plug Weekly is a free email picked from these scores. About a 3-minute read. Unsubscribe any time.

Subscribe free