# Once MCP server

> Protects AI agent tool calls from duplicate execution during ambiguous timeouts or retries using a durable effect journal.

- Repository: https://github.com/stringsofthemind-oss/once
- Page: https://hostedmcp.org/servers/stringsofthemind-oss/once
- Transport: stdio
- Stars: 0
- License: MIT
- Latest version: 0.2.1

## Install

### Claude Code

```sh
claude mcp add --env ONCE_API_KEY=<YOUR_ONCE_API_KEY> once -- npx -y @once-agent/mcp
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "once": {
      "command": "npx",
      "args": [
        "-y",
        "@once-agent/mcp"
      ],
      "env": {
        "ONCE_API_KEY": "<YOUR_ONCE_API_KEY>"
      }
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "once": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@once-agent/mcp"
      ],
      "env": {
        "ONCE_API_KEY": "<YOUR_ONCE_API_KEY>"
      }
    }
  }
}
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "once": {
      "command": "npx",
      "args": [
        "-y",
        "@once-agent/mcp"
      ],
      "env": {
        "ONCE_API_KEY": "<YOUR_ONCE_API_KEY>"
      }
    }
  }
}
```

### Codex (`~/.codex/config.toml`)

```toml
[mcp_servers.once]
command = "npx"
args = ["-y", "@once-agent/mcp"]

[mcp_servers.once.env]
ONCE_API_KEY = "<YOUR_ONCE_API_KEY>"
```

### Gemini CLI (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "once": {
      "command": "npx",
      "args": [
        "-y",
        "@once-agent/mcp"
      ],
      "env": {
        "ONCE_API_KEY": "<YOUR_ONCE_API_KEY>"
      }
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `ONCE_API_KEY` | no | yes | Optional key for Cloud checks. Without it once_verify_connection reports Cloud unconfigured/unverified and preserves local diagnostics. |

## FAQ

### What does Once protect against?

It protects consequential external writes, such as refunds, bookings, or payments, from being executed multiple times due to lost responses or blind retries.

### Does Once provide universal exactly-once execution?

No, it does not promise universal exactly-once execution and is not a replacement for your database, framework, or queue.

### What happens when an outcome is unknown?

The system enters an UNKNOWN state which blocks further writes to prevent duplicates until an authoritative lookup can confirm the result.
