PostgreSQL MCP Server
Provides tools for full access to a PostgreSQL database, enabling users to execute SQL queries, list tables and schemas, inspect table schemas, and monitor database statistics such as cache hit ratios and connection counts.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@PostgreSQL MCP ServerShow me the schema for the orders table"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
PostgreSQL MCP Server
An MCP (Model Context Protocol) server that gives Claude full access to your PostgreSQL database over SSE (HTTP).
Available Tools
Tool | Description |
| Run any SQL — SELECT, INSERT, UPDATE, DELETE, DDL |
| List tables with sizes and row estimates |
| Full schema of a table: columns, indexes, foreign keys |
| List all schemas in the database |
| Database size, connections, cache hit ratio, top tables |
Related MCP server: PostgreSQL MCP Server for Claude Desktop
Setup
1. Configure environment
cp .env.example .env
nano .env # fill in your Postgres credentialsKey settings:
PG_HOST— IP or hostname of your PostgreSQL serverIf Postgres runs on the same Docker host: use
host.docker.internal(Linux: requiresextra_hostsin compose) or the host's LAN IPIf Postgres runs in another Docker container/network: use the container name and add the network to docker-compose.yml
2. Build and start
docker compose up -d --build3. Verify it's working
curl http://localhost:3000/health
# → {"status":"ok","database":"connected","sessions":0}Connect Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"power-db": {
"transport": "sse",
"url": "http://YOUR_SERVER_IP:3000/sse"
}
}
}Replace YOUR_SERVER_IP with your Docker host's IP (e.g. 192.168.1.50).
Then restart Claude Desktop. You'll see the tools appear in Claude's tool panel.
Connect Claude.ai (Remote MCP)
In Claude.ai Settings → Integrations → Add MCP Server:
URL:
http://YOUR_SERVER_IP:3000/sse
Note: For claude.ai remote MCP, the server must be reachable from the internet or via a tunnel (e.g.
ngrok http 3000).
Networking Tips
Postgres on Docker host (Linux)
Add to docker-compose.yml under the service:
extra_hosts:
- "host.docker.internal:host-gateway"Then use PG_HOST=host.docker.internal.
Postgres in another Docker network
networks:
- your_postgres_network
networks:
your_postgres_network:
external: trueLogs
docker compose logs -fStop / Restart
docker compose down
docker compose up -dThis server cannot be deployed
Maintenance
Related MCP Connectors
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Query your Postgres from ChatGPT or Claude without exposing the database or handing over credentials. Run npx boltschema connect next to your database and it dials out over HTTPS — no inbound firewall rule, no open port, works with localhost and VPC-private databases. Read-only is enforced by a SQL guard, a Postgres READ ONLY transaction, and a scoped role generated for you.
Query 40 databases from Claude, ChatGPT, or Cursor — on any device. Read-only, encrypted, audited.
Comprehensive PostgreSQL documentation and best practices, including ecosystem tools
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides authenticated access to PostgreSQL databases for Claude AI, enabling users to browse database tables, discover schemas, and execute custom SQL queries through natural language interaction.-
- FlicenseNot gradedqualityDmaintenanceEnables Claude Desktop to interact with PostgreSQL databases through natural language for schema exploration, data analysis, and query execution. Users can search schemas, describe tables, and perform read or write operations without needing to write manual SQL.-
- AlicenseAqualityDmaintenanceConnects Claude to any PostgreSQL database, enabling schema exploration, query execution, and performance analysis through natural conversation.76 npm1MIT
- AlicenseAqualityDmaintenanceEnables Claude to interact with a local PostgreSQL database through SQL queries, schema inspection, and CRUD operations.8152 npmMIT