Command Palette

Search for a command to run...

UnylyUnyly
Back to Postgres

How to Install Postgres MCP in Claude Code

To install the Postgres MCP server in Claude Code, run the command below in your terminal — it connects immediately, no JSON editing.

Command
claude mcp add postgres -e DATABASE_URL="postgres://user:pass@host/db" -- uvx postgres-mcp
1-click install via Unyly
  1. 1
    Open your terminal
    In any project directory.
  2. 2
    Run the command
    claude mcp add postgres -e DATABASE_URL="postgres://user:pass@host/db" -- uvx postgres-mcp
  3. 3
    Done
    Claude Code picks up the server — its tools appear immediately.

Where the config lives

Claude Code manages MCP servers through the "claude mcp add" command, not a file you hand-edit. List what is installed with "claude mcp list" and inspect one with "claude mcp get <name>".

Project vs global scope

Scope is controlled by --scope: "local" (this project only — the default), "project" (shared with your team via a committed .mcp.json), or "user" (all your projects). Append --scope user to make the server global.

API keys & environment variables

This server needs environment variables: DATABASE_URL. Put your real values in the env block (Cursor / VS Code / Claude Desktop) or as -e KEY=value flags (Claude Code). Keep them in env, not args — otherwise the secrets leak into logs.

Verify it works

Run "claude mcp list" — the server appears with a check mark once it connects. If it shows an error, the command or an env var is wrong.

If the tools don’t appear

  • · Restart Claude Code fully (not just the window).
  • · Check the command/config for typos; validate the JSON if applicable.
  • · Make sure Node.js or uv is installed (for npx/uvx servers).
  • · Check Claude Code’s logs — the server may have crashed on start (missing env var, bad token).

How many servers is too many

Every connected server adds its tools to the model’s context. Past ~40–60 tools, selection accuracy drops. Keep only the servers you use enabled, or reach the whole catalog through a gateway — one connection instead of dozens.

Removing Postgres

Remove it with "claude mcp remove postgres". That deletes the server from the current scope.

Install Postgres in another client

FAQ

Do I need to edit JSON by hand?

No. In Claude Code it's a command or a deep-link; on Unyly the Install button writes the config for you.

Where is the Claude Code config file?

Claude Code keeps MCP servers in its own settings — installing via command/button means you never touch a file by hand.

The MCP isn’t showing up — what do I do?

Restart Claude Code, check the command/config for typos, and make sure Node.js / a package runner is installed if the server runs via npx/uvx.

How do I update Postgres?

Servers run via npx/uvx pull the latest version on launch. Otherwise, reinstall the same way.

Is it safe to install Postgres?

An MCP server runs with your client’s permissions and access to its data. Install it with the same caution as any npm package: check the source and keep secrets in env. Verified servers on Unyly have passed a security scan.

Does Postgres cost anything?

Browsing and installing on Unyly is free. The server itself may need a third-party API key — that’s billed by the service, not by Unyly.

Can I use Postgres in ChatGPT or claude.ai?

Not directly: Postgres is a local (stdio) server, and ChatGPT/claude.ai only accept remote MCPs. Use the Unyly gateway to expose local servers as one remote endpoint.