PostgreSQL MCP Server
Query and explore PostgreSQL databases using natural language
The PostgreSQL MCP Server lets Claude inspect your database schema and run read-only SQL queries. Perfect for data exploration, generating reports, and building dashboards — without writing a single line of SQL yourself.
Installation & Configuration
Add this block to your claude_desktop_config.json (or your agent framework's MCP config file):
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres", "postgresql://user:pass@localhost/dbname"]
}
}
}
Config file location:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/claude/claude_desktop_config.json
Available Tools (3)
querydescribe_tablelist_tables
Use Cases
- Data exploration — ask "show me the top 10 customers by revenue"
- Schema understanding — let Claude map your database structure
- Report generation — produce SQL queries from plain-English requests
Source & Documentation
GitHub Repository: https://github.com/modelcontextprotocol/servers/tree/main/src/postgres
Protocol: Model Context Protocol (MCP) — modelcontextprotocol.io