Connect an AI client to your database, safely.

Pick the AI client and the database. You get a read-only login with limits, and the exact MCP configuration for Claude Desktop, Claude Code, Cursor, VS Code, Windsurf or Codex.

AI & MCPFree · runs in your browser · nothing is uploaded
AI client
Database
MCP server
1

Create a read-only login

Reads only, with a timeout and a connection limit. Keep the password in a secret store, not in this script.

Read-only loginPostgreSQL
-- Read-only login for an AI client. Run as an administrator, on a replica or staging copy where you can.
CREATE ROLE mcp_reader LOGIN PASSWORD 'use-a-secret-store' CONNECTION LIMIT 5;
GRANT CONNECT ON DATABASE app TO mcp_reader;
GRANT USAGE ON SCHEMA public TO mcp_reader;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO mcp_reader;
-- tables you create later in this schema are readable too
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO mcp_reader;

-- limits for every session of this login
ALTER ROLE mcp_reader SET default_transaction_read_only = on;
ALTER ROLE mcp_reader SET statement_timeout = '30s';
ALTER ROLE mcp_reader SET lock_timeout = '5s';
ALTER ROLE mcp_reader SET idle_in_transaction_session_timeout = '60s';

-- PostgreSQL 14 and earlier let every role create tables in public.
-- If your applications don't rely on that, close it:
-- REVOKE CREATE ON SCHEMA public FROM PUBLIC;
2

Add it to Claude Desktop

Where: ~/Library/Application Support/Claude/claude_desktop_config.json (Windows: %APPDATA%\Claude\claude_desktop_config.json)

claude_desktop_config.jsonJSON
{
  "mcpServers": {
    "database": {
      "command": "your-mcp-server",
      "args": [],
      "env": {
        "DATABASE_URL": "postgresql://mcp_reader:PASSWORD@replica.internal:5432/app?sslmode=require"
      }
    }
  }
}

Merge into the file's existing mcpServers, then quit Claude Desktop and open it again.

Replace PASSWORD with the real one only on your own computer. Don't commit this file.

3

Check before you connect

  • It points at a replica or a staging copy, not the primary, where you can.
  • It never uses the application's own login or an administrator account.
  • Columns with personal or health data are kept out or masked.
  • Any write goes through a person first. A read-only login can't write at all, which is the point.

How it works

Everything is generated in your browser. Nothing you type is sent anywhere, and the scripts use placeholders for passwords.

  • The login can only read. On PostgreSQL the grants allow SELECT only, and the session defaults to read-only. The grant is what stops writes; the read-only default is a second layer.
  • Limits stop runaway queries. A statement timeout, a lock timeout and a cap on connections, where the database supports them per login.
  • Sensitive tables stay out. List them and the script revokes or denies them.
  • Secrets stay out of config files where the client allows it. VS Code prompts for the connection string and stores it encrypted.

The reasoning behind each step is in How to connect Claude, OpenAI or Cursor to your database safely over MCP.

Or let Quorum handle the access

With Quorum's MCP server, passwords stay in Quorum, each connection is off for AI clients until you share it, masked columns come back masked, and by default a write waits until a person approves it. A free 14-day trial is coming soon; request access to hear first.