Skip to main content
MCP server CX Codex

postgres-mcp — Claude Code MCP server: features and setup

Connects PostgreSQL databases to AI coding assistants for natural language queries, schema inspection, and hybrid search.

Install into Claude Code · Platform CLI All methods and platforms ↓
claude mcp add postgres-mcp -- docker run -i --rm ghcr.io/pgedge/postgres-mcp:latest
Open on GitHub

What postgres-mcp does

This server bridges PostgreSQL instances with AI assistants via Stdio or HTTP transports. It inspects schemas, reads database statistics, and translates conversational prompts into working SQL. Built-in tools also handle hybrid search using BM25 and MMR.

Queries execute inside read-only transactions by default. The repository also includes a standalone Go chat client with Anthropic prompt caching, cutting token expenses by up to 90%.

It requires PostgreSQL 14 or newer. Because the server exposes full schema and data access to the model, avoid running it in public environments.

What it helps with

  • query PostgreSQL databases using plain English prompts
  • inspect database schema details and engine statistics
  • run hybrid search with BM25 and MMR scoring
  • diagnose database queries directly inside an AI workflow

Example prompts for the agent

  • Inspect the customers table and retrieve the top five balances
  • Check database statistics and locate the slowest queries
  • Run a hybrid search across the catalog items

How to install postgres-mcp

Platform CLI

claude mcp add postgres-mcp -- docker run -i --rm ghcr.io/pgedge/postgres-mcp:latest

Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more

Questions about postgres-mcp

How to install postgres-mcp in Claude Code?

Run this command in your terminal: claude mcp add postgres-mcp -- docker run -i --rm ghcr.io/pgedge/postgres-mcp:latest. Make sure Docker is running on your machine.

What does postgres-mcp do?

It connects AI tools to PostgreSQL, turning text requests into SQL, reading schema metadata, and executing hybrid searches.

Can postgres-mcp be used in public web applications?

No. The server gives models read access to the entire schema, making it suitable only for internal developer workflows or trusted setups.

Similar MCP servers

All MCP servers for Data and databases →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor