PostgreSQL MCP server - query, schema introspection, explain, and health checks for AI assistants
PostgreSQL MCP server - query, schema introspection, explain, and health checks for AI assistants
One click adds this to your local Yaw MCP config so it's available in every Yaw Terminal session. Or install manually below.
Compare MCP servers by category, or browse hosted MCP servers if you prefer an endpoint over a local process.
Check the linked publisher documentation and your connected client's tool list. Names and availability can vary with the server version and account permissions.
| Tool | What it does |
|---|---|
| pg_readonly | Run a SQL statement guaranteed read-only - always inside BEGIN READ ONLY, regardless of ALLOW_WRITES. The recommended tool for read access; safe for hosts to auto-allow. |
| pg_query | Run a SQL query. Writes gated by the role in DATABASE_URL first, ALLOW_WRITES second. Supports parameterized queries via params. Result fields include dataTypeName (e.g. int4, jsonb) alongside dataTypeID. |
| pg_list_schemas | List non-system schemas. |
| pg_list_tables | List tables (and optionally views) in a schema with estimated row counts. Paginated via limit/offset. |
| pg_describe_table | Kind, columns, PK, outgoing FKs, incoming FKs (referenced_by), CHECK / UNIQUE / EXCLUDE constraints, indexes, and partition parent/children for a relation. |
| pg_list_views | List views and materialized views in a schema, including their SQL definitions. |
| pg_list_functions | List functions, procedures, and aggregates in a schema with signatures and return types. |
| pg_list_extensions | List installed extensions (pgvector, postgis, pg_stat_statements, etc.) with versions. |
| pg_search_columns | Find columns by name pattern across all user schemas. Case-insensitive, supports SQL LIKE wildcards. |
| pg_explain | EXPLAIN or EXPLAIN ANALYZE for a SQL statement. Text or JSON output. Optional hypothetical_indexes (requires the [HypoPG](https://github.com/HypoPG/hypopg) extension) lets you ask "what would the plan be with these index |
| pg_health | Server version, database size, connection count, active queries, table count. |
| pg_top_queries | Top N queries by total/mean execution time. Requires the pg_stat_statements extension. |
| pg_seq_scan_tables | Tables with heavy sequential scans - missing-index candidates. |
| pg_unused_indexes | Non-unique, non-primary indexes with low scan counts - drop candidates. |
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["-y", "@yawlabs/postgres-mcp@latest"],
"env": {
"DATABASE_URL": "postgres://user:password@host:5432/dbname"
}
}
}
}Configuration as documented by the project. Restart the client after saving.
| Variable | Description | Required |
|---|---|---|
| DATABASE_URL | Endpoint or connection string the server talks to. | Yes |
| ALLOW_WRITES | Configuration value read at startup. | Optional |
| POSTGRES_SSL_REJECT_UNAUTHORIZED | Configuration value read at startup. | Optional |
Inspect PostgreSQL schemas and run read-only queries with the archived MCP reference server. Review its maintenance status before choosing it.
Connect the Notion MCP server to search workspace content and work with pages and databases through Notion’s hosted OAuth service.
Use the Supabase MCP server to inspect database schemas, query project data and retrieve docs through a project-scoped connection.
Query, modify and analyse local SQLite databases in conversation — the fastest way to chat with a data file.
Metabase ships its own MCP endpoint — search your BI content, build and run queries, and save questions and dashboards without leaving the chat.
Official MongoDB server covering data, schemas and Atlas management — from find queries to spinning up clusters.