SafeAgent — Claude Code MCP server: what it does, how to install
Blocks an AI agent from repeating the same action twice by tracking a stable request_id and rejecting duplicate calls.
claude mcp add safeagent -- uvx safeagent-exec-guardWhat safeagent does
Each agent action gets a request_id. Calling /claim the first time returns PROCEED; calling it again with the same id returns SKIP along with the stored result. If a claim stays in PENDING after a crash or timeout, the server keeps it blocked instead of letting the agent fire the action again on its own.
The flow moves through three states: CLAIMABLE, PENDING, COMMITTED. An action is only marked COMMITTED once /settle/{request_id} is called with the outcome, so skipping that call leaves the claim stuck in PENDING. The project is upfront about scope: the server confirms its own claim record, not whether the outside provider actually processed the action once, so payment-style operations still need checking against the provider's own records.
Useful for stopping duplicate side effects from retries, like a payment firing twice after a timeout, a signup email going out two times, or a webhook from a provider that's allowed to deliver the same event more than once getting processed again.
What it helps with
- stop a payment retry from charging a customer twice
- prevent a signup flow from sending the welcome email twice
- guard against reprocessing a webhook a provider delivers more than once
- block a provisioning retry from creating a second workspace
- keep an unresolved agent action blocked instead of silently retrying it
Example prompts for the agent
- Check SafeAgent before resubmitting the order:TQQQ:buy:6 trade so it isn't placed twice
- Claim a request id for the signup email and settle it once the send completes
- Run the Stripe webhook through claim and settle so a duplicate delivery gets skipped
How to install safeagent
Platform CLI
claude mcp add safeagent -- uvx safeagent-exec-guarduvx runs the command named after the package; if the README names another one, use uvx --from safeagent-exec-guard <command>
Platform CLI
codex mcp add safeagent -- uvx safeagent-exec-guarduvx runs the command named after the package; if the README names another one, use uvx --from safeagent-exec-guard <command>
Config file
{
"mcpServers": {
"safeagent": {
"command": "uvx",
"args": [
"safeagent-exec-guard"
]
}
}
}uvx runs the command named after the package; if the README names another one, use uvx --from safeagent-exec-guard <command>
Config file
{
"servers": {
"safeagent": {
"type": "stdio",
"command": "uvx",
"args": [
"safeagent-exec-guard"
]
}
}
}uvx runs the command named after the package; if the README names another one, use uvx --from safeagent-exec-guard <command>
Platform CLI
gemini mcp add safeagent uvx safeagent-exec-guarduvx runs the command named after the package; if the README names another one, use uvx --from safeagent-exec-guard <command>
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about safeagent
How do I install SafeAgent in Claude Code?
Run claude mcp add safeagent -- uvx safeagent-exec-guard.
What does SafeAgent do?
It's an MCP server that assigns a stable request_id to an agent action and blocks repeats: a fresh id returns PROCEED, a settled one returns SKIP with the stored result, and anything left unresolved stays PENDING until it's checked against the provider.
Does SafeAgent guarantee the external action only happens once?
No. It only confirms its own claim record. The project states that COMMITTED means the caller reported a result back, not that the outside provider processed the action exactly once, so provider-side checks are still needed for that guarantee.