Integration · MCP & HTTP · Open Source (Apache-2.0) & Cloud


Claude Code + Claix: Let Claude Work With Your Database Without Risking Your Data
Claude Code moves fast because it does not stop at suggesting code — it reads your repository, runs terminal commands, and calls MCP tools in a loop until the task is done. That autonomy is a superpower in application files and a liability the moment a real database connection enters the session.
Across public postmortems in 2025 and 2026, autonomous coding agents wiped production tables in seconds — with --accept-data-loss flags, cleanup against the wrong environment, or destructive SQL behind broad credentials. Claix puts a deterministic perimeter between Claude Code and PostgreSQL, MySQL, or MariaDB: every proposed write is parsed, checked against the rows it would touch, and blocked unless an explicit permission covers it — with zero model calls at check time.
The problem
Why read-only MCP and PreToolUse regex hooks are not enough
Teams connecting Claude Code to SQL databases usually try one of two shortcuts — and hit the wall on both.
A blanket read-only MCP connection stops DROP TABLE, but it still exposes sensitive columns and cross-tenant rows to prompt injection or broad SELECT * queries. The moment you need Claude to seed data or fix a broken record, someone swaps in a write-capable credential “just for five minutes.”
DIY PreToolUse regex hooks in ~/.claude/settings.json fare worse. Regex cannot parse SQL ASTs, cannot spot a DELETE that matches 40,000 paid orders instead of one test row, and in Claude Code any hook that crashes or exits with code 1 instead of 2 fails open and lets the command run anyway.
How Claix helps
Deny-by-default SQL firewall for Claude Code
Claix replaces guesswork with a deterministic engine you can run locally (Core) or hosted (Cloud).
Explicit permissions per operation
A permission covering a single-row DELETE never authorizes a DROP, ALTER, TRUNCATE, or GRANT. With no matching permission, writes are denied by default.
Session-escape immunity
Plain SELECT and transaction statements (BEGIN, COMMIT) pass. Session mutations that could disarm database security — switching roles or turning off RLS — cannot be permitted.
Affected-row inspection
Through a read-only claix_agent role, Claix inspects the exact rows a proposed write would touch and returns allow, deny, or needs_approval without executing the write.
Scoped reads per agent
Every read runs through a defined agent whose row scope travels with the query, keeping staging portals, support flows, and tenant boundaries separated.
Core vs Cloud
Two ways to run Claix with Claude Code
A solo developer on a laptop and a ten-person team touching staging need different operations — but the exact same SQL check.
| Scenario | Claix Core | Claix Cloud |
|---|---|---|
| Best for | Individual developers, local Docker/dev stacks, air-gapped networks, Git-versioned YAML policies | Multi-developer teams, shared staging/production, human-in-the-loop approvals, compliance |
| Where it runs | Laptop, VPS, or private container (Node.js 22+ or ghcr.io/claix-dev/claix-core). No Claix account | Hosted at claix.dev with credentials encrypted in Cloud Vault |
| How Claude Code connects | Local stdio MCP (npx -y @claix-dev/core mcp) or HTTP on port 8787 | Remote HTTP MCP (https://claix.dev/mcp) or REST/A2A via shared .mcp.json |
| When needs_approval | Returns needs_approval in JSON/MCP so Claude stops instead of writing | Routes the statement to Slack for one-click approve or reject |
| Audit trail | Local append-only traces.jsonl on the machine running Core | Central company audit log across developers, sessions, and workspaces |
| Policy authoring | YAML beside your code + claix validate against the live catalog | Visual dashboard, workspaces per team/environment, instant rule updates |
When to choose which
Why Core locally — and why Cloud for teams
Why Claix Core on your machine
Even in local development, Claude Code can wipe seed state, corrupt schema assumptions, or hit a tunnelled remote host left in .env. Core (Apache-2.0) costs nothing, needs no signup, keeps credentials on your machine, and lets you run claix validate before any agent query.
Why teams move shared environments to Cloud
Once several developers use Claude Code on the same codebase, local traces.jsonl files stay on laptops, secrets drift across .env files, and nobody can review a risky UPDATE when needs_approval fires. Cloud centralizes workspaces, stores the claix_agent password in Cloud Vault, and turns needs_approval into a live Slack approval.
Option 1
Set up Claix Core locally with Claude Code
Claix Core runs on Node.js 22+ via @claix-dev/core or Docker (ghcr.io/claix-dev/claix-core).
- 01
Initialize and validate your perimeter
Create ./claix (guards, routes, scoped agents) and verify it against your PostgreSQL, MySQL, or MariaDB catalog with a read-only claix_agent role.
- 02
Optional Docker quickstart
Clone claix-core and bring up the sample shop database to test denials, approvals, and row-scoped reads in about a minute.
- 03
Register Claix via Claude MCP
Add the local stdio MCP server with claude mcp add (note the -- separator before npx), or declare it in .mcp.json with environment expansion so secrets stay out of Git. Confirm with claude mcp list.
Core snippets
Init, Docker, MCP add, and .mcp.json
Validate against your live catalog before Claude runs a single query. Prefer env expansion in .mcp.json so no passwords land in Git.
Init & validate
npx -y @claix-dev/core init npx -y @claix-dev/core validate
Docker quickstart
git clone https://github.com/claix-dev/claix-core cd claix-core docker compose up -d --build --wait
claude mcp add (stdio)
claude mcp add --transport stdio \ --env CLAIX_API_KEY=your_local_key \ --env CLAIX_CONFIG_DIR=./claix \ --env CLAIX_DB_ENGINE=postgres \ --env CLAIX_DB_HOST=127.0.0.1 \ --env CLAIX_DB_NAME=app \ --env CLAIX_DB_USER=claix_agent \ --env CLAIX_DB_PASSWORD=your_readonly_password \ --scope project claix -- npx -y @claix-dev/core mcp
.mcp.json (Core)
{
"mcpServers": {
"claix": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@claix-dev/core", "mcp"],
"env": {
"CLAIX_API_KEY": "${CLAIX_API_KEY}",
"CLAIX_CONFIG_DIR": "./claix",
"CLAIX_DB_ENGINE": "postgres",
"CLAIX_DB_HOST": "${CLAIX_DB_HOST:-127.0.0.1}",
"CLAIX_DB_NAME": "${CLAIX_DB_NAME}",
"CLAIX_DB_USER": "claix_agent",
"CLAIX_DB_PASSWORD": "${CLAIX_DB_PASSWORD}"
}
}
}
}Option 2
Connect Claude Code to Claix Cloud
For managed policies, visual editing, workspaces, central audit logs, and Slack approvals, connect Claude Code over HTTP to Claix Cloud — no local runtime required. Commit a shared .mcp.json so every checkout gets the same guardrail without committing keys.
claude mcp add (HTTP)
claude mcp add --transport http claix https://claix.dev/mcp \
--header "Authorization: Bearer ${CLAIX_CLOUD_API_KEY}".mcp.json (Cloud)
{
"mcpServers": {
"claix": {
"type": "http",
"url": "https://claix.dev/mcp",
"headers": {
"Authorization": "Bearer ${CLAIX_CLOUD_API_KEY}"
}
}
}
}Policy
Add five lines to CLAUDE.md
Pair the MCP connection with a short policy block in your root CLAUDE.md. Never hand Claude Code raw superuser database credentials.
CLAUDE.md
## Database Access Policy (Claix) - Never connect to PostgreSQL/MySQL directly via raw `psql`, `mysql`, or `--force` / `--accept-data-loss` flags. - For all data reads, call `claix_retrieve_ask` through the Claix MCP server so route and row scopes apply. - Before applying any `INSERT`, `UPDATE`, `DELETE`, or schema statement, call `claix_guard_check`. - Execute a statement ONLY when `claix_guard_check` returns `allow`. Stop immediately on `deny` or `needs_approval`.
Grow into Cloud
Import from Core in about two minutes
You never rewrite YAML when the project grows from one developer into a team. Claix Cloud includes Import from Core under /dashboard/database-connection.
- 01
Gather Core files
Collect your Core .env (CLAIX_DB_* with CLAIX_DB_USER=claix_agent and SSL require or verify-full), plus claix/guards, routes, agents YAML, and optionally traces.jsonl (up to 8 MB / newest 2,000 events).
- 02
Import as workspace owner
Sign in at /dashboard/database-connection and click Import from Core. Upload the files. If anything fails before the connection saves, nothing is half-applied and every issue is listed by filename.
- 03
Cloud Vault and Slack
The database password moves into Cloud Vault, deny-by-default guards and row scopes stay intact, and needs_approval verdicts gain Slack approval support.
Frequently asked questions
- Does Claix call an LLM to check SQL statements generated by Claude Code?
- No. Deciding whether a SQL statement is allowed never calls a model in either Claix Core or Claix Cloud. Claix parses the statement deterministically, inspects the rows a write would touch through a read-only database role, and returns allow, deny, or needs approval.
- Should I use Claix Core (Open Source) or Claix Cloud with Claude Code?
- Use Claix Core (Apache-2.0) when you want to run the open-source SQL firewall on your own machine or container via Docker or npx with YAML permissions in Git. Use Claix Cloud when teams need shared workspaces, a visual policy dashboard, Slack approvals, and a central company audit log.
- What happens if Claude Code tries to drop a table or disable Row-Level Security?
- Claix is deny by default. Without an active permission covering that exact statement type, writes and schema changes are denied. Session changes that could turn security off, such as switching role or disabling row-level security from the session, cannot be permitted.
- Can I migrate my local Claix Core YAML configs to Claix Cloud later?
- Yes. Workspace owners can use Import from Core under /dashboard/database-connection to import the database connection, guards/*.yaml, routes/*.yaml, agents/*.yaml, and up to 8 MB (newest 2,000 events) of traces.jsonl into Claix Cloud.
Start open source today, scale to Cloud when the team grows
Run Claix Core (Apache-2.0) on your laptop with Claude Code over MCP, then Import from Core when you need Slack approvals and a company audit log. Same deny-by-default check either way.