lockgate
Provides a [slack](/mcp/integrations/slack)_post_message tool for posting messages as a compensatable mutation, pairing the forward call with a deterministic inverse action and idempotency key so agent-initiated posts can be unwound exactly once during rollback.
Provides a [stripe](/mcp/integrations/stripe)_create_invoice tool that creates invoices as a compensatable mutation: each forward call is paired with a deterministic inverse action and a unique idempotency key, so an agent run can be rewound safely (inverses execute at most once across repeated rewinds) and transient 503 failures recover cleanly on retry.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Lockgate
Deterministic rollback engine and staged outbox chamber for autonomous AI agents.
Live demo: lockgate.pages.dev (runs the exact LockgateCoreEngine, SQLite schema, SHA-256 CAS checks, and invariant verifier in an isolated per-tab SQLite 3 WebAssembly database).
File-snapshot tools handle local workspaces well, yet production agents rarely stop at files. They mutate live database rows while other traffic writes to the same tables, issue partner API calls, and queue emails or webhooks that cannot be unsent once they cross the network boundary.
Lockgate splits agent mutations into four reversibility classes and tracks their causal dependencies in a local SQLite WAL ledger:
Reversibility class | Example tools | How Lockgate unwinds it |
|
| Captures atomic before/after row snapshots and SHA-256 hashes. Rollback re-checks the live row hash inside a SQLite transaction (CAS). If a human or another service edited the row concurrently, Lockgate blocks the overwrite and shows a 3-way diff ( |
|
| Pairs each forward call with a deterministic inverse action and a unique idempotency key ( |
|
| Holds irreversible outbound messages inside the Outbox Chamber during a configurable hold window. Rolling back before the outer gate opens transitions the item atomically from |
| Any already-flushed outbox item or non-reversible call | Never pretends an undo succeeded. Emits a structured |
Quick start
Requires Node.js 22.5+ (uses built-in node:sqlite, zero runtime dependencies).
npm install
npm run build
npm testStart the local Flight-Recorder Workbench (preloaded with the billing incident scenario):
node dist/cli.js serve --port 4173Open http://127.0.0.1:4173 to:
Run any of the three live SQLite disaster scenarios (
rogue-billing,flushed-email-leak,stripe-503-retry).Click any step on the causal timeline ruler to compute its transitive reverse-topological rollback plan before touching a byte.
Inspect the 3-way CAS conflict diff when a concurrent human edit occurs, pick
Keep human editorForce restore, execute rewind, and re-run rewind to verify zero duplicate compensations.Deliberately open the outer lockgate (
Break seal and flush) on a held email to watch Lockgate switch fromcancel_outboxto an honestReconciliationTicket.
Build the standalone static demo bundle (pages-dist/):
npm run build:pagesRelated MCP server: korg
MCP stdio server
Lockgate ships a JSON-RPC 2.0 Model Context Protocol server over stdio (initialize, tools/list, tools/call, resources/list, resources/read).
Add it to an MCP client config:
{
"mcpServers": {
"lockgate": {
"command": "node",
"args": ["dist/cli.js", "mcp", "--db", "./lockgate.db"]
}
}
}Exposed MCP tools:
lockgate_begin_rundb_update_customerstripe_create_invoiceslack_post_messageoutbox_queue_outboundoutbox_flushlockgate_plan_rollbacklockgate_execute_rollbacklockgate_verify_invariants
Resource URI: lockgate://snapshot.
CLI commands
# Run a built-in incident against a persistent SQLite file
node dist/cli.js scenario rogue-billing --db ./demo.db
# Compute a dry-run rollback plan (full run or scoped to one step)
node dist/cli.js plan <runId> --db ./demo.db
node dist/cli.js plan <runId> --step <stepId> --db ./demo.db
# Execute rollback with explicit conflict resolutions
node dist/cli.js rewind <runId> --keep <conflictStepId> --db ./demo.db
# Verify SQLite state hash, idempotency uniqueness, and outbox invariants
node dist/cli.js verify <runId> --db ./demo.dbArchitecture
src/core/is a pure functional core with no I/O: discriminated-union types, canonical SHA-256 hashing (hash.ts), reverse-topological causal closure and CAS dry-run planning (planner.ts), and ledger invariant verification (invariants.ts).src/store/contains the platform-agnosticSqlDatabasedriver contract (sql-driver.ts), core engine (core-engine.ts), and native Node SQLite WAL wrapper (engine.ts) with injectableClock,IdGenerator, andExternalAdapterinterfaces for deterministic replay and fault injection.src/browser/adaptssql.jsWebAssembly SQLite (sqljs-driver.ts) and shares the exact REST API router (api-router.ts) withsrc/http/server.ts.src/mcp/implements the stdio JSON-RPC 2.0 MCP server and tool schema definitions.src/http/serves the REST API and static Workbench assets.tests/covers pure planner unit tests,fast-checkproperty invariants (round-trip SQLite state hash, idempotent 2x rewind, human edit protection, transient 503 recovery), HTTP API integration, CWE-22 path traversal regressions, SQLite WASM vsnode:sqliteparity tests, and a live spawned MCP stdio subprocess E2E test.
Credits
Dependency / asset | Use | License |
Embedded SQLite WAL ledger and business tables (zero runtime npm deps) | MIT | |
Static type checking and build compiler (dev) | Apache-2.0 | |
Unit, integration, and MCP subprocess test runner (dev) | MIT | |
Property-based invariant testing (dev) | MIT | |
Local TypeScript execution (dev) | MIT | |
Browser verification scripts (dev) | Apache-2.0 | |
SQLite 3 compiled to WebAssembly for the static browser demo and parity tests (dev) | MIT | |
Bundling the static Cloudflare Pages demo runtime (dev) | MIT | |
Display, body, and monospace typography via Google Fonts | SIL OFL-1.1 | |
Studio hardware photography ( | Generated specifically for this project | MIT |
License
MIT. See LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Host any HTTP API as MCP tools with a tamper-evident cross-agent settlement ledger.
Persistent, inspectable memory for AI agents with lineage, correction, and a hosted MCP endpoint.
An agent-native database over MCP: shared, validated, structured records in every AI chat.
Durable commitment lifecycle, verification, governance and recovery layer for agentic commerce.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceRecords all MCP tool interactions in a centralized ledger, enabling developers to trace, replay, inspect, and audit AI agent workflows.-
- AlicenseNot gradedqualityBmaintenanceA causally-ordered, rewindable event-ledger for autonomous AI agents, enabling tamper-evident audit, replay, and rollback of agent actions via an MCP server.4MIT
- AlicenseAqualityDmaintenanceProvides transactional intelligence for AI agents, enabling safe tool execution with pre-flight invariant checks, sub-second filesystem snapshots/rollback, causal tracing, belief contradiction detection, and 15 native MCP tools for Claude Code.15MIT
- FlicenseAqualityDmaintenanceEnables AI agents to create accounts, record balanced double-entry transactions, query balances, and reconcile accounts against a SQLite-backed ledger through four MCP tools.4-