postgres-mcp
MCP server by pgEdge Community
postgres-mcp is an MCP server from pgEdge that lets AI assistants run SQL queries against PostgreSQL databases. It is aimed at internal tools, developer workflows, and environments where all users are trusted.
Install postgres-mcp
Built from the published package, never by AI.
claude mcp add postgres-mcp -- docker run -i --rm ghcr.io/pgedge/postgres-mcp:latestRun in your terminal. Add --scope user to use it in every project.
{
"mcpServers": {
"postgres-mcp": {
"args": [
"run",
"-i",
"--rm",
"ghcr.io/pgedge/postgres-mcp:latest"
],
"command": "docker"
}
}
}Settings, Developer, Edit config. Paste into claude_desktop_config.json and restart.
{
"mcpServers": {
"postgres-mcp": {
"args": [
"run",
"-i",
"--rm",
"ghcr.io/pgedge/postgres-mcp:latest"
],
"command": "docker"
}
}
}Add to ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (this project).
{
"servers": {
"postgres-mcp": {
"args": [
"run",
"-i",
"--rm",
"ghcr.io/pgedge/postgres-mcp:latest"
],
"command": "docker"
}
}
}Add to .vscode/mcp.json. VS Code uses "servers", not "mcpServers".
codex mcp add postgres-mcp -- docker run -i --rm ghcr.io/pgedge/postgres-mcp:latest{
"mcpServers": {
"postgres-mcp": {
"args": [
"run",
"-i",
"--rm",
"ghcr.io/pgedge/postgres-mcp:latest"
],
"command": "docker"
}
}
}Add to ~/.gemini/config/mcp_config.json (all projects) or .agents/mcp_config.json (this project).
gemini mcp add postgres-mcp docker run -i --rm ghcr.io/pgedge/postgres-mcp:latestGemini CLI was replaced by Antigravity CLI in June 2026 and remains only for enterprise licences and paid API keys.
MCP servers run with your permissions and can read what you give them access to. Some need an API key: check the README and add it under env in the postgres-mcp block.
About
The pgEdge Postgres MCP Server enables SQL queries against PostgreSQL databases through MCP-compatible clients. It includes a Natural Language Agent that lets users form SQL queries in natural language. Queries run in read-only transactions by default. The server exposes tools for query execution, schema analysis, hybrid search using BM25 and MMR, embedding generation, and resource reading, along with prompts for guided workflows.
Clients include the Go chat client, a web UI, Claude Desktop, Claude Code, Cursor, Windsurf, and VS Code Copilot. The server supports stdio and HTTP/HTTPS transports, with user and API token authentication. The source says it is for internal tools, developer workflows, or environments where all users are trusted. It is not intended for public-facing applications, which the source directs to the pgEdge RAG Server instead.
Written from the project's README and checked against it.
Tools it gives your assistant
Query executionRuns SQL queries against PostgreSQL databases in read-only transactions by default.Schema analysisAnalyses the structure of the connected PostgreSQL database.Hybrid search (BM25+MMR)Performs advanced hybrid search combining BM25 and MMR ranking.Embedding generationGenerates embeddings for use in semantic search.Resource readingReads MCP resources, including PostgreSQL statistics.
What you need
- PostgreSQL 14 or higher
- Go 1.26.10 or higher (for building from source)
- Docker (for Docker Compose deployment)
Try asking
- Analyse the schema of my PostgreSQL database and summarise the tables.
- Run a hybrid search over my documents for pricing terms.
- Show me PostgreSQL statistics for the current database.
Good to know
- Not for public-facing applications, according to the source.
- Queries run in read-only transactions by default.
- Requires PostgreSQL 14 or higher.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: README.md. This looks for known risky patterns and is not a full audit. How grades work
Alternatives to postgres-mcp
All alternatives →Connects Supabase projects to AI assistants such as Cursor, Claude and Windsurf over the Model Context Protocol. It lets assistants manage tables, fetch config and query data in a Supabase project.
ArcadeDB MCP Server is the built-in Model Context Protocol server of the ArcadeDB multi-model database. It lets AI assistants and LLMs work with ArcadeDB's graph, document, time-series, vector and other data models. It suits people who already run ArcadeDB and want assistant access to it.
Connects MCP clients such as Claude Desktop, Cursor and VS Code to PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, ClickHouse and SQLite. It exposes two tools by default, with read-only mode and query timeouts available as guardrails.
MCP Toolbox for Databases is an open source MCP server that connects AI agents, IDEs and applications to enterprise databases. It provides prebuilt tools for exploring schemas and running queries, plus a framework for custom tools. It is aimed at developers building agents that need database access.
Connects AI agents, IDEs and applications to enterprise databases through the Model Context Protocol. Offers prebuilt database tools for MCP clients and a framework for building custom tools for production agents.
MongoDB MCP Server lets AI assistants interact with MongoDB databases and MongoDB Atlas. It is an official server from mongodb-js, run locally with npx or Docker. It works with self-managed deployments and Atlas clusters.
Compare with Supabase, ArcadeDB MCP Server or DBHub
postgres-mcp: common questions
Is postgres-mcp safe to expose to public users?
The source says it is not for public-facing applications because it gives LLMs read access to the whole database schema and data. It recommends the pgEdge RAG Server for public use.
Can postgres-mcp change data in my database?
By default, all queries run in read-only transactions. The source says read-only enforcement is configurable per database.
Which PostgreSQL versions does postgres-mcp support?
The source states support for PostgreSQL 14 and higher.
How do I install postgres-mcp?
In Claude Code run claude mcp add postgres-mcp -- docker run -i --rm ghcr.io/pgedge/postgres-mcp:latest. For Claude Desktop, Cursor and VS Code, paste the config shown above and restart. See the install guides.
Is postgres-mcp the official server?
postgres-mcp is a community project by pgEdge, not verified by a company domain.
Is postgres-mcp free?
The code is published under the PostgreSQL licence. The service it connects to may have its own pricing.
Is postgres-mcp safe to use?
It scores 80 of 100. Grades: maintenance A, licence B, quality B. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to postgres-mcp?
Similar MCP servers: Supabase, ArcadeDB MCP Server, DBHub, MCP Toolbox for Databases.
Does postgres-mcp work with ChatGPT?
Not directly. It runs locally, and ChatGPT only connects to remote servers with a URL. Use it in Claude Code, Claude Desktop, Cursor, VS Code or Codex.
