Documentation
Docs & MCP
Everything you need to connect UndoGuard to Claude, Cursor, LangChain or your own agent framework.
No API key detected — snippets use
YOUR_UNDOGUARD_API_KEY. Create one on the home page and it will appear here automatically. Base URL & authentication
All endpoints live under https://undoguard.vercel.app/api/v1. Authenticate with the header x-undo-api-key.
request headers
x-undo-api-key: YOUR_UNDOGUARD_API_KEYcontent-type: application/json Request a new API key
Create a project programmatically (or use the form on the home page).
terminal
curl -X POST https://undoguard.vercel.app/api/v1/projects/register \ -H "content-type: application/json" \ -d '{ "email": "you@company.com", "name": "My Agent" }'REST API
| Method | Path | Description |
|---|---|---|
| POST | /api/v1/projects/register | Create a project and receive your live API key once. |
| POST | /api/v1/execute | Execute an agent action and store an encrypted pre/post-state. |
| POST | /api/v1/rollback/{transactionId} | Roll back one specific action. |
| POST | /api/v1/rollback-session/{sessionId} | Roll back all actions in a session (newest → oldest). |
| GET | /api/v1/transactions | Last 50 transactions + usage for the signed-in project. |
| POST | /api/v1/demo/simulate | Simulate a realistic AI mistake in the demo CRM (sandbox). |
MCP integration
Connect UndoGuard to Claude Desktop or Cursor
Download the zero-dependency MCP server, drop its path into your config, and your agent instantly gets tools for execute, rollback and rollback_session.
Download MCP ServerSingle file · Node.js 18+ · no install, no dependencies.
claude_desktop_config.json — one-click copy
claude_desktop_config.json
{ "mcpServers": { "undoguard": { "command": "node", "args": ["/absolute/path/to/undoguard-mcp.mjs"], "env": { "UNDO_API_KEY": "YOUR_UNDOGUARD_API_KEY", "UNDO_API_URL": "https://undoguard.vercel.app/api/v1" } } }}Replace /absolute/path/to/undoguard-mcp.mjs with the path where you saved the downloaded file.
remote (HTTP) — no download needed
mcp.json
{ "mcpServers": { "undoguard": { "url": "https://undoguard.vercel.app/api/v1", "headers": { "x-undo-api-key": "YOUR_UNDOGUARD_API_KEY" } } }} Framework examples
LangChain (TypeScript)
Wrap every destructive tool in an UndoGuard execute call. Pass a shared sessionId to roll back an entire run in one go.
tools.ts
import { tool } from "@langchain/core/tools";import { z } from "zod"; // Every destructive tool goes through UndoGuardexport const updateCustomer = tool( async ({ id, patch, sessionId }) => { const res = await fetch(`https://undoguard.vercel.app/api/v1/execute`, { method: "POST", headers: { "content-type": "application/json", "x-undo-api-key": "YOUR_UNDOGUARD_API_KEY", }, body: JSON.stringify({ targetUrl: `https://crm.example.com/api/customers/${id}`, method: "PUT", body: patch, agentId: "langchain-agent", sessionId, }), }); return res.json(); }, { name: "update_customer", description: "Update a customer record (undoable via UndoGuard).", schema: z.object({ id: z.string(), patch: z.record(z.any()), sessionId: z.string() }), },);