Model Context Protocol server for schema-aware Postgres database access from any MCP-capable AI agent
pg-mcp-server is a Model Context Protocol server implementation that connects AI agents to PostgreSQL databases. It registers database schemas as MCP resource templates and exposes SQL execution as an MCP tool. Agents can introspect table structures, run parameterized queries, and manage transactions without leaving the chat interface. Designed as a reference implementation for database MCP integrations.
Use cases
- Inspect a Postgres database schema as MCP resources before writing migrations
- Execute read-only analytical queries via AI agent with full SQL context
- ValidateORM-generated SQL against the actual database schema
- Debug RLS policy behavior by running queries as different Postgres roles
- Generate database documentation from live schema introspection
Key features
- Claude Desktop
- Cursor
- Windsurf
Related
Related
3 Indexed items
MongoDB MCP
Allows AI agents to run queries, inspect collections, execute aggregation pipelines, and analyze explain plans against MongoDB clusters. Debug document models and performance issues by having the agent explore data structures directly. Supports MongoDB Atlas federated queries and Atlas Search.
Pinecone MCP
Enables AI agents to inspect Pinecone vector database indexes, query vectors, manage collections, and debug retrieval behavior. Useful for teams using vector search in RAG applications who want to understand index statistics and optimize similarity search performance.
Postgres MCP
Enables AI agents to execute read-only SQL queries against PostgreSQL databases, inspect table schemas, and analyze query performance. Agents can debug data issues or prepare analytics without requiring direct database credentials in the conversation. Supports connection pooling and multiple database targets.