Basic information
About Postgresql Mcp Ddz Server
PostgreSQL MCP Server
Postgresql Mcp Ddz is a MCP server in the Databases category listed in the AddMCP.net directory, published by fanzhenddz. It exposes 7 tools, including connect_db, query, execute, list_tables and more. Supported transport: stdio. License: MIT. Source code is hosted on github.com. Related topics: postgresql.
Setup
{
"mcpServers": {
"postgresql-mcp-ddz": {
"command": "npx",
"args": [
"postgresql-mcp-ddz"
],
"env": {
"POSTGRES_HOST": "127.0.0.1",
"POSTGRES_PORT": "5432",
"POSTGRES_USER": "postgres",
"POSTGRES_PASSWORD": "your_password",
"POSTGRES_DB": "your_database"
}
}
}
}
{
"mcpServers": {
"postgresql-mcp-ddz": {
"command": "npx",
"args": [
"postgresql-mcp-ddz"
],
"env": {
"POSTGRES_HOST": "127.0.0.1",
"POSTGRES_PORT": "5432",
"POSTGRES_USER": "postgres",
"POSTGRES_PASSWORD": "your_password",
"POSTGRES_DB": "your_database"
}
}
}
}
{
"servers": {
"postgresql-mcp-ddz": {
"command": "npx",
"args": [
"postgresql-mcp-ddz"
],
"env": {
"POSTGRES_HOST": "127.0.0.1",
"POSTGRES_PORT": "5432",
"POSTGRES_USER": "postgres",
"POSTGRES_PASSWORD": "your_password",
"POSTGRES_DB": "your_database"
}
}
}
}
Postgresql Mcp Ddz config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"postgresql-mcp-ddz": {
"command": "npx",
"args": [
"postgresql-mcp-ddz"
],
"env": {
"POSTGRES_HOST": "127.0.0.1",
"POSTGRES_PORT": "5432",
"POSTGRES_USER": "postgres",
"POSTGRES_PASSWORD": "your_password",
"POSTGRES_DB": "your_database"
}
}
}
}
Postgresql Mcp Ddz tools
-
connect_db
— Connect to a PostgreSQL database
host:string*, port:number, user:string*, password:string*, database:string* -
query
— Execute a SELECT query and return results
sql:string*, params:array -
execute
— Execute an INSERT, UPDATE, or DELETE query
sql:string*, params:array -
list_tables
— List all tables in the database
(no parameters) -
describe_table
— Get the structure of a specific table
table:string* -
explain
— Analyze SQL query performance using EXPLAIN
sql:string* -
show_statement
— Execute a SHOW statement (e.g., SHOW STATUS, SHOW VARIABLES)
sql:string*
Overview
What is Postgresql Mcp Ddz?
Postgresql Mcp Ddz is a PostgreSQL database operation server built on the Model Context Protocol (MCP). It enables AI assistants to interact with PostgreSQL databases through a standardized interface, supporting query execution, data modification, schema inspection, and performance analysis.
How to use Postgresql Mcp Ddz?
Install with npm install postgresql-mcp-ddz or run directly via npx postgresql-mcp-ddz. Configure automatic database connection by setting environment variables (POSTGRES_HOST, POSTGRES_PORT, POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB) in your MCP client, or use the connect_db tool to connect manually. Once connected, invoke tools like query, execute, list_tables, describe_table, explain, and show_statement to interact with the database.
Key features of Postgresql Mcp Ddz
- Execute parameterized SELECT queries
- Perform INSERT, UPDATE, and DELETE operations
- List database tables and view table structures
- Analyze query performance with EXPLAIN
- Supports both environment variable and manual connection
Use cases of Postgresql Mcp Ddz
- AI assistants querying live PostgreSQL databases
- Automated data entry and modification workflows
- Schema exploration for database documentation
- Performance tuning by analyzing query plans
Frequently asked questions
1 What is the difference between the `query` and `execute` tools?
query executes SELECT, SHOW, EXPLAIN, and WITH statements only. execute handles INSERT, UPDATE, and DELETE operations.
2 How do I connect to a database?
Set POSTGRES_HOST, POSTGRES_PORT, POSTGRES_USER, POSTGRES_PASSWORD, and POSTGRES_DB environment variables for automatic connection, or use the connect_db tool with the same parameters.
3 What is the runtime requirement for Postgresql Mcp Ddz?
It requires Node.js and npm (or npx) to install and run the server.
4 How are database credentials protected?
Credentials are passed only at runtime via environment variables or the connect_db tool parameters; the server does not persist them.
5 Can I use this server without environment variables?
Yes. Omit the environment variables and use the connect_db tool manually to connect each session.
Comments
No comments yet
Be the first to share feedback about this listing. Sign in to leave a comment.
Sign In