PostgreSQL (MCP) Claude Desktop Integration
This guide explains how to configure Claude Desktop (Mac and Windows) to use the PostgreSQL (MCP) API through the Model Context Protocol (MCP). The integration exposes 2 API endpointsas callable tools inside Claude's chat interface, including Execute SQL query, Get database schema. Setup requires Database Credentials credentials and takes approximately 2 minutes. The server runs locally via npx and communicates over STDIO transport. Paste the JSON configuration below into your claude_desktop_config.json file to get started.
Integration Specs
Setup Instructions
Open Claude Settings
Launch Claude Desktop, open Settings (click your profile) → Developer → click 'Edit Config'.
Locate configuration file
This opens your local 'claude_desktop_config.json' file in your system editor.
Insert Server Config JSON
Paste the JSON configuration schema block (provided below) into the 'mcpServers' object.
Add authentication credentials
Replace placeholders in the 'env' object with your actual Database Credentials credentials.
Restart Claude app
Save the config file and restart Claude Desktop to load your new tools.
Configuration JSON
claude_desktop_config.jsonCopy and paste this config snippet inside your local configuration file.
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-postgres"
],
"env": {
"DATABASE_URL": "postgresql://user:pass@host:5432/db"
}
}
}
}Required Environment Keys
Provide these variable keys in your local environment section:
DATABASE_URLReplace postgresql://user:pass@host:5432/db with your secret key credentials.
Available Tools (2)
These endpoints are parsed from the OpenAPI schema and converted to Claude-compatible tools:
/query/schema