Skip to main content
Glama
Atto (atto-mcp)
by zfir-dev
README.md
# Atto

[![npm](https://img.shields.io/npm/v/atto-mcp)](https://www.npmjs.com/package/atto-mcp) [![license: MIT](https://img.shields.io/badge/license-MIT-blue)](LICENSE)

**Atto is like a security camera with a rewind button for your AI agent.**

AI agents get work done by using tools: create a note, write a file, delete a row. Atto sits in the middle, between your agent and its tools. It:

- **writes down every action** in a log that can't be quietly edited,
- **blocks risky actions**, or **holds them until you approve**,
- and lets you **undo** what the agent did.

Undo is the rewind button:

- The agent created a note → undo deletes it.
- The agent overwrote a file → undo puts back the old version (Atto saved a copy first).

You tell Atto once what the opposite of each tool is. Some things can't be undone, like an email that was sent or money that was moved, and Atto tells you so instead of pretending.

Undo is always done by a person. Block rules are for the agent, so they never stop you from undoing something.

## Why

Agents are useful because they can change real things. That's also what makes them scary: when something goes wrong, you want to know exactly what happened and put it back. Atto gives you a clear record, a way to stop the dangerous stuff before it happens, and a way to reverse the rest.

## Quick start

You need Node.js 22.13 or newer. There's nothing to install first: `npx` fetches Atto the first time you run it.

**1. Make a config.** In the folder where you want to keep Atto's settings and log, run:

```bash
npx -y atto-mcp init
```

This makes a starter `atto.config.json` and prints the lines to paste into your agent's settings. It won't overwrite a config you already have (add `--force` if you really want a fresh one).

**2. Add your tools.** Open `atto.config.json` and swap the example server for the MCP servers your agent really uses.

**3. Point your agent at Atto** instead of at its tools. For Claude Desktop or Cursor, paste what `init` printed. It looks like this:

```json
{
  "mcpServers": {
    "atto-mcp": {
      "command": "npx",
      "args": ["-y", "atto-mcp", "proxy", "--config", "/path/to/atto.config.json"]
    }
  }
}
```

The agent still sees the same tools. It just goes through Atto now.

**4. Watch what it does:**

```bash
npx -y atto-mcp ui --config /path/to/atto.config.json   # open http://127.0.0.1:4545
```

If you'd rather type `atto-mcp` directly (as in the examples below), install it once with `npm install -g atto-mcp`.

### Try the demo first

Want to see it before connecting a real agent? The repo has made-up demo tools:

```bash
git clone https://github.com/zfir-dev/atto-mcp.git
cd atto-mcp
npm install
npm run build
node dist/cli.js -c examples/atto.config.json seed-demo   # records some sample agent actions
node dist/cli.js -c examples/atto.config.json ui          # open http://127.0.0.1:4545
```

## A simple config

`atto.config.json`:

```json
{
  "db": "./atto.db",
  "upstreams": {
    "notes": { "type": "stdio", "command": "node", "args": ["./acme-notes-server.js"] },
    "files": { "type": "stdio", "command": "node", "args": ["./sandbox-files-server.js"] }
  },
  "rules": [
    { "match": "*delete*", "action": "deny" },
    { "match": "send_*", "action": "require-approval" }
  ],
  "undo": {
    "inverses": {
      "create_note": { "tool": "delete_note", "args": { "id": "{{result.structuredContent.id}}" } }
    },
    "fileGuard": { "roots": ["./workspace"] }
  }
}
```

- `upstreams` are the tools your agent uses (MCP servers).
- `rules` say what to block or hold for approval.
- `undo` says what the opposite of each tool is, and which folder's files to keep copies of.

## Blocking and approval

- `"action": "deny"`: the agent's action is stopped and logged as **blocked**. It never reaches the tool.
- `"action": "require-approval"`: the action waits until you click **Approve** or **Reject** in the dashboard. If nobody answers in time, it is stopped.

`match` is a name pattern, so `*delete*` covers `delete_note`, `bulk_delete_rows` and so on.

## Undo

```bash
atto-mcp undo <entry-id>          # shows what undo would do
atto-mcp undo <entry-id> --yes    # does it
```

Or click **Undo** on an action in the dashboard and confirm.

There are two kinds of undo:

- **Opposite tool.** You tell Atto that the opposite of `create_note` is `delete_note`, and where to find the note's id. Undo calls `delete_note` for you.
- **File copy.** For tools that write files, Atto saves the file before the agent changes it. Undo puts the old version back, or removes the file if the agent created it. This only works inside the folders you list.

Some important details:

- **Block rules never stop undo.** Rules control the agent; undo is you. With `deny *delete*` in place, you can still undo a `create_note`, even though that means calling `delete_note`.
- Each action can only be undone once, and the undo shows up in the log, linked to the original.
- Atto refuses to undo when it can't do it properly: no opposite was set up, the details it needs were hidden in the log (like a password), the action was blocked or failed, or the file has changed again since. It tells you which.
- Things outside Atto's reach (a sent email, a payment) can't be undone.

## Get a ping on your phone

Atto can message you when something happens: an action was blocked, an action needs your approval, someone pressed undo, or the agent used a risky tool (anything with "delete" or "drop" in its name, for example).

Approval messages come with **Approve** and **Reject** buttons. Tapping one opens a small page that asks you to confirm, so nothing happens by accident. Each link works once and expires.

Pick where you want the messages and put its webhook address in an environment variable (so the secret address isn't in your config file):

```json
"alerts": [
  { "url": "${SLACK_WEBHOOK_URL}", "format": "slack", "events": ["blocked", "approval_pending"] },
  { "url": "${DISCORD_WEBHOOK_URL}", "format": "discord", "events": ["undo", "risky"] },
  { "url": "https://ntfy.sh/${NTFY_TOPIC}", "format": "ntfy", "events": ["approval_pending", "approval_resolved"] }
],
"publicUrl": "https://atto.example.com"
```

```bash
export ATTO_ALERT_SECRET=$(openssl rand -hex 32)   # signs the Approve/Reject links
atto-mcp alert test                                     # sends a test message to each alert
```

- **Slack**: create an "Incoming Webhook" for a channel and use its URL.
- **Discord**: Channel settings → Integrations → Webhooks → copy the URL.
- **ntfy**: install the ntfy app, subscribe to a hard-to-guess topic name, and use `https://ntfy.sh/<topic>`.

The buttons open `publicUrl`. On your own computer the default (`http://127.0.0.1:4545`) is fine; to tap them on your phone, put the dashboard behind a tunnel (for example Cloudflare Tunnel) and set `publicUrl` to that address. Set `ATTO_ALERT_SECRET` for both `atto-mcp proxy` and `atto-mcp ui`.

### Or by email, through your own mail account

Atto can send the same alerts as email through any SMTP server you already have. For Gmail, turn on 2-step verification, create an **app password** (Google Account → Security → App passwords), and use it instead of your normal password:

```bash
export ATTO_SMTP_URL="smtps://you%40example.com:abcd-efgh-ijkl-mnop@smtp.gmail.com:465"
```

(`%40` is how you write the `@` of your address inside the URL.)

```json
"alerts": [
  { "format": "email", "from": "Atto <you@example.com>", "to": "you@example.com", "events": ["approval_pending", "blocked", "undo"] }
]
```

Run `atto-mcp alert test` to check it arrives. Approval emails have the same Approve and Reject buttons.

Alerts never slow down or break the agent: they're sent in the background, retried a few times, and given up on if the service is down. `atto-mcp alert log` shows what was delivered.

## Checking the log

```bash
atto-mcp log -f      # watch actions as they happen
atto-mcp verify      # check nothing in the log was edited or deleted
atto-mcp ui          # browse everything in the dashboard
```

Every entry is linked to the one before it with a fingerprint (a hash), so changing or removing an entry breaks the chain and `atto-mcp verify` points at it. Atto also keeps a copy of the latest fingerprint outside the log, so deleting the newest entries is caught too.

## More

- [docs/reference.md](docs/reference.md): every config option, alerts in detail, the HTTP mode for remote agents, secret hiding, replay, the full CLI, and the limits.
- `npm test` runs the test suite.
- [site/](site/): the landing page (SvelteKit + Flowbite Svelte, static build). It isn't part of the npm package.

## License

MIT. See [LICENSE](LICENSE).