Available Tools
Schema Exploration
"Show all tables and their column types"
"Describe the users table"
"What foreign keys reference the orders table?"
"Show all indexes on the products table"Query Execution
"Find all users who signed up in the last 30 days"
"What is the average order value by country?"
"Show the top 10 products by revenue this quarter"
"Count active vs inactive users"Data Analysis
"Analyze the orders table and find trends in monthly revenue"
"Find customers with declining purchase frequency"
"Show the distribution of order sizes"Schema Management
"Create a table for tracking user preferences with columns: user_id, key, value, updated_at"
"Add an index on the email column of the users table"
"Add a nullable column 'phone' to the customers table"Migration Generation
"Generate a migration to add soft-delete to the users table"
"Create a migration that adds a full-text search index on products.description"Safety Features
Read-Only Mode
{
"env": {
"POSTGRES_CONNECTION_STRING": "postgresql://readonly_user:pass@host/db"
}
}Query Confirmation
The agent shows the SQL before executing write operations — you approve or reject.
Key Stats
- 3,000+ GitHub stars
- Official MCP server
- Full SQL execution
- Schema exploration
- Read-only mode available
FAQ
Q: What is PostgreSQL MCP? A: An MCP server that gives AI agents direct access to PostgreSQL databases for querying data, exploring schemas, and managing tables via natural language.
Q: Is it safe? A: Use a read-only database user for exploration. Write operations require confirmation. Never use superuser credentials.
Q: Is PostgreSQL MCP free? A: Yes, open-source under MIT license.