2026-11-27 16:44 UTC

Bouncer adds deterministic controls for MCP agent actions

state: expiredheat: mediumuncertainty: mediumrelevance: mediummcp-security data-exfiltrationEzed9

What is this?

Bouncer is an early, MIT-licensed local proxy for MCP tool calls, available as v0.1.4 for Python 3.12+. It applies deterministic rules to calls routed through it, including denying sends to destinations previously seen in that server’s tool output, restricting configured writes, and logging decisions. It does not detect prompt injection and covers MCP calls only; its documented limits include literal, per-server, per-session matching and possible false blocks. The project reports an AgentDojo run with no attacker-directed sends, but says the tested policy also blocked all sends and shares in that run, including legitimate ones; this is evidence about that setup, not a general defence guarantee. The evidence is the project’s GitHub release information and a Show HN post dated 2026-10-28.

Why it matters

Bouncer is a small but practical example of a security layer for tool-using agents: instead of trying to detect prompt injection, it constrains what an agent can do after reading potentially hostile data. Its deterministic checks and audit log could help users limit some MCP-mediated data leaks, but the project’s own benchmark shows the central tradeoff: the tested policy prevented sends by blocking legitimate sends too. It is early and limited to MCP calls routed through the proxy, so it is a useful design experiment rather than evidence of a broadly effective defense.

Current assessment

The project describes Bouncer v0.1.4 as an available, MIT-licensed local MCP proxy for Python 3.12+. It checks calls before forwarding them, can deny sends to destinations found in earlier output from the same server during the session, applies configured write controls, and logs decisions. The project says it does not detect prompt injection; coverage is limited to routed MCP calls, matching is literal and session-scoped, and documented gaps include encoded or cross-server destinations, possible false blocks, and the need to configure destination arguments correctly. Its AgentDojo results are self-reported: with the tested policy, attacker-directed sends were 0/163 versus 48/164 without Bouncer, but it also allowed no sends or shares in that run. Benign sending-task completion fell from 4/6 to 0/6; the project notes only six such tasks and a 95% upper bound of 46% for 0/6. The benchmark ran the engine inside AgentDojo’s tool loop, treated human questions as denials, used a fixed non-adaptive attack set, and does not establish general attack resistance. The development is worth tracking as an example of deterministic, auditable enforcement at the agent-tool boundary, especially as MCP use grows; adoption, independent testing, and evidence that policies can preserve useful sends remain unknown.

Measured heat

no measured readings yet β€” the hourly heat pass fills this in

How the heat travelled

10-27 14:00⭐ origin directly observedShow HN: Bouncer, an MCP proxy that denies sends to addresses the agent read
Nishit9 on hacker news
β€”
10-27 14:00amplified on hacker news πŸ‘‘hn.story.50259501
Nishit9
peak 2 Β· 0 comments Β· 97% of case engagement
10-27 14:27our radar first saw it Β· +0.5hdiscovery anchor: hn.story.50259501β€”

Evidence (1) β€” ⭐ canonical anchor

sourceobjectauthorscorecomments
🟧 hn ⭐Show HN: Bouncer, an MCP proxy that denies sends to addresses the agent read
Retrieved article excerpt

Open article Β· Retrieved 2026-10-27T14:29:59.334053+00:00

# Bouncer

