Skip to main content
TS
Connectors

PostgreSQL

Read-only Postgres queries from your AI

Let your AI query Postgres safely

Schema introspection and read-only queries for analysis without hand-writing SQL.

PostgreSQL is the open-source relational database that powers critical data for thousands of products. The official MCP server provides "read-only access to PostgreSQL databases" so Claude can inspect schemas and run read queries without opening a separate SQL tool.

What it does: it exposes a query tool to execute read-only SQL against the connected database and schema resources for each table. The official README states that "All queries are executed within a READ ONLY transaction", making it useful for analysis, support, debugging and data exploration.

What you can ask

  • "List the tables available in this database and explain the likely relationships."
  • "Run a SELECT that counts active customers by plan for the last 30 days."
  • "Inspect the schema for the orders table and suggest the safest query for revenue by month."

What connection you need

You need a Postgres connection URL for a specific database, for example postgresql://user:password@host:5432/db. The official README shows the connection argument in args and says: "Replace /mydb with your database name."

  1. Create a dedicated Postgres user for Terminal Sync.
  2. Give it the minimum read permissions for the tables it needs.
  3. Paste the connection URL when the Lab asks for POSTGRES_URL. Terminal Sync stores it encrypted in your Keychain.

Even though the server executes queries in a READ ONLY transaction, we also recommend using a read-only database role for defense in depth.

Add to TS

We open the app and set it up in Claude Code (and your other Macs).

Don't have TS yet?Download →

How it works with TS

Set up the connector once on one machine. TS keeps your claude_desktop_config.json encrypted in your Drive, so on any other machine where you open Claude Code, the connector is already there.