One call.Not two.

An open MCP gateway between your agent and its tools. A retried side effect runs once, loops stop, risky calls wait for a person.

Open on GitHub
The demo agent sends the payment email twice. Straight to the mail server, the vendor gets two. Through the gateway, the second send comes back as duplicate and one email goes out.
mail__send_emailok
Sent to payments@vendor.example

The call goes to the mail server and the result is kept for 10 minutes under its arguments.

Three steps to the gate

Installpnpm install && pnpm build
Mark the toolsmail__send_email: { sideEffect: true }
Point the agent at it"command": "node", "args": ["dist/cli.js", "--config", "gateway.yaml"]

First, clone and build. Node 22 or newer.

Then name the tools that change the world: side effects, approval, attempt limits.

Last, give your MCP client the gateway instead of the servers behind it. Tools appear as server__tool.

What it keeps

3

Loop stop

The same call three times in a row is refused.

Engraving of the turnpike gate at Holloway below the Highgate Archway, with carts and riders on the road

A gate on the road

Holloway turnpike, engraving. CC0

tollgate.lock.json
"mail__send_email": { "hash": "9f2c…" },
"crm__delete_contact": { "hash": "41ab…" }

Tool lockfile

A tool whose description or schema changed is hidden until a person locks it again.

A 1797 share certificate of the Third Massachusetts Turnpike Corporation, handwritten and signed

Every call on record

Third Massachusetts Turnpike certificate, 1797. CC0

2

Attempt limit

New wording, same email: stopped after two.

Traces

OpenTelemetry spans: ok, error, duplicate, refused.

An Italian motorway toll ticket from San Giorgio di Nogaro with the entry time printed

One ticket per car

A4 toll ticket. Nxr-at, CC BY-SA 4.0

A closed iron toll gate between brick pillars at Groenendaal

Shut until approved

Leidse tolhek. Jane023, CC BY-SA 3.0

{"v":1,"tool":"mail__send_email",
"outcome":"duplicate", …}

Record and replay

Every call goes to JSONL. Replay runs it again through the same policies and fails if a tool now answers differently; export it as a promptfoo eval suite.

Guard your tools

Name a tool, pick what the gateway should do, and copy the policy into gateway.yaml.

Add a policy

policies:
  mail__send_email: { sideEffect: true, maxAttemptsPerSession: 2 }