-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Status: Production/Stable
🤖 Can't find what you're looking for? Try our AI-Powered Wiki Search - Ask questions in natural language and get instant answers with source attribution.
The PostgreSQL MCP Server enables AI assistants (AntiGravity, Claude, Cursor, etc.) to interact with PostgreSQL databases through the Model Context Protocol. It features schema introspection and migration tracking, deterministic error handling, connection pooling, dual HTTP transport (Streamable HTTP + legacy SSE), OAuth 2.1 authentication, Code Mode for token efficiency, flexible tool filtering, and support for 8 PostgreSQL extensions.
232 specialized tools · 20 resources · 19 AI-powered prompts
- Quick-Start - Installation, configuration, and first queries
- HTTP-Transport - Streamable HTTP and legacy SSE endpoints for remote access
- Tool-Filtering - Stay within AI IDE tool limits with 16 presets
- Code-Mode - 70-90% token reduction for multi-step operations
- Tool-Reference - Complete reference of all 232 tools by group
- Extension-Overview - Supported extensions and detection
- Vector-and-AI-Extensions - pgvector (16 tools) + pgcrypto (9 tools)
- Spatial-and-Hierarchy-Extensions - PostGIS (15 tools) + ltree (8 tools)
- Scheduling-and-Partitioning-Extensions - pg_cron, pg_partman, pg_stat_kcache, citext
- Resources-and-Prompts - 20 MCP resources + 19 guided prompts
- OAuth-and-Security - OAuth 2.1, scopes, supply chain security
- Troubleshooting - Common issues and solutions
| Category | Count | Highlights |
|---|---|---|
| Tools | 232 | Full SQL, JSONB, transactions, performance analysis |
| Resources | 20 | Real-time database state snapshots |
| Prompts | 19 | Guided workflows for complex DBA tasks |
| Extensions | 8 | pgvector, PostGIS, pg_cron, pg_partman, and more |
| Introspection | 6 | Cascade simulation, DDL ordering, schema snapshots |
| Migration | 6 | Schema migration tracking and deployment |
| Error Model | — | Structured {success, error} on every tool |
| Group | Tools | Description |
|---|---|---|
core |
21 | Read/write queries, tables, indexes |
transactions |
8 | BEGIN, COMMIT, ROLLBACK, savepoints |
jsonb |
20 | JSONB manipulation and queries |
text |
14 | Full-text search, fuzzy matching |
performance |
25 | EXPLAIN, query analysis, optimization, anomaly detection |
admin |
11 | VACUUM, ANALYZE, REINDEX |
monitoring |
12 | Database sizes, connections, status |
backup |
10 | pg_dump, COPY, restore |
schema |
13 | Schemas, views, sequences, functions |
introspection |
7 | Dependency graphs, cascade simulation |
migration |
7 | Schema migration tracking |
partitioning |
7 | Native partition management |
stats |
9 | Statistical analysis |
vector |
17 | pgvector (AI/ML similarity search) |
postgis |
16 | PostGIS (geospatial) |
cron |
9 | pg_cron (job scheduling) |
partman |
11 | pg_partman (auto-partitioning) |
kcache |
8 | pg_stat_kcache (OS-level stats) |
citext |
7 | citext (case-insensitive text) |
ltree |
9 | ltree (hierarchical data) |
pgcrypto |
10 | pgcrypto (encryption, UUIDs) |
codemode |
1 | Code Mode (sandboxed execution) |
AI IDEs have tool limits. Use presets to stay within bounds:
# Recommended starting point (60 tools)
--tool-filter starter
# AI/ML workloads with pgvector (51 tools)
--tool-filter ai-vector
# Geospatial workloads (44 tools)
--tool-filter geo
# Maximum token savings: Code Mode only (1 tool)
--tool-filter codemodeSee Tool-Filtering for all 16 presets and customization options.
After cloning the repository:
npm install # Install dependencies
npm run lint && npm run typecheck # Run checks
npm run bench # Run performance benchmarks
npm test # Run full test suite (3000+ tests)The project includes a performance benchmark suite (10 files, 93+ scenarios) powered by Vitest Bench. Benchmarks cover schema parsing, handler dispatch, identifier sanitization, auth middleware, connection pooling, Code Mode, logging, introspection/migration parsing, and more.
npm run bench # Standard output
npm run bench:verbose # Detailed table output- GitHub Repository - Source code & issues
- Docker Hub - Container images
- npm Package - Node.js distribution
- MCP Registry - Official listing
- 🔍 AI-Powered Wiki Search - Natural language documentation search