The AI Firewall for Production PostgreSQL.
Safely query, diagnose, and optimize your database with AI. QueryCraft intercepts expensive sequential scans, auto-heals SQLSTATE errors, and grounds LLMs strictly in your live schema.
🚨 Unconstrained Cartesian Join: Table line_items joined without foreign key predicate (1.2M rows × 450k orders).
⚠️ Sequential Scan: Filter on unindexed column line_items.status.
// 1. Recommended Index DDL:
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_line_items_status ON line_items(status);
// 2. Auto-Healed Query (Remediated Cost: 2.42 · -99.98%):
SELECT * FROM orders o JOIN line_items l ON o.id = l.order_id WHERE l.status = 'pending' LIMIT 50;
How QueryCraft Protects Your Production Database
Every query is schema-grounded, ambiguity-checked, pre-flight cost analyzed, and self-healed before execution.
Stage 01: Live Schema Grounding
QueryCraft introspects your database's live tables, column types (UUID, JSONB, NUMERIC), and PK/FK foreign key graphs. Prompts are grounded strictly on verified catalog entities so the model never guesses or invents tables.
"calculate total revenue by customer country"
Why Generic AI Fails on Production Databases
Generic AI coding assistants guess schemas, write unconstrained queries that trigger massive cloud compute spikes, and fail silently on PostgreSQL syntax errors.
Blind Guessing & Runaway Infrastructure Spikes
LLMs without database guardrails hallucinate nonexistent tables, execute unconstrained joins that lock multi-million row production databases, and risk accidental data mutation.
- ✕Schema & Typo Hallucinations: Invents column names (
cust_idvscustomer_id) triggering SQLSTATE42703. - ✕Runaway Cloud Bills: Triggers full sequential scans and memory-intensive cross-joins across multi-million row tables.
- ✕Silent Cryptic Errors: Fails on missing
GROUP BYclauses (42803) and incorrect type castings (22P02). - ✕Accidental Mutations: Can inadvertently emit mutating DML/DDL (
DELETE,DROP,UPDATE).
Pre-Flight Safety, EXPLAIN Guard & Self-Healing
QueryCraft acts as a defensive proxy. It enforces SET TRANSACTION READ ONLY, dry-runs EXPLAIN costs, and auto-corrects errors before execution.
- ✓Zero-Hallucination Grounding: Introspects live PostgreSQL tables, UUIDs, JSONB, and foreign keys directly into the prompt.
- ✓Pre-Flight Cost Guard: Dry-runs AST plans with a 3-tier risk engine (
[LOW],[MED],[HIGH]). - ✓SQL Doctor Critic Loop: Automatically catches and heals syntax and grouping errors with up to 3 self-healing retries.
- ✓Strict Read-Only & LIMIT 50: Enforces 8000ms statement timeouts and guaranteed mutation prevention.
Architected for Zero Hallucinations & Infrastructure Safety
Five tightly coupled subsystems engineered to make AI queries as predictable and safe as a compiled binary.
Pre-Flight Cost Guard
Never spike your AWS RDS bill again. QueryCraft dry-runs EXPLAIN (FORMAT JSON), estimates compute costs, and blocks runaway sequential scans with a 3-Tier Risk Engine (LOW/MED/HIGH).
Cost: 14,289.4
[HIGH RISK · Seq Scan]Cost: 2.42
[LOW RISK · Index Scan]SQL Doctor (Critic Loop)
Stop debugging cryptic errors. The SQL Doctor catches 42703 (missing columns) and 22P02 (type errors), diagnosing and self-healing the query up to 3 times automatically.
Universal MCP Server
Bring QueryCraft to your IDE. Exposes 6 native tools to Cursor and Claude Desktop over stdio so your agent can safely query your database without leaving the editor.
Zero-Hallucination Schema Grounding
Stop the guessing game. QueryCraft introspects your live PostgreSQL schema—tables, UUIDs, JSONB, and Foreign Keys—to ensure the AI only writes valid SQL.
├─ customer_id (UUID, FK -> customers.id)
├─ metadata (JSONB)
└─ created_at (TIMESTAMPTZ)
Interactive Clarification
No more blind assumptions. If a query is ambiguous, QueryCraft pauses and asks targeted questions using 1-tap interactive response chips.
How QueryCraft Protects Your Production Database
From natural language query to safe, read-only results in under 500 milliseconds.
Connect Your Database
Securely link your Supabase, Neon, or RDS instance. (Credentials are stateless and never saved).
Ask or Let Your IDE Write
Type a natural language prompt in the Web Studio or use Cursor via the MCP server.
The Firewall Inspects
QueryCraft maps the schema, checks the EXPLAIN cost, and flags missing indexes.
Execute Safely
The query runs under an 8000ms timeout limit with a strict LIMIT 50 clamp, returning clean Markdown or a CSV export.
Start querying safely today.
Join engineers protecting their production PostgreSQL databases from runaway AI queries and cryptic syntax errors.