{
"mcpServers": {
"pg-mcp-server": {
"command": "<see-readme>",
"args": []
}
}
}No install config available. Check the server's README for setup instructions.
Are you the author?
Add this badge to your README to show your security score and help users find safe servers.
Is it safe?
No package registry to scan.
No authentication — any process on your machine can connect.
MIT. View license →
Is it maintained?
Last commit 210 days ago. 536 stars.
Will it work with my client?
Transport: sse. Compatibility not confirmed.
Context cost
4 tools. ~300 tokens (0.2% of 200K).
No automated test available for this server. Check the GitHub README for setup instructions.
No known vulnerabilities.
connectRegister a PostgreSQL connection string and get a secure connection ID
disconnectClose a database connection when done
pg_queryExecute read-only SQL queries using a connection ID
pg_explainAnalyze query execution plans in JSON format
database_descriptionComprehensive database description with schema and structure information
pgmcp://{conn_id}/
schemasList schemas with descriptions
pgmcp://{conn_id}/schemas
schema_tablesList tables in a schema with descriptions and row counts
pgmcp://{conn_id}/schemas/{schema}/tables
table_columnsGet column details with data types and descriptions for a table
pgmcp://{conn_id}/schemas/{schema}/tables/{table}/columns
table_constraintsView table constraints and indexes
pgmcp://{conn_id}/schemas/{schema}/tables/{table}/constraints
table_sampleSample table data with pagination
pgmcp://{conn_id}/schemas/{schema}/tables/{table}/sample
table_row_countGet approximate row count for a table
pgmcp://{conn_id}/schemas/{schema}/tables/{table}/row_count
extensionsExplore database extensions with built-in context
pgmcp://{conn_id}/extensions
This server is missing a description.If you've used it, help the community.
Add informationHave you used this server?
Share your experience — it helps other developers decide.
Sign in to write a review.
Persistent memory using a knowledge graph
Privacy-first. MCP is the protocol for tool access. We're the virtualization layer for context.
Pre-build reality check. Scans GitHub, HN, npm, PyPI, Product Hunt — returns 0-100 signal.
Monitor browser logs directly from Cursor and other MCP compatible IDEs.
MCP Security Weekly
Get CVE alerts and security updates for Pg Mcp Server and similar servers.
Start a conversation
Ask a question, share a tip, or report an issue.
Sign in to join the discussion.
A Model Context Protocol (MCP) server for PostgreSQL databases with enhanced capabilities for AI agents.
More info on the pg-mcp project here:
PG-MCP is a server implementation of the Model Context Protocol for PostgreSQL databases. It provides a comprehensive API for AI agents to discover, connect to, query, and understand PostgreSQL databases through MCP's resource-oriented architecture.
This implementation builds upon and extends the reference Postgres MCP implementation with several key enhancements:
Built-in contextual information for PostgreSQL extensions like:
Additional extensions can be easily added via YAML config files.
# Clone the repository
git clone https://github.com/stuzero/pg-mcp-server.git
cd pg-mcp-server
# Build and run with Docker Compose
docker-compose up -d
# Clone the repository
git clone https://github.com/stuzero/pg-mcp-server.git
cd pg-mcp-server
# Install dependencies and create a virtual environment ( .venv )
uv sync
# Activate the virtual environment
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Run the server
python -m server.app
The repository includes test scripts to verify server functionality:
# Basic server functionality test
python test.py "postgresql://username:password@hostname:port/database"
# Claude-powered natural language to SQL conversion
python example-clients/claude_cli.py "Show me the top 5 customers by total sales"
The claude_cli.py script requires environment variables:
# .env file
DATABASE_URL=postgresql://username:password@hostname:port/database
ANTHROPIC_API_KEY=your-anthropic-api-key
PG_MCP_URL=http://localhost:8000/sse
Example prompt for use with agents:
Use the PostgreSQL MCP server to analyze the database.
Available tools:
- connect: Register a database connection string and get a connection ID
- disconnect: Close a database connection
- pg_query: Execute SQL queries using a connection ID
- pg_explain: Get query execution plans
You can explore schema resources via:
pgmcp://{con
... [View full README on GitHub](https://github.com/stuzero/pg-mcp-server#readme)