LiteScope

io.github.croc100由 GitHub 帳號 croc100 發布v0.9.0更新於 Oct 24, 2026

Operations toolchain for SQLite, Cloudflare D1 & Turso: inspect, diff, migrate, monitor & repair.

發布方自己的服務:Scope (AEC) - Preview

概覽

AI 產生的概覽

LiteScope 讓 AI 助理能檢查、比對、遷移、監控並安全修復 SQLite 檔案、Cloudflare D1 與 Turso 資料庫。

可以做什麼
  • 列出 D1 資料庫,並對 D1 或本機 SQLite 檔案執行有列數上限的 SELECT 查詢
  • 檢查結構、健康狀態、鎖定、快照,並比對兩個來源的結構或資料列數差異
  • 產生遷移 SQL 並分析影響範圍,提供索引與效能建議
  • 開啟寫入後:變更 SQL 與遷移預設先試跑,再套用並自動取得回復權杖
  • 復原寫入、將 D1 回復到某個時間點、下載、建立或刪除 D1 資料庫,以及本機快照與還原
  • 提供提示詞與可訂閱資源,涵蓋結構、資料字典、健康與鎖定診斷
適用情境
適合助理需要處理生產或開發環境 SQLite 資料時使用:上線前審查遷移、診斷鎖定或 WAL 問題、比較本機與線上結構,或執行必須可回復的變更。
執行需求
以 stdio 在本機執行,通常透過 npm 套件的 npx 啟動。Cloudflare D1 來源需要 CLOUDFLARE_API_TOKEN 與 CLOUDFLARE_ACCOUNT_ID;Turso 來源在 DSN 中帶權杖。寫入工具預設關閉,需以 --allow-writes 啟動。存取 D1 與 Turso 需要網路。
安裝前請注意
寫入工具可修改或刪除生產資料,包括不可逆地刪除 D1 資料庫;需 --allow-writes 開啟且預設試跑,但仍應謹慎確認。Cloudflare API 權杖可存取你的 D1 帳戶,應盡量縮小權限範圍。託管儀表板為付費選項,軟體本身免費。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 LiteScope,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

Litescope

Let AI agents touch production SQLite — safely. Diagnose before the write, rewind after it. For Cloudflare D1, Turso, and local files.

Website · Roadmap · Sponsor

[License: AGPL v3] [Go] [Cloudflare D1] [Turso] [Contributors] [Litescope MCP server]

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.

[Litescope reversible-write loop: dry-run blast radius, apply with a rewind token, then one-call undo]

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:

/plugin marketplace add croc100/Litescope/plugin install litescope@litescope

Or just the MCP server, one line (read-only):

bash
claude mcp add litescope -- litescope mcp

With writes + D1 (Litescope still dry-runs every write and captures a rewind point before applying):

bash
claude mcp add litescope \  -e CLOUDFLARE_API_TOKEN=your-token \  -e CLOUDFLARE_ACCOUNT_ID=your-account-id \  -- litescope mcp --allow-writes

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:

json
{  "mcpServers": {    "litescope": {      "command": "litescope",      "args": ["mcp", "--allow-writes"],      "env": {        "CLOUDFLARE_API_TOKEN": "your-token",        "CLOUDFLARE_ACCOUNT_ID": "your-account-id"      }    }  }}

Also listed in the MCP Registry as io.github.croc100/litescope.

Then ask Claude things like:

"List my D1 databases""Show me the schema of the users table in d1://abc-123""Delete every inactive user from d1://prod-db-id"     ← dry-run first: shows the                                                        exact blast radius before                                                        you approve the write"Undo that — put it back the way it was"              ← one-call revert via the                                                        rewind_token from the write"The deploy at 2pm broke something — rewind prod to 1:45pm""Diff my local dev.db against d1://prod-db-id and show me the migration SQL"

Read-only tools (always available)

ToolWhat it does
litescope_d1_listList all D1 databases in the account (UUID, name, DSN)
litescope_queryRun a SELECT on any D1 database or local SQLite file
litescope_schemaInspect tables, columns, indexes
litescope_healthCheck for corruption, WAL bloat, fragmentation
litescope_diffSchema and row-count diff between any two sources
litescope_migrate_planGenerate migration SQL + blast-radius analysis
litescope_migrate_diffGenerate migration SQL only (no blast-radius)
litescope_advisePerformance analysis: missing indexes, full table scans
litescope_checkVerify a backup against a reference database
litescope_fingerprintCluster a fleet by schema fingerprint
litescope_fleet_healthTriage faults across a whole fleet
litescope_locksDiagnose database is locked / SQLITE_BUSY (static + live)
litescope_snapshot_listList 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)

