The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the Litescope listing page.
Let AI agents touch production SQLite — safely. Diagnose before the write, rewind after it. For Cloudflare D1, Turso, and local files.
Ask Claude to change your D1 database — and undo it if it's wrong. Every write is dry-run by default with the exact blast radius, and one call away from revert.
Free and open source (AGPL-3.0) — every command, every fleet operation, self-hostable, no license key. The only paid thing is the hosted dashboard we run for you.
"It's just a file — what's there to operate?"
That was true when SQLite was a local dev toy. It isn't anymore. D1, Turso, LiteFS, and Litestream put SQLite in production at fleet scale — thousands of databases, one per tenant. But the tooling never caught up:
sqlite3 assumes one database. Production assumes thousands. There's no
pg_stat, no APM, no standard way to see from the outside why a database is
locked, why WAL is bloating, or which tenant went silent.Postgres has a mature tool for every problem. SQLite has none — so Litescope is one binary for the whole job: fleet observability, file-level superpowers (bisect / rewind / salvage), lock & WAL diagnostics, and a safe interface for agents. Things a generic DB client structurally can't do.
Claude Code — one line (read-only):
With writes + D1 (Litescope still dry-runs every write and captures a rewind point before applying):
Cursor — one-click:
➕ Add litescope to Cursor
(installs read-only; add --allow-writes and the Cloudflare env vars in
mcp.json to enable writes).
Claude Desktop / Windsurf / any MCP client — add to the config file directly:
Also listed in the MCP Registry
as io.github.croc100/litescope.
Then ask Claude things like:
| Tool | What it does |
|---|---|
litescope_d1_list | List all D1 databases in the account (UUID, name, DSN) |
litescope_query | Run a SELECT on any D1 database or local SQLite file |
litescope_schema | Inspect tables, columns, indexes |
litescope_health | Check for corruption, WAL bloat, fragmentation |
litescope_diff | Schema and row-count diff between any two sources |
litescope_migrate_plan | Generate migration SQL + blast-radius analysis |
litescope_migrate_diff | Generate migration SQL only (no blast-radius) |
litescope_advise | Performance analysis: missing indexes, full table scans |
litescope_check | Verify a backup against a reference database |
litescope_fingerprint | Cluster a fleet by schema fingerprint |
litescope_fleet_health | Triage faults across a whole fleet |
litescope_locks | Diagnose database is locked / SQLITE_BUSY (static + live) |
litescope_snapshot_list | List point-in-time snapshots for a local database |
litescope_query enforces token budgeting — max_rows cap + columns
projection + truncation reporting — so a large table never blows the agent's
context window.
--allow-writes)| Tool | What it does |
|---|---|
litescope_query_write | Mutating SQL — dry-run by default with exact rows affected and blast-radius diff (D1 dry-runs measured on a pulled copy); on apply, captures an undo point first (local: snapshot, D1: Time Travel bookmark) and returns it as a rewind_token |
litescope_write_undo | Revert a write in one call using its rewind_token — local files and D1 alike; tokens are bound to the database they were minted for |
litescope_migrate_apply | Apply a migration — same reversible contract as litescope_query_write |
litescope_autopilot | Self-driving optimization (ANALYZE, indexes, VACUUM) — dry-run by default |
litescope_snapshot | Take a point-in-time backup of a local database |
litescope_restore | Restore a local database from a snapshot |
litescope_rewind | Restore a D1 database to a point in time (Time Travel) |
litescope_d1_pull | Download a D1 database to a local SQLite file |
litescope_d1_create | Create a new D1 database |
litescope_d1_delete | Delete a D1 database (irreversible) |
Write tools are off unless you start the server with --allow-writes, every
write is dry-run by default, and no write commits without an auto-captured undo
point. See the security model for the full boundary — what each
layer protects against, and what it doesn't.
Beyond tools, the MCP server exposes prompts — canned workflows like
diagnose_locked_database, review_migration, safe_optimize, and
health_checkup that chain the tools above into a safe plan — and
resources: a database's schema, data dictionary, live health, and live lock
diagnosis — readable by the agent without spending a tool call, and
subscribable for push updates whenever the underlying file changes. Bind one
with litescope mcp ./app.db, or address any source via
litescope://schema/{source}, litescope://dictionary/{source},
litescope://health/{source}, and litescope://locks/{source}.
The server implements MCP 2025-06-18: tool annotations (read-only /
destructive hints), structured output (structuredContent + outputSchema),
argument completion, resource-change subscriptions, and server logging.
By default litescope mcp speaks stdio. For a hosted, remote, or multi-client
setup, serve over the Streamable HTTP transport instead:
POST a JSON-RPC message to the endpoint (/mcp by default), or open a GET SSE
stream for server notifications; each client gets its own session via the
Mcp-Session-Id header.
Before exposing it publicly, lock it down: --http-token (or the
LITESCOPE_MCP_TOKEN env var) requires Authorization: Bearer <token> on every
request, and --http-origin allowlists browser Origins (localhost is always
allowed) for DNS-rebinding protection. Without a token the endpoint is open and
the server prints a warning.
Binary-search D1 Time Travel to pinpoint the exact snapshot where a query started returning wrong results:
Checks gt:0 (greater-than), lt:N, eq:N, or a literal value. Narrows
to the snapshot window where the condition first failed, then lets you
inspect or rewind.
doctor — one-shot checkupCombines integrity check, WAL/fragmentation health, index advisor, and schema lint in one command. Exits 1 when attention is needed — use it as a CI quality gate.
snapshot / restore — point-in-time backupsSnapshots live in a sibling .litescope-snapshots/ directory. Restore is
integrity-checked and takes a pre-restore safety snapshot first — the same
"did you back up?" safety net that D1 gets from Time Travel, for local and Turso.
autopilot — self-driving optimizationRuns ANALYZE + PRAGMA optimize, adds missing foreign-key indexes, and
(with --aggressive) VACUUMs and drops redundant indexes — each explained in
plain language. Dry-run by default; every real change is preceded by an
automatic snapshot.
locks — diagnose "database is locked"Inspects journal mode, busy_timeout, locking mode, and WAL bloat, and
prescribes the exact PRAGMA/DSN fix. --live identifies the process holding
the lock right now. --watch records every observation to a local history
store; --timeline then aggregates it into a per-database contention view —
when the database was jammed, for how long, which processes held it, wait-time
percentiles, and whether the WAL checkpoint kept up.
diff — schema and data diffmigrate — generate and apply migrationsmigrate apply safety sequence: pre-flight integrity check → VACUUM INTO backup → single transaction → FK verification → auto-rollback on failure.
lint — schema anti-patternsRules: no-primary-key, untyped-column, not-strict, autoincrement-overhead, non-integer-pk.
schema — inspect schema + ERDdump — portable SQL exportimport / export — spreadsheets and SQLiteFormats: CSV, TSV, JSON, Excel (.xlsx). No external dependencies.
monitor — schema drift detectionserve — local web dashboardFleet topology map, health triage, schema fingerprinting, interactive ERD, a paginated data browser with a visual query builder, drag-drop import, and a visual diff panel — pick any two databases to review schema and row-count changes before applying. Entirely local, no account required.
Manage hundreds of databases at once. Built for multi-tenant apps on Turso and D1.
Run Litescope on every pull request — lint the schema, diff against the base branch, and comment the blast radius so a risky migration can't merge unreviewed.
args is any Litescope command; the job exits non-zero when Litescope flags
something, failing the check. See
examples/github-actions/migration-ci.yml
for a full lint + diff workflow.
| Input | Default | Description |
|---|---|---|
args | — | Litescope command to run (required) |
version | latest | Release tag to install, or latest |
comment | false | Post output as a sticky PR comment |
working-directory | . | Directory to run in |
Homebrew
npm / npx — for JS and wrangler users, no separate install:
Go install
Binary download
macOS, Linux, Windows — Releases.
| DSN | Provider |
|---|---|
./app.db or /path/to/file.db | Local SQLite file |
d1://DB_UUID | Cloudflare D1 (env: CLOUDFLARE_API_TOKEN + CLOUDFLARE_ACCOUNT_ID) |
d1://TOKEN@ACCOUNT_ID/DB_UUID | Cloudflare D1 (explicit credentials) |
turso://TOKEN@ORG/DBNAME | Turso |
The tool is free. We only charge to run the dashboard for you.
| Free (OSS, AGPL-3.0) | Cloud (paid) | |
|---|---|---|
| Every CLI command, MCP server, fleet ops | ✅ | ✅ |
litescope serve — local web dashboard | ✅ | ✅ |
| Self-hosted dashboard on your own infra | ✅ | ✅ |
| Hosted dashboard we run & maintain | — | ✅ |
| Managed metadata ingestion, retention, alerting | — | ✅ |
| Org auth, teams, SSO | — | ✅ |
| Support SLA | — | ✅ |
The line is simple: the software and every feature is free and self-hostable forever. You pay only if you want us to host and operate the dashboard so you don't have to. No feature is locked behind a license key.
See litescope-site.pages.dev/pricing for the hosted plans.
Litescope is AGPL-3.0. Free to use, modify, and self-host. If you offer it as a network service the AGPL requires you to share your modifications. A commercial license (AGPL exception + support SLA) is available for organizations — see COMMERCIAL.md or email dl_litescope@crode.net.