PostgreSQL MCP β query databases, inspect schemas, explain queries.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
We haven't yet run this listing's install command through our automated sandbox check. This isn't a red flag β we're steadily working through the catalog.
π‘ Paste the JSON block into your client's configuration file under mcpServers, then restart the application.
Inspect callable tools, capabilities, and parameters exposed to AI agents by Postgres.
queryExecute SQL (SELECT, WITH, EXPLAIN, SHOW, ANALYZE). Returns a text table.
schemaTables in a schema (default `public`) with columns and approximate row counts
table_infoOne table: columns, types, null/default, PK, exact row count
explainEXPLAIN (FORMAT TEXT), optional ANALYZE
list_schemasList non-system schemas
Query PostgreSQL, inspect schemas, and explain queries from your AI assistant. A daily-driver MCP for local and dev Postgres β same belt as docker and sqlite servers, not an enterprise DBA suite.
Works with Claude Desktop, Cursor, VS Code Copilot, and any MCP client. Connects via
DATABASE_URLor per-callconnectionString.
Postgres is the default for most new backends, local dev stacks, and agent workflows that need a real SQL database. You already run it in Docker or on localhost β this server lets your assistant query it, read schemas, and explain plans without leaving the IDE. Read-only by default so exploration stays safe; opt into writes when you need them.
| Tool | What it does |
|---|---|
query | Execute SQL (SELECT, WITH, EXPLAIN, SHOW, ANALYZE). Returns a text table. |
schema | Tables in a schema (default public) with columns and approximate row counts |
table_info | One table: columns, types, null/default, PK, exact row count |
explain | EXPLAIN (FORMAT TEXT), optional ANALYZE |
list_schemas | List non-system schemas |
Add to .cursor/mcp.json:
Add to claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/claude_desktop_config.json):
Configure the MCP server in your VS Code settings to run npx mcp-pg-server with DATABASE_URL set.
Read-only by default. The query tool accepts only SELECT, WITH, EXPLAIN, SHOW, and ANALYZE in readonly mode. Set readonly=false to enable INSERT, UPDATE, DELETE, and DDL.
Pass connectionString on any tool to override DATABASE_URL for a single call.
More MCP servers and developer tools on my portfolio.
MIT Β© 2026 Ofer Shapira
Factual signals from GitHub, npm, and our automated checks β not a rating.
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/postgres)<a href="https://allmcps.com/mcp/postgres"><img src="https://allmcps.com/api/badge/postgres?style=directory" alt="Postgres on AllMCPs" /></a>