[CI](https://github.com/Ezed9/mcp-bouncer/actions/workflows/ci.yml)
[PyPI](https://pypi.org/project/bouncer-mcp/)
[Python 3.12+](https://github.com/Ezed9/mcp-bouncer/blob/main/pyproject.toml)
[License: MIT](https://github.com/Ezed9/mcp-bouncer/blob/main/LICENSE)

**A local MCP proxy that denies an agent's send and share calls to destinations
that first appeared in untrusted tool output. The rules are deterministic, no
LLM decides anything, and every decision is logged.**

[Terminal recording: an agent that read a poisoned helpdesk ticket tries to email the customer list to an attacker, write an SSH key and delete customers through Bouncer. The email and the SSH key write are denied, the first delete runs and the second is stopped by the call budget, a send to a new address is approved by a human, and a security review pack is written from the audit log.](https://github.com/Ezed9/mcp-bouncer/blob/main/docs/assets/demo.gif)

*Scripted tool calls from a hijacked agent, sent through the real proxy to a
real MCP server: three attack calls denied (one delete ran first, within its
call budget), one new recipient approved by a human,
a review pack written from the audit log. No API keys; reproduce it in the
[quickstart](https://github.com/Ezed9/mcp-bouncer#see-it-in-60-seconds). [MP4](https://github.com/Ezed9/mcp-bouncer/blob/main/docs/assets/demo.mp4) Β·
[what the demo runs](https://github.com/Ezed9/mcp-bouncer/blob/main/examples/demo/README.md) Β·
[the review pack it writes](https://github.com/Ezed9/mcp-bouncer/blob/main/examples/demo/sample-review-pack.md)*

**The cost:** in the [AgentDojo run](https://github.com/Ezed9/mcp-bouncer#benchmark) Bouncer allowed no send at
all, so legitimate tasks that send email or share files went from 4/6 to 0/6.
It covers MCP calls only ([limits](https://github.com/Ezed9/mcp-bouncer#limits)).

- **Blocks sends to addresses that came from untrusted data.** If an agent tries
  to email, post or share to a destination that appeared earlier in the same
  server's output (a poisoned email, ticket or document), the call is denied.
  The match is literal. A destination Bouncer can't trace, an encoded one
  included, goes to a human; allowlisted or approved ones pass.
- **Puts hard limits on write tools.** Path confinement, regex checks on
  arguments, per-session call budgets, and tools that weren't there at startup
  are refused.
- **Leaves evidence.** Every `allow`, `deny` and `ask` is a JSON line in
  `~/.bouncer/audit.jsonl`, and `bouncer report` turns it into a review pack.

Bouncer does not detect prompt injection. It assumes the agent will sometimes
be fooled and limits what a fooled agent can do through MCP.

**Status:** v0.1.4, early. MCP over stdio, one machine. Read the
[limits](https://github.com/Ezed9/mcp-bouncer#limits) before relying on it.

## See it in 60 seconds

From a clone, with [uv](https://docs.astral.sh/uv/) (no API keys, nothing
outside the repo is touched):

```
git clone https://github.com/Ezed9/mcp-bouncer.git && cd mcp-bouncer
uv sync --all-packages
uv run python examples/demo/run_demo.py
```

This is the recording above. It starts the real `bouncer run` proxy in front of
a small helpdesk MCP server with real side effects, then checks the server's
state afterwards: no mail reached the attacker and no file was written outside
the workspace. Output goes to `examples/demo/out/`.

## Use it with your MCP client

```
uv tool install bouncer-mcp          # or: pipx install bouncer-mcp (Python 3.12+)
```

Back up your client config, then wrap its servers:

```
cp .mcp.json .mcp.json.bak
bouncer init --config .mcp.json      # add --server <name> to wrap only some servers
```

Any config with an `mcpServers` block works, for example Claude Code's
`.mcp.json`, Cursor's `~/.cursor/mcp.json`, or Claude Desktop's
`"~/Library/Application Support/Claude/claude_desktop_config.json"` on macOS.

`init` prints the rewritten config and asks before writing. Each server entry
now launches `bouncer run`, and the original entry (command, args, `env`,
`cwd`) is kept under `x-bouncer-upstream`, which is how `run` starts the real
server and how you undo the change by hand. Restart your client.

Three things to know on the first run:

- **Your client must find `bouncer`.** The rewritten entry uses
  `"command": "bouncer"`. Desktop apps may not see your shell's `PATH`; if the
  server fails to start, replace it with the output of `which bouncer`.
- **`ask` needs MCP elicitation.** A send to an unknown destination asks the
  human through the client. If your client does not support elicitation, every
  `ask` becomes a `deny`, so list your usual recipients in
  `trusted_destinations` (see [Policy](https://github.com/Ezed9/mcp-bouncer#policy)).
- **Run `bouncer` with a subcommand.** With none, it starts Bouncer's own MCP
  server on stdio and waits for a client.

## How it works

```
  agent / MCP client
     β”‚ tool call                           β–² result, or
     β–Ό                                     β”‚ "[bouncer blocked] <reason>"
  β”Œβ”€ bouncer run: one per server, stdio ──────────────┐
  β”‚ 1. tool present at startup?      no  β†’ deny       β”‚
  β”‚ 2. within the call budget?       no  β†’ deny       β”‚
  β”‚ 3. path / regex checks pass?     no  β†’ deny       β”‚
  β”‚ 4. sending somewhere? where did the destination   β”‚
  β”‚    come from?                                     β”‚
  β”‚      seen in this server's output   β†’ deny        β”‚
  β”‚      allowlisted or approved        β†’ allow       β”‚
  β”‚      can't tell                     β†’ ask human   β”‚
  β”‚                       (no answer or no support    β”‚
  β”‚                        for asking = deny)         β”‚
  β”‚ every verdict β†’ ~/.bouncer/audit.jsonl            β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     β”‚ allowed calls only                  β–² every output is
     β–Ό                                     β”‚ recorded as untrusted
  your MCP server (filesystem, gmail, slack, …)
```

`bouncer run` starts the real server as a subprocess, records its tool list at
startup, and checks every call before forwarding it. A denied call is never
forwarded, so it has no side effects. Everything the server returns (text and
structured content) is recorded as untrusted, and a later destination that
appears in it is denied. An approval is remembered for the rest of the session.

The check is plain Python: normalize case and whitespace, then look for the
destination inside what the server has returned this session. A miss means
`ask`, never a silent `allow`.

Decision order, policy layering, the audit format and a live transcript against
the reference filesystem server: [`docs/how-it-works.md`](https://github.com/Ezed9/mcp-bouncer/blob/main/docs/how-it-works.md).

## Policy

Built-in packs in [`src/bouncer/packs/`](https://github.com/Ezed9/mcp-bouncer/blob/main/src/bouncer/packs) name the sending
and writing tools of five servers. The filesystem pack is verified against the
reference server's `tools/list`; the gmail, slack, github and gdrive packs
follow those servers' documented schemas and are not yet verified live. Check
them against your server's `tools/list`. A tool with no pack entry gets a
fallback that treats destination-shaped arguments (`to`, `url`, `channel`, …)
as destinations.

Add your own rules in YAML:

```
send_email:
  exfiltrating: true
  sink_params: [to, cc, bcc]
  trusted_destinations: [[email protected]]

write_file:
  write_params: [path]
  allowed_path_prefixes: ["/abs/path/to/project/out"]

delete_file:
  max_calls: 2          # 0 forbids the tool outright
```

Add `"--policy", "/abs/path/bouncer.yaml"` to the wrapped server's `args`. A
user entry **replaces** the pack entry for that tool, so restate
`exfiltrating` and `sink_params` when you override a sending tool, or the
destination check is off for it. Use absolute path prefixes: a relative one is
resolved against whatever directory your client starts the proxy in. Start
from [`examples/bouncer.yaml`](https://github.com/Ezed9/mcp-bouncer/blob/main/examples/bouncer.yaml).

## Why not just …

- **… approve each tool call?** Per-tool approval answers "may the agent send
  email?". Bouncer answers "may it send email to this address, given where the
  address came from?", refuses outright when the answer is "from untrusted
  data", and only interrupts you for destinations it can't place. Use both.
- **… add an LLM-based injection detector?** A detector is probabilistic and
  can be worded around; Bouncer doesn't try to spot the injection. It checks
  the action, and the same call with the same history always gets the same
  verdict, which you can test and audit. The two can run together.
- **… sandbox the agent or remove its send tools?** Do that where you can. Bouncer
  is for agents that need send and write tools to be useful.
- **… scan my MCP servers?** Scanners vet what a server declares. Bouncer
  assumes the server is honest and the data passing through it is hostile.

## For security reviewers

**Threat model.** The agent is well-meaning but reads attacker-controlled data
through MCP tools (an email, a ticket, a document) and may follow instructions
in it. The attacker controls tool output only; they cannot change Bouncer, its
policy, the client config or the server. Trusted: you (policy author and
approver), the MCP client, the upstream server and the local machine.

What the code and tests pin down, for MCP tool calls that go through it:

| Behaviour | Code | Tests |
| --- | --- | --- |
| No model or classifier in the enforcement path | [`engine.py`](https://github.com/Ezed9/mcp-bouncer/blob/main/src/bouncer/engine.py) |  |
| A denied call is never forwarded upstream | [`proxy.py`](https://github.com/Ezed9/mcp-bouncer/blob/main/bouncer-mcp/src/bouncer_mcp/proxy.py) | [`test_proxy.py`](https://github.com/Ezed9/mcp-bouncer/blob/main/bouncer-mcp/tests/test_proxy.py) |
| A destination seen in this server's earlier output is denied, including one inside a list of recipients | [`taint.py`](https://github.com/Ezed9/mcp-bouncer/blob/main/src/bouncer/taint.py) | [`test_engine_sink_gate.py`](https://github.com/Ezed9/mcp-bouncer/blob/main/tests/test_engine_sink_gate.py) |
| Path traversal (`..`) can't escape an allowed prefix; budgets and regex checks deny | [`engine.py`](https://github.com/Ezed9/mcp-bouncer/blob/main/src/bouncer/engine.py) | [`test_engine_constraints.py`](https://github.com/Ezed9/mcp-bouncer/blob/main/tests/test_engine_constraints.py) |
| Fails closed: an unanswered `ask` is a deny; a sending tool with no declared destination arguments has all arguments checked; a malformed policy stops startup; a tool added after startup is refused | [`proxy.py`](https://github.com/Ezed9/mcp-bouncer/blob/main/bouncer-mcp/src/bouncer_mcp/proxy.py), [`policy.py`](https://github.com/Ezed9/mcp-bouncer/blob/main/src/bouncer/policy.py) | [`test_policy.py`](https://github.com/Ezed9/mcp-bouncer/blob/main/tests/test_policy.py), [`test_proxy.py`](https://github.com/Ezed9/mcp-bouncer/blob/main/bouncer-mcp/tests/test_proxy.py) |
| Every verdict is written to the audit log | [`audit.py`](https://github.com/Ezed9/mcp-bouncer/blob/main/src/bouncer/audit.py) | [`test_audit.py`](https://github.com/Ezed9/mcp-bouncer/blob/main/tests/test_audit.py) |

**The audit log** is one JSON line per verdict with a UTC timestamp, tool,
full arguments, verdict, reason and the rule that fired. `ask` is an
escalation: an approved one is followed by an `allow` line for the same call;
a declined one has no further line. A tool that wasn't present at startup is
logged as `ask` and blocked. The file is plaintext and contains whatever the
agent passed as arguments (email bodies included). Bouncer only appends to it,
but nothing makes it tamper-evident.

**Review pack.** `bouncer report` writes a Markdown pack: each tool and the
controls on it, an audit log summary, findings, what it does and doesn't
cover, and an OWASP LLM Top 10 mapping.

```
bouncer report --policy bouncer.yaml 
Nishit920

Interpretation history

Decision trace