Gulliver is a SQL "rehearsal" tool for AI agents, offered as both an MCP server and a CLI. Its core idea is: first trial-run a query on tiny data, confirm the cost and behavior, and then decide whether to execute it on full-scale data. The project name comes from the Lilliput and Brobdingnag in Gulliver's Travels, symbolizing trying the query first in "Lilliput" before entering "Brobdingnag".
Purpose AI agents often write SQL that works on small tables but fails or is prohibitively expensive on large tables—for example, not knowing a table has 5 billion rows, joins that multiply row counts, or missing partition filters that scan years of data. Gulliver sits between the agent and the data warehouse, providing status and next_step for each query so the model knows what to do next.
Key capabilities
- Cost pre-check: estimate query cost and label the estimate's confidence as exact, upper_bound, or heuristic.
- Scale lint and auto-fix: gulliver_fix can rewrite SQL and annotate each change; it claims same (identical result rows) only when column types have been checked, while other changes require mode=all and a description of possible differences; --verify tests the rewrite on generated boundary data and provides counterexamples.
- Staged rehearsal: measure runtime, output row count, and bytes on 1%→3%→10% data, use log-log fitting to predict performance at 100%, and give high/medium/low confidence with ranges.
- Budgeted execution: block when per-query, per-day, per-session, per-agent, byte, or runtime limits are exceeded; amounts above the approval threshold require manual execution of gulliver approve <receipt_id>.
- Safety gate: by default only SELECT and WITH ... SELECT are allowed; it rejects write operations, multiple statements, unparseable SQL, as well as functions with side effects, SQL hidden in strings, and file or URL access (GS001-GS004). DuckDB is sandboxed at the engine layer, restricting directories and disabling external access and extension autoloading.
- Result protection: run results are marked untrusted, secrets are masked, personal data is flagged, and instruction-like text is listed in data_warnings.
- Runaway protection: limit loops and per-agent budgets.
- Data quality checks: define once in gulliver.toml, use gulliver check --all runs in CI; gulliver lint --baseline lets existing repositories see only new issues.
- Other commands: gulliver prune, gulliver calibration, gulliver receipt --list, column-level gulliver diff, gulliver top, gulliver review (including GitHub Action), gulliver selftest security (151 bypass test cases).
- Local state: receipts, spend ledger, and approvals are stored as JSON in ./.gulliver/, auditable via hash chain, with no telemetry.
Usage Install the MCP server: can be run via uv or npx, published on PyPI and npm. Point to the database with --dsn, or to gulliver.toml with --config. If you have no repository, you can run gulliver demo to use gulliver_demo.duckdb. It can also be installed as a plugin, bundled with the MCP server and rehearsal workflow skills. Client configuration: for Claude Desktop, Cursor, and Windsurf, add an mcpServers block to their respective MCP configuration files; for VS Code use .vscode/mcp.json; for Codex use ~/.codex/config.toml; for Gemini CLI use ~/.gemini/settings.json. HTTP clients can run gulliver-mcp --http --port 8765, and the service http://127.0.0.1:8765/mcp。 When not using MCP, each tool is also a CLI command with --json; gulliver tools --format openai or --format gemini outputs function-call definitions. Context control: the 16 tool schemas take up about 25.6 KB; --toolset core loads only the 8 query tools (about 10.9 KB), --toolset pipeline loads the pipeline tools, and you can also mix them with commas. The server also provides resources, prompts, rehearsal progress, and an outputSchema for each tool. Approval: after setting [approval] channel = "elicitation" in gulliver.toml, gulliver_run will show a form to a human in the MCP client (statement, cost, SQL); it is off by default and agents cannot fill it in. Driver installation: pip install "gulliver-mcp[bigquery]", [snowflake], [postgres], or [all]. Configuration: copy gulliver.example.toml to gulliver.toml, which contains the read-only gate (allowed_paths, allow_remote, allow_functions), result protection (policy), runaway protection, [lint], [review], [approval], and other settings. Unknown top-level keys or sections are rejected, preventing typos from silently falling back to the default budget. Credentials are not written into the configuration; use each engine's own environment variables and credential chains (Google ADC, SNOWFLAKE_PASSWORD, PGPASSWORD, etc.), and agents only see the connection name. Exit codes: 0 normal, 1 error, 2 blocked, 3 rehearsal or approval required, 4 data check failed; usable in CI.
Use cases
- Agents generate and execute analytical SQL on DuckDB, Postgres, BigQuery, and Snowflake.
- Check SQL cost, scale risk, and data quality in CI or pull requests.
- Teams that need a read-only safety gate, budget control, and auditable receipts.
- Teaching or demos: use the demo database to walk through the inspect → preflight → lint → fix → rehearse → run → receipt flow.
Limitations
- Does not run data pipelines, does not replace dbt, and does not provide a hosted service.
- No Databricks or ClickHouse engine yet; BigQuery and Snowflake have only been tested against simulated environments.
- For Postgres, BigQuery, and Snowflake, the parser is the only check; using a read-only role as well is recommended.
- Since 0.3.0, DuckDB by default cannot read files outside the database directory and the current directory, remote URLs, or auto-load extensions; these must be allowed in allowed_paths or allow_remote.
- Predictions have confidence levels and ranges; block sampling may be biased on aggregated data, and you can adjust it with --method.
- Local engines have no cost data.
- Compared with some similar tools, it lacks index tuning, health checks, style checks for more dialects, real build diff comparison, and lineage tracking, and the tool schemas are also relatively large.