ToolWhat it does
litescope_query_writeMutating 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_undoRevert 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_applyApply a migration — same reversible contract as litescope_query_write
litescope_autopilotSelf-driving optimization (ANALYZE, indexes, VACUUM) — dry-run by default
litescope_snapshotTake a point-in-time backup of a local database
litescope_restoreRestore a local database from a snapshot
litescope_rewindRestore a D1 database to a point in time (Time Travel)
litescope_d1_pullDownload a D1 database to a local SQLite file
litescope_d1_createCreate a new D1 database
litescope_d1_deleteDelete 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.

Prompts & Resources

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 2026-07-28, the stateless revision: server/discover, per-request protocol metadata, resultType, caching hints (ttlMs / cacheScope), and subscriptions/listen streams — alongside tool annotations (read-only / destructive hints), structured output (structuredContent + outputSchema) and argument completion. It is dual-era: a client that still opens with the initialize handshake is served MCP 2025-06-18 unchanged, so older MCP clients keep working.

Interactive views (MCP Apps)

Four tools answer with an interactive panel rendered inside the conversation, via the MCP Apps extension (io.modelcontextprotocol/ui):

ToolView
litescope_locksLock doctor — verdict, each finding's exact PRAGMA/DSN fix, live lock probe
litescope_healthHealth panel — integrity, WAL, fragmentation, snapshot cover
litescope_query_write / litescope_migrate_applyBlast radius — rows affected per statement, schema impact, rewind token
litescope_fleet_healthFleet grid — every database worst-first, with drill-down

The views are single self-contained documents compiled into the binary. They load nothing from the network, so the host's strictest CSP applies and a database's contents cannot leave the iframe. They never write, either: a button that would apply or undo a write hands the request back to the conversation, because a click inside an embedded panel is not the user approving a production write. A host without the extension gets the same results as text.

Remote / hosted (Streamable HTTP)

By default litescope mcp speaks stdio. For a hosted, remote, or multi-client setup, serve over the Streamable HTTP transport instead:

bash
litescope mcp --http :7577 --http-token "$LITESCOPE_MCP_TOKEN"

POST a JSON-RPC message to the endpoint (/mcp by default). Modern clients are served statelessly — no session — with each request carrying its own protocol metadata and the standard MCP-Protocol-Version / Mcp-Method / Mcp-Name headers, and change notifications arriving on a subscriptions/listen response stream. Handshake-era clients still get a session via the Mcp-Session-Id header and a GET SSE stream.

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.


D1 — CLI operations

Rewind — D1 Time Travel

bash
# Restore to a previous point in timelitescope rewind d1://DB_ID --to "2h ago"litescope rewind d1://DB_ID --to "yesterday"litescope rewind d1://DB_ID --to "2024-01-15T10:30:00Z"
# List available restore points (30-day window + migration timestamps)litescope rewind list d1://DB_ID

Pull / Push — sync between D1 and local SQLite

bash
# Download D1 → local (for inspection, backup, or diffing)litescope d1 pull d1://DB_ID ./snapshot.db
# Upload local → D1 (seed a fresh database or restore from snapshot)litescope d1 push ./seed.db d1://DB_IDlitescope d1 push ./seed.db d1://DB_ID --drop-existing

Migrate — schema changes on D1

bash
# Diff local dev schema against live D1 — generate migration SQLlitescope migrate local.db d1://DB_ID
# Apply a migration directly to D1litescope migrate apply d1://DB_ID migration.sql

Bisect — find which commit broke a D1 database

Binary-search D1 Time Travel to pinpoint the exact snapshot where a query started returning wrong results:

bash
litescope bisect d1://DB_ID \  --good "3d ago" \  --bad now \  --check "SELECT COUNT(*) FROM orders WHERE status = 'paid'" \  --expect "gt:0"

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.


Local SQLite

doctor — one-shot checkup

bash
litescope doctor app.dblitescope doctor app.db --deep            # exhaustive integrity_checklitescope doctor app.db --format html -o report.html

Combines 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 backups

bash
litescope snapshot app.db                     # consistent VACUUM INTO copylitescope snapshot app.db --label before-migrationlitescope snapshot app.db --keep 7            # retain only the 7 newestlitescope snapshot list app.dblitescope restore app.db                      # restore the newest snapshotlitescope restore app.db --from <snapshot.db>

