PostgreSQL Features
- •Execute read-only SQL queries
- •Automatic schema discovery
- •Table schema information in JSON format
- •Safe read-only transactions
- •Database metadata inspection
PostgreSQL Setup & Configuration
Requirements
- •PostgreSQL database
- •Docker or Node.js
- •Database connection URL
Installation Instructions
# Docker Installation
docker build -t mcp/postgres -f src/postgres/Dockerfile .
docker run -i --rm mcp/postgres postgresql://host:port/db-name
# NPX Installation
npx -y @modelcontextprotocol/server-postgres postgresql://localhost/mydb
Configuration
# Docker Configuration (macOS)
{
"mcpServers": {
"postgres": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"mcp/postgres",
"postgresql://host.docker.internal:5432/mydb"
]
}
}
}
# NPX Configuration
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-postgres",
"postgresql://localhost/mydb"
]
}
}
}
PostgreSQL Available Tools
- •
query
PostgreSQL Required Inputs
sql
- Type
- string
- Description
- The SQL query to execute (read-only)
- Required
- Yes
PostgreSQL Use Cases
- •Database schema inspection
- •Data analysis and reporting
- •Read-only database operations
- •Schema documentation generation
- •Database exploration via natural language
Frequently Asked Questions
A Model Context Protocol server that provides read-only access to PostgreSQL databases. This server enables LLMs to inspect database schemas and execute read-only queries.
PostgreSQL database, Docker or Node.js, Database connection URLView detailed requirements
Follow the installation instructions in the setup section above.View installation guide
PostgreSQL MCP provides the following tools:
- •
query