pgEdge Postgres MCP Server
Lets your AI agent query PostgreSQL in read-only mode, explore schemas and ask questions in plain language.
245 stars on GitHubby pgEdgeLicense PostgreSQLUpdated 19 days ago
How to install
This MCP is local: it runs on your computer.
It works in apps installed on your PC (Claude Desktop, Claude Code, Cursor, VS Codeβ¦). Choose your app:
Paste in the terminal:
claude mcp add postgres -- docker run -i --rm ghcr.io/pgedge/postgres-mcp:latest
Ready! Now test it
Restart the app and paste one of these requests in the chat:
Which customers placed the most orders last month?
Describe the tables in my database and how they relate.
What it is
The pgEdge Postgres MCP Server lets MCP clients run SQL queries against PostgreSQL databases and includes a Natural Language Agent that turns plain questions into queries. It runs queries in read-only transactions by default and comes with a command-line chat client and a web interface.
What it can do
- Query execution (read-only by default)
- Schema analysis
- Hybrid search with BM25 and MMR
- Embedding generation
- Resources for PostgreSQL statistics
- Prompts for database exploration and query diagnostics
When to use
- βΊWhen you want to ask questions about your data in plain language
- βΊWhen you want an AI to explore a database schema
- βΊWhen you want to search text in your database with hybrid search
What you need
Skills that pair well
MCP or skill?
The MCP gives the agent the hands. The skill teaches the right way to use them. Together, the result is better and uses fewer tokens.
postgres-expertHelps your agent speed up PostgreSQL queries, choose indexes, design schemas and run safe database maintenance.postgres-schema-designGives your agent clear rules for designing PostgreSQL tables, covering keys, data types, indexes and constraints that keep data correct and fast.migrating-oracle-to-postgres-data-access-codeHelps your agent migrate data access code from Oracle to PostgreSQL in .NET/C# projects. It replaces packages, rewrites connection usage, and adapts connection strings.Frequently asked questions
Is it free and open source?
Yes, it is licensed under the PostgreSQL License.
Is it read-only?
Queries run in read-only transactions by default, and you can configure this per database.
Is it safe for public apps?
No. The readme says it is not for public-facing apps because the LLM can read your whole schema and data; use it for internal tools and trusted users.
Which clients work?
Claude Desktop, Claude Code, Cursor, Windsurf, VS Code Copilot, a CLI client and a web UI.
How does sign-in work for HTTP mode?
With user and API token authentication, TLS and optional OAuth.
Which Postgres versions work?
PostgreSQL 14 and higher.
If it does not work
- βΊConfigure the database connection before starting the server, and check PostgreSQL is running with pg_isready.
- βΊIn Claude Desktop use absolute paths, check the JSON syntax and restart it completely.
- βΊSee docs/guide/troubleshooting.md for more fixes.
5 new skills a week. 1 minute to read.