postgres-mcp

MCP.Pizza Chef: crystaldba

Beyond answering questions about your data, it checks the health of the database, explains why a slow query is slow, and suggests indexes that would speed it up. You can lock it to read-only so nothing changes by accident, or open it up for editing. Setup suits someone comfortable with Docker or Python, and you supply the connection details yourself. Claude Desktop, Cursor, Cline, Goose, and Windsurf are all covered.

Coding
Data

Use This MCP server To

Ask questions about my data in plain English Find out why a page in my app loads slowly Get suggestions for making a slow database faster Check whether my database is healthy before a launch Explore what tables and records actually exist Look at real numbers without risking any changes

README

Postgres MCP Pro Logo

License: MIT PyPI - Version Discord Twitter Follow Contributors

A Postgres MCP server with index tuning, explain plans, health checks, and safe sql execution.

Overview

Postgres MCP Pro is an open source Model Context Protocol (MCP) server built to support you and your AI agents throughout the entire development process—from initial coding, through testing and deployment, and to production tuning and maintenance.

Postgres MCP Pro does much more than wrap a database connection.

Features include:

  • 🔍 Database Health - analyze index health, connection utilization, buffer cache, vacuum health, sequence limits, replication lag, and more.
  • ⚡ Index Tuning - explore thousands of possible indexes to find the best solution for your workload, using industrial-strength algorithms.
  • 📈 Query Plans - validate and optimize performance by reviewing EXPLAIN plans and simulating the impact of hypothetical indexes.
  • 🧠 Schema Intelligence - context-aware SQL generation based on detailed understanding of the database schema.
  • 🛡️ Safe SQL Execution - configurable access control, including support for read-only mode and safe SQL parsing, making it usable for both development and production.

Postgres MCP Pro supports both the Standard Input/Output (stdio) and Server-Sent Events (SSE) transports, for flexibility in different environments.

For additional background on why we built Postgres MCP Pro, see our launch blog post.

Demo

From Unusable to Lightning Fast

  • Challenge: We generated a movie app using an AI assistant, but the SQLAlchemy ORM code ran painfully slow.
  • Solution: Using Postgres MCP Pro with Cursor, we fixed the performance issues in minutes.

postgres-mcp FAQ

Which assistants can use it?
Claude Desktop, Cursor, Cline, Goose, and Windsurf all have instructions in the project itself.
Can it change or delete my data?
Only if you let it. A read-only mode blocks all writes and is the safer choice for anything live.
Do I need a key?
No outside key, but you do need the username, password, host, and name for your own database.
Can I use this to speed up a slow app?
Yes — it reviews how queries actually run, tests indexes that do not exist yet, and recommends the ones worth adding.
How hard is the setup?
This one leans technical. You install it through Docker or Python, then paste a configuration block containing your connection details.
Does it work with a hosted database?
Yes, as long as you have working credentials for it.