Postgres MCP Pro MCP server
Postgres MCP Pro is an open-source MCP server that gives AI agents access to a PostgreSQL database, with schema browsing, safe SQL execution, EXPLAIN plans, index recommendations and database health checks.
Connect Postgres MCP Pro
Claude Desktop or any client with a JSON config, using Docker
{"mcpServers": {"postgres": {"command": "docker", "args": ["run", "-i", "--rm", "-e", "DATABASE_URI", "crystaldba/postgres-mcp", "--access-mode=unrestricted"], "env": {"DATABASE_URI": "postgresql://localhost:5432/dbname"}}}}The same with uvx, in read-only restricted mode
{"mcpServers": {"postgres": {"command": "uvx", "args": ["postgres-mcp", "--access-mode=restricted"], "env": {"DATABASE_URI": "postgresql://localhost:5432/dbname"}}}}Shared server over SSE with Docker
docker run -p 8000:8000 -e DATABASE_URI=postgresql://localhost:5432/dbname crystaldba/postgres-mcp --access-mode=unrestricted --transport=ssePut your database user and password into the URI in the usual user:password@host form. The Docker image remaps localhost to the host machine automatically. On AWS RDS, Azure or Google Cloud SQL, enable pg_stat_statements and hypopg through the provider before using the tuning tools.
Or paste this into your coding agent: Connect the Postgres MCP Pro MCP server to my coding agent using its documented setup: https://github.com/crystaldba/postgres-mcp.
What the Postgres MCP Pro MCP server does
Postgres MCP Pro is an MCP server from Crystal DBA, a company that builds tools for PostgreSQL. It connects an AI agent to any Postgres database by connection URI. The agent can list schemas and objects, read a table's columns, constraints and indexes, run SQL, and get the execution plan for a query, which gives it enough context to write SQL that fits the real schema.
Postgres MCP Pro's main difference from a plain database connector is tuning. It reports the slowest queries from pg_stat_statements, recommends indexes for the whole workload or for up to 10 given queries by searching many index combinations, and uses the hypopg extension to test hypothetical indexes in EXPLAIN without creating them. A health check covers buffer cache hit rates, connections, vacuum, sequence limits, replication lag and duplicate or unused indexes.
The server runs locally through Docker, uvx, pipx or uv and needs Python 3.12 or newer outside Docker. It has two access modes: unrestricted for development, and restricted, which allows only read-only transactions with an execution time limit, for production. The repo had 3,359 GitHub stars on 2026-10-01; its last push was 2026-08-17.
Tools it gives your agent
list_schemaslist_objectsget_object_detailsexecute_sqlexplain_queryget_top_queriesanalyze_workload_indexesanalyze_query_indexesanalyze_db_health
When to use Postgres MCP Pro
- Your app's queries are slow and you want index suggestions backed by the real workload.
- You want the agent to read your schema before it writes SQL or ORM code.
- You want a health report on a production database with no write access for the agent.
- You want to check whether a planned index would change a query plan before adding it.
When to pick something else
- Databases other than PostgreSQL; DBHub covers MySQL, SQL Server, SQLite and others.
- Unattended use in unrestricted mode: the agent can then change data and schema, so use --access-mode=restricted on anything that matters.
What Postgres MCP Pro needs
- A PostgreSQL connection URI
- Docker, or Python 3.12 or newer
- The pg_stat_statements and hypopg extensions for index tuning and workload analysis
What the Postgres MCP Pro MCP server costs
Free and open source under MIT, with no paid tier; it runs on your machine against your own PostgreSQL database.
Current prices: github.com . We do not list prices: vendors change them often, so check the publisher's own page.
Questions people ask
Is Postgres MCP Pro free?
Yes. It is open source under MIT with no paid version; you run it yourself against your own database.
Can Postgres MCP Pro write to my database, or only read?
That depends on the mode. Unrestricted mode allows full reads and writes, including schema changes; restricted mode limits the agent to read-only transactions with a time limit.
Other MCP servers for databases
- DBHub: DBHub is an open-source MCP server by Bytebase that gives AI agents SQL access to PostgreSQL, MySQL, MariaDB, SQL Server, Oracle and SQLite through one server with two default tools.
- MongoDB: The MongoDB MCP server gives AI agents access to MongoDB databases and MongoDB Atlas: run find and aggregate queries, inspect schemas and indexes, and create or manage Atlas clusters and users.
- Neon: The Neon MCP server gives AI agents control of Neon serverless Postgres: create projects and branches, run SQL, inspect schemas, find slow queries and run migrations on a branch before applying them.
- Redis: The Redis MCP server gives AI agents natural-language access to a Redis database: strings, hashes, lists, sets, sorted sets, streams, JSON documents, pub/sub and vector search indexes.