SafeBase stops your database from getting accidentally destroyed.
It sits between your app and your database. You change one line — your connection string — and every dangerous query gets caught before it runs.
curl -fsSL https://raw.githubusercontent.com/ThiruvarankanM/SafeBase/main/install.sh | shThis will:
- Download the right binary for your OS and architecture
- Install
safebase-proxyandsafebase-mcpto/usr/local/bin - Create a default
safebase.ymlin your current directory - Auto-configure Claude Desktop as an MCP server (if installed on macOS)
- Print the config snippet for Cursor
Every day, databases get wiped by accident.
- A developer runs
DELETE FROM userswithout a WHERE clause - An AI agent (Claude, Cursor, Copilot) executes
DROP TABLEwithout understanding what it does - Someone runs a migration on production thinking it's dev
There's no undo button. The data is gone.
Before: Your App → Database
After: Your App → SafeBase → Database
SafeBase reads every query before it reaches your database. Depending on how dangerous it is:
| Risk | Example | What happens |
|---|---|---|
| Low | SELECT *, INSERT |
Passes through instantly |
| Medium | DELETE WHERE id = 5 |
Slack alert, 60 seconds to cancel |
| Critical | DROP TABLE, DELETE without WHERE |
Blocked — needs a human to approve |
| AI Agent | Any write | Always needs human approval |
Change one line in your app:
# Before
DATABASE_URL=postgresql://user:pass@your-db:5432/mydb
# After (just change the host + port)
DATABASE_URL=postgresql://user:pass@localhost:5433/mydbStart SafeBase:
docker compose up -dYour app works exactly the same. SafeBase is invisible until something dangerous runs.
After running the install script, SafeBase is already added to Claude Desktop automatically.
For Cursor, add this to .cursor/mcp.json in your project:
{
"mcpServers": {
"safebase": {
"command": "/usr/local/bin/safebase-mcp",
"args": ["--config", "/path/to/safebase.yml"]
}
}
}Once connected, every database query from Claude or Cursor routes through SafeBase. AI tools get read-only access by default. Destructive operations are blocked automatically.
The AI tools will see these SafeBase tools:
safebase_query— run a SQL query through safety checkssafebase_classify— preview the risk level before runningsafebase_pending— list queries waiting for approvalsafebase_approve/safebase_cancel— approve or reject
- Approval dashboard —
http://localhost:3000to approve/cancel queries in one click - Slack alerts — notified before anything dangerous runs, with approve/cancel buttons
- Audit log — every write logged forever, tamper-proof
- Shadow execution — run query on a copy first, see exact row impact before touching real data
- AI agent protection — Claude, Cursor, Copilot blocked from destructive operations
- MCP server — native integration with all MCP-compatible AI tools
- Metrics —
http://localhost:9090/metrics(Prometheus-compatible) - TLS — encrypted proxy connections supported
| Role | What they can do |
|---|---|
dba |
Approve anything, full access |
developer |
Read + safe writes |
ai_agent |
Read-only — all writes need approval |
auditor |
View audit logs only |
Edit safebase.yml:
database:
host: your-real-database-host
postgres_port: 5432
notifications:
slack:
enabled: true
webhook_url: https://hooks.slack.com/your-webhook
environment: production# Start everything (proxy + dashboard + Redis)
docker compose up -d
# Proxy: localhost:5433 (PostgreSQL), localhost:3307 (MySQL)
# Dashboard: http://localhost:3000
# Metrics: http://localhost:9090/metricscmd/proxy/ → proxy server
cmd/mcp/ → MCP server (for Claude/Cursor)
internal/
config/ → reads safebase.yml
parser/ → SQL risk classification
proxy/ → PostgreSQL + MySQL wire protocol handlers
approval/ → Redis queue + Slack notifications
audit/ → immutable audit log
auth/ → JWT-based RBAC
shadow/ → dry-run execution on shadow DB
metrics/ → Prometheus metrics + /health
mcp/ → MCP JSON-RPC protocol server
dashboard/ → Next.js approval UI