MCPizy
BrowseGuidesDocsFor publishersSubmit
Back

TL;DR

PostgreSQL is a Databases MCP server that lets Claude Code, Cursor, Windsurf and any MCP-compatible AI agent query and manage PostgreSQL databases. Install in 1 minute with mcpizy install postgres.

๐Ÿ˜

PostgreSQL

Install verified 4 tools

Databases

Last updated September 23, 2026 ยท By MCPizy team

Query and manage PostgreSQL databases

Official homepage

Install PostgreSQL

Via MCPizy CLI (recommended):
mcpizy install postgres
Or run directly:
npx -y @modelcontextprotocol/server-postgres

Tools exposed

4 tools available
query

Execute a read-only SQL query and return rows

Inputs

  • sqlstringrequired
list_schemas

List all schemas in the database

list_tables

List tables in a given schema

Inputs

  • schemastringoptional
describe_table

Return column names and types for a table

Inputs

  • tablestringrequired

Configuration

Works identically across clients. Only the config file path differs.

Claude Code~/.claude.json
{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-postgres",
        "postgresql://user:password@host:5432/dbname"
      ]
    }
  }
}
Cursor.cursor/mcp.json
{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-postgres",
        "postgresql://user:password@host:5432/dbname"
      ]
    }
  }
}
Windsurf~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-postgres",
        "postgresql://user:password@host:5432/dbname"
      ]
    }
  }
}

Authentication setup

  1. 1

    Copy your Postgres connection string from your hosting provider

    Get it POSTGRES_CONNECTION_STRING

What you can do with PostgreSQL MCP

Paste any of these prompts into Claude Code, Cursor or another MCP-compatible client.

โ€œList all tables in the `public` schema and count the rows in eachโ€

Uses: list_tables, query

โ€œDescribe the structure of the `orders` tableโ€

Uses: describe_table

โ€œFind the top 10 customers by total revenue in the last 30 daysโ€

Uses: query

โ€œShow me the 5 slowest queries from `pg_stat_statements`โ€

Uses: query

Why PostgreSQL MCP matters

Postgres MCP is the smallest, fastest, most general-purpose database MCP server in the catalog. It does one thing well: hand a connection string to your AI agent and let it run SQL. No auth platform layer, no storage, no functions โ€” just `query`, `list_schemas`, `describe_table`. That tight surface is exactly what you want for read-heavy data analysis or for letting Claude reason about a schema before writing application code.

The right use cases: ad-hoc analytics ("how many active users registered in the last 7 days, broken down by referrer"), schema exploration ("describe every table that references `users.id`"), and read-only data-pull workflows. We pair it with Claude Sonnet for production querying โ€” 4 tools is small enough that the model never gets confused about which to call. For migrations and platform-level work, switch to Supabase MCP or Neon MCP, which expose richer primitives.

Token cost is the lowest of any DB MCP โ€” describe-table on a 20-column table costs ~600 tokens; a query returning 50 rows of 5 columns is ~1.5k. Connection security is the core risk: if you hand the agent a connection string with full DDL rights, it can drop tables. The server has no built-in sandbox; use a read-only Postgres role for analysis workflows, switch to a write role only when explicit human approval gates the action.

Common pitfalls

Postgres MCP runs SQL verbatim โ€” there's no query planner safety check. An agent that decides to "see all rows" will run `SELECT * FROM events` against a 50M-row table and hang. Always include a `LIMIT` instruction in your prompt or pre-create read-only views with sane defaults.

The `query` tool returns rows as JSON, which inflates token cost on wide tables. For analytics on > 100 rows, ask the agent to use `SELECT โ€ฆ GROUP BY` aggregates rather than fetching raw rows.

Connection pooling: each tool call opens a new connection unless you front the server with PgBouncer. For agents running long sessions with many sequential queries, point the connection string at the pooler port (typically 6543 on managed Postgres) to avoid exhausting `max_connections`.

Schema introspection is fast on small DBs but slow on Postgres clusters with thousands of tables (some Supabase users hit this). If `list_schemas` takes > 5s, restrict the role's `search_path` to the schemas the agent actually needs.

How PostgreSQL MCP compares

Honest pros/cons against the closest databases MCP servers.

ServerStrengthsTrade-offs
Supabase MCPFull platform: auth, storage, edge functions, advisorsBigger blast radius, requires Supabase project (not portable)
Neon MCPDatabase branching, autoscaling serverless PostgresTied to Neon; cold-start latency on first query
SQLite MCPZero infra, perfect for local dev / single-file analyticsNo concurrency, not for production multi-writer workloads

Works with

Claude Code
Claude Desktop
Cursor
Windsurf
VS Code + Copilot
Any MCP Client

Alternatives to PostgreSQL

If PostgreSQL doesn't fit your stack, these Databases MCP servers solve similar problems.

Frequently asked questions

What is the PostgreSQL MCP server?

PostgreSQL is listed as an Databases Model Context Protocol server whose documented purpose is to let an MCP-compatible agent query and manage PostgreSQL databases. Client support, permissions and authentication remain specific to the upstream project.

How do I install PostgreSQL MCP with Claude Code?

The fastest way is the MCPizy CLI: run `mcpizy install postgres` and MCPizy will add the server to your `.claude.json` automatically. You can also install it manually by adding an entry under `mcpServers` in `.claude.json` with the command `npx -y @modelcontextprotocol/server-postgres` and restarting Claude Code.

Does MCPizy charge to view or install PostgreSQL MCP?

No. Reading this profile and copying its install guidance is free. Upstream software, API, account or usage costs are separate, and licence coverage should be checked from the linked source when available.

Does PostgreSQL MCP work with Cursor and Windsurf?

The MCP standard is supported by those clients, but a specific server can still have client-specific setup or transport limits. Use the configuration shown on this page when present and verify the upstream instructions before installation.

What can I do with PostgreSQL MCP?

Its documented purpose is to let an MCP-compatible agent query and manage PostgreSQL databases. The exact tools, permissions and write capabilities depend on the server version and configuration shown by the upstream project.

Compare before you commit

Put this server beside an alternative, or return to the full evidence directory.

Compare MCP serversBack to directory