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
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.
DuckDB MCP community extension (`duckdb_mcp`)
The DuckDB-distributed community extension `duckdb_mcp` embeds MCP client and server capabilities directly inside DuckDB. Installers load it via `INSTALL duckdb_mcp FROM community` followed by `LOAD duckdb_mcp`, after which SQL can attach remote MCP servers (stdio/TCP/WebSocket transports), enumerate resources (`mcp_list_resources`), invoke remote tools (`mcp_call_tool`), and wrap responses with `read_csv`/`read_json`/`read_parquet` URIs routed through `mcp://`. In reverse direction, DuckDB can publish tables, queries, and execution-bound tools (`mcp_publish_table`, `mcp_publish_query`, `mcp_publish_execution_tool`) while `mcp_server_start` exposes them to external MCP-compatible clients.
Neo4j MCP Server
Neo4j documents an official Model Context Protocol server at neo4j.com/docs/mcp/current and in the neo4j/mcp repository. It gives MCP clients structured access to a Neo4j graph: get-schema introspects labels, relationship types, and property keys; read-cypher runs read-only Cypher checked with EXPLAIN and Neo4j query-type classification; write-cypher runs writes unless NEO4J_MCP_READ_ONLY=true; list-gds-procedures lists Graph Data Science procedures when GDS is installed. Prerequisites are a running Aura, Neo4j Desktop, or self-managed database plus the APOC plugin. Local clients use stdio via uvx neo4j-mcp-server or the Homebrew/binary neo4j-mcp, with NEO4J_MCP_URI, NEO4J_MCP_USERNAME, NEO4J_MCP_PASSWORD, and NEO4J_MCP_DATABASE. Aura uses HTTP at https://<instance-id>.mcp-instances.neo4j.io after Tool authentication is enabled in the Aura console. Docs also describe an HTTP transport mode that takes URI and credentials per request and selects the database from the /db/{databaseName}/mcp path.