All posts

If the agent can see it, treat it as already outbound

Published
Reading time
5 min
Tags
mcp, ai-agents, security, n8n

This week Claude Code got caught putting the user’s login email into the User-Agent header on web requests.

Not a secret API. Not a backdoor. A coding agent doing research, hitting a site that asks scripted clients for a contact address, and filling in the only contact it had: the email sitting in its session context.

Anthropic says nobody built that as a feature. The model did it. They shipped a privacy check in version 2.1.317+. People still reported spam.

I’m not here to dunk on Claude Code. I use coding agents every day. I build MCP servers and n8n agents for clients. The bug is just a clean example of a rule I already write down for every build:

If the agent can see it, treat it as already outbound.

Why this keeps happening

Agents are helpful. Helpful agents call tools. Tools hit the network.

Once a model can:

  • read session context (login email, workspace name, recent files),
  • call curl, WebFetch, or an MCP tool,
  • and invent a “polite” User-Agent,

…you have an egress path. No malice required. A site policy that says “please include a contact email” is enough.

So the fix is not “trust the model more”. The fix is: shrink what the model can see, and check what actually left.

What I do on custom MCP servers

When I build a Custom MCP Server for a client (Claude, ChatGPT, Cursor — connected to their API or database), most of the work is not “add more tools”. It’s deciding what each tool is allowed to return.

A short list I actually use:

  1. Least data in the tool result. Return the fields the agent needs for the task. Not the whole customer row “because we might need it later”.
  2. Redact before the model. Strip emails, phone numbers, raw tokens, and internal IDs when the task doesn’t need them. The model can’t leak what it never received.
  3. Scope per caller. The person (or agent) asking “list vendors” should only see what they’re allowed to see. Same server, different access.
  4. Writes wait. Destructive or money-moving tools go through a confirm step. Reading is cheap. Writing is not.
  5. Keys stay on the server. The AI app never gets the database password or the Stripe secret. The MCP server holds them.

None of this is glamorous. All of it beats explaining to a client why their support inbox started getting weird mail.

What I do on n8n / Make agents

Same idea, different wiring.

For an invoice agent (the AP package I customize per client):

  • The AI reads the PDF.
  • Plain code checks the math, the vendor, duplicates, and confidence.
  • If confidence is under 0.9, or the PDF is blurry/cropped, a human in Slack gets the original file and a reason. The agent does not guess just to keep moving.
  • The model does not get a dump of every customer email in the company to “help with matching”.

When something needs a human, they get context. When something doesn’t, the model doesn’t get extra secrets for fun.

A 30-minute egress check you can run today

You don’t need a security team for this. You need a request you control.

  1. Update the agent. If you use Claude Code, get on 2.1.317+ and leave the privacy check on.
  2. Point a web tool at yourself. Use webhook.site, a requestbin, or a tiny nginx log on a VPS you own.
  3. Ask the agent to fetch that URL (or have your MCP tool call it).
  4. Read the headers and query string. Look for email, phone, authuser=, API keys, customer ids.
  5. Fix what you find. Redact the tool output, remove the field from context, or block the header in a wrapper.
  6. Write it down. One note in the repo: “what we checked, what leaked, what we changed.”

Do this on your own demos and personal tools first. Never point a production client agent at a random third-party sink.

A boring checklist before you ship an agent

Copy this into the PR description if you want:

  • What PII sits in the system prompt / session context?
  • Which tools can reach the network?
  • What does each tool return to the model — full row or trimmed fields?
  • Are emails / phones / tokens redacted before the model sees them?
  • Did we capture one real outbound request to a URL we control?
  • For writes: is there a human confirm (Slack, button, queue)?
  • If the model is unsure, does a human get the original document?

If you can’t tick the outbound-request box, you haven’t tested egress. You’ve only tested the happy-path demo.

The short version

Agents will send whatever helps them finish the task. Including your email. Including a customer id. Including a token that “looked like a contact field”.

So design like the model is a smart intern with network access:

  • Give it less.
  • Redact early.
  • Confirm the dangerous bits.
  • Check the wire once before you call it done.

That’s how I build MCP servers and automation agents for clients. Fixed price, scoped tools, and no pretending the model will “just know” not to share.

Want one built for your stack?

I ship Custom MCP Servers that connect Claude or ChatGPT to your API or database, with access rules baked in. Same idea for n8n / Make AI automation when the job is a real business workflow, not a toy chat.

Packages and pricing are on zakadev.com/services. Book a call if you want a second pair of eyes on what your agents can see — and what they can send.

Thirty minutes, one workflow, a straight answer.

Book a call