Authenticate, introspect schemas, run natural language queries with Llama 3.1 70B, and hook directly into Claude Desktop, Cursor IDE, Antigravity, and ChatGPT.
Chapter 1
Overview & Architecture
The QueryCraft CLI (`querycraft`) bridges your local development environment directly to your live database clusters and AI coding agents via the Model Context Protocol (MCP).
🧠 Zero-Hallucination
Grounds prompts strictly in live introspected database schemas and types.
🛡️ Pre-Flight Cost Guard
Dry-runs PostgreSQL EXPLAIN to detect expensive scans before execution.
🔒 Tenant-Isolated
OAuth tokens stored locally in `~/.querycraft/auth.json` with 600 permissions.
Installation Options
Universal Shell Installer (bash)
# Downloads, builds, and symlinks /usr/local/bin/querycraft
Run querycraft auth login to link your QueryCraft account in 1 tap.
02
Connect your Database (or use sandbox)
Run querycraft connect postgresql://user:pass@host/db to link your live database.
03
Ask Questions in Plain English
Run querycraft ask "show active users" to get instant SQL + table data.
Chapter 2
1-Click Universal AI Setup (querycraft setup)
Automatically detects installed AI tools on your system (Claude Desktop, Cursor IDE, Antigravity, Windsurf) and configures their Model Context Protocol (MCP) configuration in 1 millisecond.
Run 1-Click AI Configuration (zsh)
$querycraft setup
🔍 Detecting installed AI assistants & IDEs...
✓ Claude Desktop: Configured (~/Library/Application Support/Claude/claude_desktop_config.json)
Restart your editor or Claude to start querying databases naturally.
Manual MCP Configuration Reference
If you prefer manual configuration, add this to your MCP configuration file:
claude_desktop_config.json / mcp.json (json)
{
"mcpServers": {
"querycraft": {
"command": "querycraft",
"args": ["ai", "mcp-stdio"],
"env": {
"QUERYCRAFT_BACKEND_URL": "http://localhost:8000"
}
}
}
}
Chapter 3
Query & Inspection Commands
querycraft ask "<prompt>"
Translates any natural language question to SQL using Llama 3.1 70B, evaluates safety with Pre-Flight Cost Guard, executes against your database workspace, and prints an aligned ASCII table.
Natural Language Query (zsh)
$querycraft ask "show all active users"
🧠 QueryCraft AI [Workspace: Production | User: nitindeep65@gmail.com]
Question: show all active users
Thinking, grounding schema, evaluating safety...
Generated SQL Query:
SELECT * FROM users WHERE is_active = TRUE LIMIT 50;
GitHub-style (gh auth login) browser OAuth authentication. Spawns a local listener on port 9876, handles the token exchange, and stores credentials in ~/.querycraft/auth.json with 600 file permissions.
Browser OAuth Login (zsh)
$querycraft auth login
🔑 Opening browser for authentication...
Waiting for authentication on http://localhost:9876/callback...
✅ Logged in as: nitindeep65@gmail.com
Session token saved to ~/.querycraft/auth.json (valid for 30 days)
querycraft auth whoami
Verifies current authenticated session token, user email, and backend status:
Check Identity (zsh)
$querycraft auth whoami
✅ Logged in as: nitindeep65@gmail.com
Session created: 2026-08-31 | Expires: 2026-09-30
Backend: http://localhost:8000
querycraft auth logout
Clears and deletes stored session tokens from ~/.querycraft/auth.json:
Logout (zsh)
$querycraft auth logout
👋 Logged out successfully. Stored credentials removed.