← Back to PostgreSQL MCP Server
Install PostgreSQL MCP Server
Pick your client, copy the command, done.
Manual setup required. The maintainer's config contains paths only you know - edit the placeholders below before adding it to Claude Code.
1
Prepare the server locally
Run this once before adding it to Claude Code.
git clone https://github.com/guibracco/postgres-mcp-server
cd postgres-mcp-serverThen follow the repository README for any remaining dependency or build steps.
2
Register it in Claude Code
claude mcp add -e "DB_NAME=${DB_NAME}" -e "DB_USER=${DB_USER}" -e "DB_PASSWORD=${DB_PASSWORD}" -e "DB_HOST=${DB_HOST}" -e "DB_PORT=${DB_PORT}" postgres-mcp-server -- poetry -C /absolute/path/to/postgres-mcp-server run python postgres-mcp-server/main.pyReplace any placeholder paths in the command with the real path on your machine.
Required:
DB_NAMEDB_USERDB_PASSWORDDB_HOSTDB_PORTEnvironment Variables
Set these before running PostgreSQL MCP Server.
VariableDescriptionRequired
DB_NAMEThe name of the PostgreSQL databaseYesDB_USERThe username for database authenticationYesDB_PASSWORDThe password for database authenticationYesDB_HOSTThe host address of the database serverYesDB_PORTThe port number for the database connectionYesAvailable Tools (1)
Once configured, PostgreSQL MCP Server gives your AI agent access to:
get_schemaRetrieves the database schema to allow the AI to understand the structure of your PostgreSQL database.Try It Out
After setup, try these prompts with your AI agent:
→Can you retrieve the database schema so I can understand the table structures?
→What tables are currently available in my PostgreSQL database?
→Help me understand the relationships between the tables in my database schema.
Keep this setup from going cold
Save the docs, env vars, and workflow around PostgreSQL MCP Server in Conare so Claude Code, Codex, and Cursor remember it next time.