Litescope
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
**Let AI agents touch production SQLite — safely.** Diagnose before the write, rewind after it. For Cloudflare D1, Turso, and local files.
Website · Roadmap · Sponsor
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.
---
Why a tool for SQLite?
"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.
- **Embedded means unobservable.** The very thing that makes SQLite great — no
server — is what leaves you blind in production.
- **Agents now write to your data.** No SQLite tool was built assuming an AI
would run the migration. Litescope was.
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.
---
MCP — Give Claude direct access to your D1
**Claude Code** — install the plugin, which brings the MCP server plus five
skills (lock doctor, safe writes, migration review, fleet sweep, corruption
recovery) that teach the agent how to use it when something is wrong:
Or just the MCP server, 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:
Read-only tools (always available)
| 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.
Write tools (--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 |