๐Ÿš€Early Access: Lifetime deal โ€” $69 for 2 data source connections. Sign up free to try firstโ†’

Back to Blog

How to Connect Claude to PostgreSQL

Step-by-step guide to connecting Claude Desktop to your PostgreSQL database using a managed MCP server. No config files, no local setup โ€” just one URL.

If you've ever wanted to ask your database a question in plain English and get a real answer, that moment is now. Claude can query your PostgreSQL database directly โ€” and this guide shows you the fastest way to set it up. (New to MCP? See What is an MCP Server?)

What Is MCP?

MCP stands for Model Context Protocol. It's an open standard that lets AI models like Claude connect to external tools and data sources โ€” databases, APIs, file systems, and more. Instead of copy-pasting query results into a chat window, Claude connects directly to your database and runs queries on your behalf.

The result: you can ask "which customers haven't ordered in the last 90 days?" and Claude will write the SQL, run it against your database, and give you the answer โ€” all in one step.

Why This Matters for PostgreSQL

PostgreSQL is where most serious data lives. Product analytics, user records, financial transactions, audit logs โ€” if your team runs on Postgres, connecting Claude to it transforms how you interact with that data.

Without MCP, the workflow looks like this:

  1. Open a SQL client
  2. Write a query (or guess the schema)
  3. Export results
  4. Paste into Claude
  5. Ask your question
  6. Repeat when the answer raises a follow-up

With MCP, that entire loop collapses into a single conversation. Claude knows your schema, writes the queries, and iterates on its own.

The Two Ways to Do This

Option 1 โ€” Local MCP server. You install a Node.js or Python MCP server on your machine, edit a JSON config file in Claude Desktop, handle connection strings, manage environment variables, and restart the app every time something changes. It works, but it's fiddly โ€” especially across a team or on a remote database.

Option 2 โ€” Managed MCP gateway (Synra). You save your database credentials once in a secure dashboard. Synra gives you a single HTTPS URL. You paste that URL into Claude Desktop. Done.

No local install. No config files. No restart-and-debug loop. And because it's a hosted service at mcpserver.design, it works the same whether your database is on AWS RDS, Neon, Railway, DigitalOcean, or your own server.

Step-by-Step: Connect PostgreSQL via Synra

Step 1 โ€” Get your database credentials

You'll need:

  • Host โ€” e.g. db.example.us-east-1.rds.amazonaws.com
  • Port โ€” usually 5432
  • Database name
  • Username and password

If you're using Neon or Supabase, you can copy the connection string directly from your project dashboard.

Step 2 โ€” Save credentials in Synra

  1. Sign in at mcpserver.design
  2. Go to Credentials โ†’ Add Database
  3. Select PostgreSQL, fill in your connection details, and save
  4. Synra encrypts your credentials with AES-256 and immediately tests the connection

Step 3 โ€” Copy your MCP URL

Once your connection is verified, Synra generates a personal MCP endpoint URL โ€” something like:

https://gateway.mcpserver.design/mcp/your-token

Copy it from the Endpoints tab in your dashboard.

Step 4 โ€” Add it to Claude

Open Claude โ†’ Settings โ†’ Connectors โ†’ Add custom connector โ†’ paste your Synra URL. No config files needed. Claude is now connected.

What You Can Do Now

With the connection live, try asking Claude:

  • "What are the 10 most active users this week?"
  • "Show me all orders over $500 placed in the last 30 days."
  • "Which tables reference the users table?"

Claude will inspect your schema, write appropriate SQL, and return real results. All queries are read-only by default โ€” Synra blocks INSERT, UPDATE, DELETE, DROP, and ALTER at the gateway level, so there's no risk of accidental writes.


Ready to try it? Set up takes under 60 seconds at mcpserver.design.

Related guides: