MCP Servers / database / PostgreSQL MCP

PostgreSQL MCP

JSON →
none1database

Transforms PostgreSQL databases from "I have tables and I don't know what they do" into "I understand the entire database structure, relationships, and best practices"

Install
How to run this server

No install command recorded.

server path: postgresql-mcp
Tools
What this server exposes
analyze_database
Comprehensive schema analysis without LLM. Returns full schema structure, junction tables, implicit relationships, join suggestions, PlantUML diagrams, and Markdown documentation.
explain_database
AI-powered database analysis using Ollama LLM. Provides business explanation, relationship detection, improved PlantUML ERD, and quality recommendations.
get_table_details
Detailed analysis of a specific table including structure, relationships, column information, constraints, and Markdown documentation.
get_database_info
Unified info retrieval tool. Supports info_type='tables' (list tables), 'ollama' (check LLM status), or 'summary' (quick database statistics).
render_database_diagrams
Generate visual database structure diagrams (ER, Class, Component) in SVG, PNG, or PDF format saved to the diagrams/ directory.
crud_insert
Smart insert supporting single (Dict) or batch (List[Dict]) operations with automatic mode detection and SQL injection prevention.
crud_create_table
Create a new table with specified columns, types, constraints, and optional primary key.
crud_create_view
Create a database view from a SELECT query with optional replacement if the view already exists.
crud_create_index
Create single or composite indexes on a table with optional UNIQUE constraint.
crud_query
Execute raw SQL SELECT queries with parameterized values (%s placeholders) and pagination support via limit/offset.
crud_get
Unified high-level read operation supporting mode='records' for filtered record retrieval with where clause and options.
Configuration
Environment & auth
authnone
envOLLAMA_BASE_URL
Resources
PostgreSQL MCP — MCP Server · libregistry