Snapshots 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 optimization

bash
litescope autopilot app.db                    # dry-run: show the planlitescope autopilot app.db --apply            # apply the safe actionslitescope autopilot app.db --apply --aggressivelitescope autopilot --fleet litescope.fleet.yaml --apply

Runs 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"

bash
litescope locks app.db                        # static config diagnosislitescope locks app.db --live                 # is a writer holding the lock now?litescope locks app.db --watch                # stream lock-state changeslitescope locks app.db --timeline             # recorded contention historylitescope locks app.db --timeline --since 24h

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 diff

bash
litescope diff old.db new.dblitescope diff old.db new.db --format jsonlitescope diff local.db d1://DB_ID        # local vs live D1litescope diff local.db turso://TOKEN@ORG/prod

migrate — generate and apply migrations

bash
litescope migrate before.db after.db --output migration.sqllitescope migrate apply prod.db migration.sql --dry-runlitescope migrate apply prod.db migration.sql --verify after.db

migrate apply safety sequence: pre-flight integrity check → VACUUM INTO backup → single transaction → FK verification → auto-rollback on failure.

lint — schema anti-patterns

bash
litescope lint app.dblitescope lint app.db --strict   # exit 1 on info findings too

Rules: no-primary-key, untyped-column, not-strict, autoincrement-overhead, non-integer-pk.

schema — inspect schema + ERD

bash
litescope schema app.dblitescope schema app.db --erd    # Mermaid ER diagram

dump — portable SQL export

bash
litescope dump app.db -o backup.sqllitescope dump app.db --schema-onlylitescope dump app.db --table users

import / export — spreadsheets and SQLite

bash
litescope import sales.csv              # → sales.db, table "sales"litescope import budget.xlsx            # first sheet → budget.dblitescope export shop.db --table orders -o orders.xlsxlitescope export shop.db --query "SELECT city, COUNT(*) FROM users GROUP BY city"

Formats: CSV, TSV, JSON, Excel (.xlsx). No external dependencies.

monitor — schema drift detection

bash
litescope monitor snapshot prod.db --output baseline.jsonlitescope monitor check prod.db --baseline baseline.json     # exits 1 on driftlitescope monitor watch prod.db --baseline baseline.json --interval 1h --webhook https://hooks.slack.com/...

serve — local web dashboard

bash
litescope serve                   # opens http://127.0.0.1:7575litescope serve --config litescope.fleet.yaml

Fleet 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.


Fleet

Manage hundreds of databases at once. Built for multi-tenant apps on Turso and D1.

bash
# Discover all databaseslitescope fleet discover turso --org my-org --token $TURSO_API_TOKENlitescope fleet discover d1 --account $CF_ACCOUNT_ID --token $CF_API_TOKEN
# Triage the whole fleetlitescope fleet healthlitescope fleet locks         # roll up "database is locked" contention, worst-firstlitescope fleet fingerprint   # cluster by schema — find drift before it bites
# Stage a migration across the fleetlitescope fleet migrate migration.sql --dry-runlitescope fleet migrate migration.sql --canary 5litescope fleet migrate migration.sql

CI — GitHub Action

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.

yaml
- uses: croc100/Litescope@v1  with:    args: "lint app.db --strict"    comment: "true"          # post the result as a sticky PR comment

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.

InputDefaultDescription
args—Litescope command to run (required)
versionlatestRelease tag to install, or latest
commentfalsePost output as a sticky PR comment
working-directory.Directory to run in

Install

Homebrew

bash
brew install croc100/tap/litescope

npm / npx — for JS and wrangler users, no separate install:

bash
npx litescope doctor app.dbnpm install -g litescope

Go install

bash
go install github.com/croc100/litescope/cmd/litescope@latest

Binary download

macOS, Linux, Windows — Releases.


Remote sources

DSNProvider
./app.db or /path/to/file.dbLocal SQLite file
d1://DB_UUIDCloudflare D1 (env: CLOUDFLARE_API_TOKEN + CLOUDFLARE_ACCOUNT_ID)
d1://TOKEN@ACCOUNT_ID/DB_UUIDCloudflare D1 (explicit credentials)
turso://TOKEN@ORG/DBNAMETurso

Pricing — what's free

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.


License

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 [email protected].

來源:README.md,提交 db812d2

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

2
  1. v0.9.0最新Sep 26, 2026
  2. v0.8.0Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

其他 Scope 整合