Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    mcp-saga Guardrail & Transaction Rollback

    1

    Automatic saga-pattern transactions and rollback protection for AI agents modifying SQLite databases via MCP.

    Free

    Security scanned
    mcp-saga Guardrail & Transaction Rollback

    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.

    StateRecords BeforeIntermediate StateFinal State (Post-Rollback)
    membership_tiers2 tiers3 tiers (id: 4 created)2 tiers (id: 4 deleted via compensating undo)
    usersuser 3 on tier 1unverifieduser 3 unchanged on tier 1
    Database IntegrityCleanUncommitted saga100% 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. 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. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

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

    Saga MCP
    @modelcontextprotocol/server-sqlite
    Node.js / npx

    Permissions

    Terminal / Shell
    Read Files

    File Scopes

    **/*.db
    **/*.sqlite

    Read access to local SQLite database files to track table schemas and generate compensating rollback operations for active sagas.

    Listed12 days ago

    What's inside

    Frequently Asked Questions

    This skill solves the 'partial update' problem where an AI might successfully execute one database change but fail on the next, leaving your data in a broken state. It enforces strict saga-based boundaries to ensure all changes either succeed together or are completely rolled back.

    mcp saga is built for any AI agent or platform that supports the Model Context Protocol (MCP) and is interacting with a SQLite environment. It acts as a specialized layer for these agents to handle complex database mutations safely.

    Native 'ON CONFLICT' syntax is disabled to ensure predictable rollback paths; instead, the skill requires a 'check-then-update' pattern. This allows the saga mechanism to precisely track changes and guarantee a clean state recovery if an error occurs.

    The purchase includes the full MCP skill configuration, the saga-lifecycle logic, and documentation for integrating the 'begin-commit-abort' workflow into your existing SQLite database tools.

    Yes, this skill is ideal for multi-table operations. If a failure occurs while updating a secondary table, the saga_abort command will automatically revert the initial changes in the primary table to maintain full data integrity.

    New in Data & Databases