dbtrail
Claude Integration

Claude Setup

Connect Claude to dbtrail in 5 minutes. The console serves MCP directly, with no config files

dbtrail exposes your change history to Claude (and any MCP-capable client) through six read-only tools: search changes, draft reversal SQL, draft reversal SQL for foreign-key cascade side effects, reconstruct a row's state at a point in time, show index status, list schema changes. The AI sees exactly what the web console shows you, with the same result caps and the same redactions. It never executes SQL and never connects to your source database: recovery SQL is text you review and run yourself. (Time travel needs a backup configured for that server, exactly like the row-state section of the console's Restore view; without one the tool says so.)

The web console serves MCP directly at /mcp: no separate server to run. Everything on this page starts from one place: open the console → Settings → Connect AI. That page shows your MCP URL, checks that a token is configured, offers the Claude Desktop bundle for download, and has copy-paste snippets for every other client. Below those steps, a Connect a SQL client panel does the same for the time-travel SQL port, which is a different way in: see Time-Travel SQL.

The Connect AI page: the access token card, the MCP address to copy, the Claude Desktop setup card, and below them the Connect a SQL client panel with the time-travel port address and a ready-to-copy mysql command.

Step 0: generate a token

MCP clients authenticate with an access token: the username/password you use in the browser does not work for them. Since v0.40.0 you mint one without leaving the UI:

Open Settings → Connect AI. If no token is configured, the Access token card has a Generate token button. Click it and copy the value it shows. It appears exactly once and is never stored (only its hash is); the same card rotates or revokes it later, no restart needed. The generated token grants the read-only MCP tools only; it cannot administer the console.

That's the whole step. The token is worth protecting: anyone holding it can read your change history, row images included. Treat it like a database credential.

If a generated token stops working after a restart

The console keeps the token's hash in a file next to its other settings. If that file lands somewhere the container does not keep, the token is gone the next time the stack comes up, and every client that had it gets a 401 with nothing in the logs to explain it. Generate a new one and the problem repeats.

Since v0.70.0 you can name that file, so it lands in storage that survives: BINTRAIL_CONSOLE_MCP_TOKEN_FILE on the compose stack, or (CLI: --mcp-token-file on bintrail-console serve, --console-mcp-token-file on bintrail-console watch). The shipped compose file already points it at the data volume. Stacks that keep the console's home directory were never affected, and upgrading does not move a token they already hold.

Step 1: copy your MCP URL

Settings → Connect AI shows it, e.g. http://your-host:8090/mcp.

  • Multiple servers? /mcp targets the console's default server; /mcp/{name} targets a specific one. The card shows the URL for whichever server you have selected in the sidebar.
  • The URL only needs to be reachable from the machine where the AI client runs: LAN, VPN, or an SSH port-forward are all fine. Nothing needs to be on the public internet.

Step 2: connect your client

  1. Download the .mcpb bundle from the Connect AI page (or the releases page). Pick the one matching the machine where Claude Desktop runs.
  2. Double-click it. Claude Desktop opens an install dialog.
  3. Fill in the two fields: the MCP URL from step 1 and your access token (stored by Claude Desktop as a sensitive value).

No config files, no DSNs: the console owns the database connection. Works over private networks: under the hood the bundle runs a local stdio↔HTTP bridge to your console.

Published bundles currently cover Linux; on macOS or Windows use the raw-config fallback shown on the Connect AI page (same two values, five lines of JSON), or build a native bundle from source with make mcpb.

If your console is reachable over public HTTPS, the same /mcp URL works directly: claude.ai → Settings → Connectors → Add custom connector. No bundle, no local install.

Console not public? Use Claude Desktop with the bundle instead; it works over LAN/VPN/tunnels.

Any client that launches stdio MCP servers can use the bridge. The Connect AI page has this snippet ready to copy (.mcp.json for Claude Code, .cursor/mcp.json for Cursor):

{
  "mcpServers": {
    "dbtrail": {
      "command": "bintrail-mcp",
      "args": ["--connect", "http://your-host:8090/mcp", "--token", "YOUR_CONSOLE_TOKEN"]
    }
  }
}

The bintrail-mcp binary ships in the release archives, packages, and Docker image. If the endpoint is unreachable or the token is rejected, the bridge exits with a one-line error instead of hanging silently.

Step 3: ask something

Open a new conversation. The query, recover, recover_cascade, reconstruct, status, and list_schema_changes tools are now available. Try:

"What's the status of my binlog index?"

"Someone fat-fingered an UPDATE on users around 3pm. What did it change, and write me the SQL to undo it."

If the connection is working, Claude calls the tools and answers from the index; it never touches the source database. From there, head to Using Claude with dbtrail for example conversations, or the Tools Reference.

When something doesn't work

The most common failures: 401 (wrong token, or a port-forward pointing at a stale process), 403 "no token configured" (add --token / BINTRAIL_CONSOLE_TOKEN and restart), and connection refused (the URL isn't reachable from the AI client's machine; check curl http://host:8090/api/healthz from there). The full symptom table is in the repository: Connect an AI assistant → troubleshooting.

Headless setups (no console)

CLI-only deployments can run the standalone bintrail-mcp server against the index DSN directly, over stdio for local clients or --http for remote ones. Every option and knob: MCP server reference.

On this page