Best MCP servers for PostgreSQL
8 MCP servers that connect an agent to PostgreSQL — read-only query servers, tuning and ops tools, and services that create databases for you. The credential you hand over is the real decision.
How to choose
Almost every server here passes SQL straight through, so the choice is about permissions and blast radius, not features.
- Give it a role, not your superuser. Connect with a role limited to the schemas the task needs — on a read replica if you have one. Then a wrong query costs a timeout instead of a table.
- Read-only is a switch you have to actually set. Several servers ship a read-only mode; turn it on for question answering and dashboards. If the agent must do DDL (migrations, seeding), say so out loud — that is a different blast radius, and it belongs in a separate config.
- The connection string is a secret in a plain-text file. MCP configs live in dotfiles and get committed by accident. Use an environment variable or the server's own auth option, and never paste a production URL into a config you share.
- One server, many engines. The multi-database entries also speak MySQL, SQLite and SQL Server. Convenient, but the model gets reach into every database you configure; single-engine servers are easier to reason about.
- Hosted tools manage databases, it does not query your data. The Neon server creates projects and branches — infrastructure work, not questions about your rows. Do not install both and expect the agent to know which is which.
- The top entry has 3,403 stars, and that is the category. Database servers are used by teams rather than starred by crowds; judge them by the tool list and the last commit. Numbers below are our index at build time.
Our call: a read-only server on a scoped role covers dashboards and question answering; add a write-capable server only for migrations, keep it in a separate config, and point it at a database you can restore from a backup you have actually tested.
Compare
| Tool | What it does | Install | Source | Stars |
|---|---|---|---|---|
| crystaldba/postgres-mcp Site ↗ | Postgres development and operations: performance analysis, tuning and health checks | — | awesome:punkpeye/awesome-mcp-servers | 3,403 |
| neondatabase/mcp-server-neon Site ↗ | Create and manage Postgres databases with Neon Serverless Postgres | — | awesome:punkpeye/awesome-mcp-servers | 654 |
| centralmind/gateway Site ↗ | Automatically generate APIs from database schema and data for PostgreSQL, ClickHouse, MySQ | — | awesome:punkpeye/awesome-mcp-servers | 548 |
| subnetmarco/pgmcp Site ↗ | Natural-language queries for any PostgreSQL database, with automatic streaming and read-on | — | awesome:punkpeye/awesome-mcp-servers | 542 |
| FreePeak/db-mcp-server Site ↗ | MySQL and PostgreSQL access: query execution, transaction management, schema exploration, | — | awesome:punkpeye/awesome-mcp-servers | 468 |
| runekaagaard/mcp-alchemy Site ↗ | Access PostgreSQL, MySQL, MariaDB, SQLite, Oracle, SQL Server and more via SQLAlchemy, wit | — | awesome:punkpeye/awesome-mcp-servers | 421 |
| ashishsinha1602/schemagate Site ↗ | Text-to-SQL access control: schema selection that gives the LLM only the tables the caller | — | awesome:punkpeye/awesome-mcp-servers | 105 |
| TheRaLabs/legion-mcp Site ↗ | Multi-database access for PostgreSQL, Redshift, CockroachDB, MySQL, RDS MySQL, SQL Server, | — | awesome:punkpeye/awesome-mcp-servers | 95 |
Why these links: every card opens the entry's own page here first (what it does, how to install, how to verify the numbers); the tool's official site is one click further, and nothing here is a paid placement. Numbers come from public sources and are shown so you can check them.
Related / Keep exploring
Keep exploring: MCP directory · all fields · all AI tools · rankings