Skip to main content
Glama

dbwatch

ci npm JSR JSR Score Runtime license

One line: npx @kanchingyg/dbwatch sqlite:./app.db -- npm test (or bunx @kanchingyg/dbwatch sqlite:./app.db -- bun test): git-style SQLite/D1 row diff around any command with instant --revert.

Install

Bun / npm:

bunx @kanchingyg/dbwatch sqlite:./local.db -- npm test
npx @kanchingyg/dbwatch sqlite:./local.db -- npm test

# or install in your project / globally
bun add -d @kanchingyg/dbwatch
npm i -D @kanchingyg/dbwatch

JSR:

bunx jsr add @kanchingyg/dbwatch
npx jsr add @kanchingyg/dbwatch

Related MCP server: Drizzle Sentinel MCP

Quick start

npx @kanchingyg/dbwatch sqlite:./local.db -- npm test
bunx @kanchingyg/dbwatch sqlite:./local.db -- bun test
npx @kanchingyg/dbwatch sqlite:./local.db --revert --allow-write -- npm test
npx @kanchingyg/dbwatch --mcp

Local models

npx @kanchingyg/dbwatch sqlite:./app.db --explain --model ollama/qwen2.5-coder:7b

Point baseUrl in MCP explain_side_effects to LM Studio or vLLM (http://127.0.0.1:1234).

Supported DSNs

  • sqlite:./path/to.db or file:./path/to.db

  • d1:./local-d1.sqlite (local Cloudflare D1 SQLite file)

  • Postgres DSN parsing is reserved; use SQLite/D1 for zero-config local diffs today.

MCP Tools Reference

Tool

Mutates

Description

run_with_db_diff

true

Snapshot SQLite/D1 tables, execute a child command, and return exit status plus row-level INSERT/UPDATE/DELETE diffs (requires --allow-write).

revert_last_diff

true

Execute inverse SQL statements from the most recent captured diff to restore prior table state (requires --allow-write).

explain_side_effects

false

Summarize captured row mutations in two lines via a local Ollama or OpenAI-compatible model.

Editor and Agent Integration

Cursor (.cursor/mcp.json)

{
  "mcpServers": {
    "dbwatch": {
      "command": "npx",
      "args": ["-y", "@kanchingyg/dbwatch", "--mcp"]
    }
  }
}

Claude Code CLI

claude mcp add dbwatch -- npx -y @kanchingyg/dbwatch --mcp

Programmatic Usage (JSR / TypeScript)

import * as bridge from "jsr:@kanchingyg/dbwatch/bridge";

Runtime Safety and Guardrails

  • Stdio frame isolation: --mcp keeps JSON-RPC on stdout clean.

  • Read-only default: run_with_db_diff / revert_last_diff need --allow-write; --dry-run simulates.

  • Loop breaker: Identical MCP tool calls halt after three repeats.

  • Revert SQL: Inverse statements use quoted identifiers and escaped literals (SQLite/D1 local files only today).

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Operations toolchain for SQLite, Cloudflare D1, and Turso. Every command is available as both a CLI and an MCP tool: inspect, diff, migrate, monitor, back up, and repair databases. 22 stdio tools, read-only by default.
      14
      1
      AGPL 3.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables database governance for Drizzle ORM projects by inspecting schemas, linting migrations for unsafe operations, detecting schema drift, and explaining query plans with performance checks.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Captures checkpoints of project files and SQLite tables before an AI agent makes risky changes, then reports differences and rolls them back byte-for-byte, including dropped tables and agent-created junk. Enables agents to snapshot, diff, list, and restore working state with explicit confirmation required before any destructive action.
      14 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables local AI agents to work with SQL workspaces and databases by inspecting schemas, running bounded queries, and managing recoverable imports, previews, applies, diffs, and undos over stdio.
      1
      MIT