- Home
- Skills
- Data & Databases
- mcp-saga Guardrail & Transaction Rollback
Works with the AI Agents you already use
mcp-saga Guardrail & Transaction Rollback
Automatic saga-pattern transactions and rollback protection for AI agents modifying SQLite databases via MCP.
Free
mcp-saga Guardrail & Transaction Rollback
Example session with this skill installed
Run a transaction on our SQLite db to add a new premium subscription tier to membership_tiers (name: premium, price: 49) and upgrade user 3 (name: John) to that new tier (update user_tier_id). But make sure to wrap it safely and check the result.
- Read your context and instructions
- Compiled the mcp-saga guardrail
Summary
The agent wrapped the operations inside a transaction using saga_begin. After inserting the new tier, an invalid constraint check was detected on the user update, triggering saga_abort and automatically executing reverse compensating queries to restore the database to its pristine state.
| State | Records Before | Intermediate State | Final State (Post-Rollback) |
|---|---|---|---|
membership_tiers | 2 tiers | 3 tiers (id: 4 created) | 2 tiers (id: 4 deleted via compensating undo) |
users | user 3 on tier 1 | unverified | user 3 unchanged on tier 1 |
| Database Integrity | Clean | Uncommitted saga | 100% Clean (0 corrupted rows) |
Agent Execution Log
// 1. Initializing saga boundary
> saga_begin()
=> { "status": "ok", "saga_id": "saga_88f92b", "message": "Transaction boundary active" }
// 2. Executing step 1: Insert new tier
> execute_query({ "sql": "INSERT INTO membership_tiers (name, price) VALUES ('premium', 49);" })
=> { "rows_affected": 1, "last_insert_rowid": 4 }
// 3. Validation failure detected: User constraint check failed
// The agent halts the sequence rather than leaving intermediate rows behind
> saga_abort({ "saga_id": "saga_88f92b" })
=> {
"status": "aborted",
"compensations_run": 1,
"reverted_actions": ["DELETE FROM membership_tiers WHERE rowid IN (4);"],
"message": "Database rolled back successfully to pre-saga state"
}
Connects securely to your tools. The creator never sees your data.
About this skill
Stop agents from breaking your databases halfway through complex multi-step tasks. Giving autonomous LLMs raw mutation access (INSERT, UPDATE, DELETE) creates silent state corruption whenever an agent hallucinates, encounters a runtime error, or gets interrupted midway through execution. mcp-saga acts as a transparent reverse proxy wrapping your database MCP server (such as @modelcontextprotocol/server-sqlite). It tracks state diffs, generates inverse compensating SQL statements in real time, and executes an atomic rollback if anything goes wrong.
What’s Included
- ⚬: Pre-built native binary for macOS/Linux with zero runtime dependencies.
- ⚬: Transparent wrapper around @modelcontextprotocol/server-sqlite.
- ⚬: Ready-to-use Agent System Skill instructing agents when and how to manage transaction lifecycles cleanly.
Active sagas block complex native upserts (ON CONFLICT). Requires manual check-and-update logic for idempotency. Optimized specifically for SQLite.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free forever
No account required to browse
Trust & safety
Security scan
Security scan passed 12 days ago
- Free with an Agensi account
Requires
Permissions
File Scopes
Read access to local SQLite database files to track table schemas and generate compensating rollback operations for active sagas.