DEV Community

MCP didn't give your agent permission. It gave it a phone book.

Dimitris Kyrkos on December 03, 2026

Wiring a tool into an AI app used to mean custom glue code. With the Model Context Protocol (MCP), a client can discover what a server offers, read...
Collapse
 
forexnewsradar profile image
ForexNewsRadar •

The phone book framing is exactly right. In automated trading, one MCP server exposing 50 read/write tools inflates the context window and gives the agent a blast radius that is hard to reason about.

In production we keep a tiny read-only 5-tool risk gate in front of execution and expose zero write tools on that server. It returns deterministic fail-closed booleans like allowed_to_open_trade: false whenever inputs are malformed or upstream state goes stale, so the agent cannot talk itself past the gate.

Collapse
 
cyclopt_dimitrisk profile image
Dimitris Kyrkos •

That's a good pattern, especially keeping execution completely out of that server. I like the fail-closed booleans too. One thing I'd still watch is making sure the execution side independently enforces the decision rather than treating the agent's interpretation of the gate response as a guarantee.

Collapse
 
forexnewsradar profile image
ForexNewsRadar •

Exactly: the LLM's read of the gate is advisory context, never an enforcement boundary. That's why the order router independently polls and asserts prop_safe_to_trade == true and stale == false immediately before sending the order. The model can explain or plan against that state, but it physically cannot bypass the code-level gate.

Collapse
 
paullovelace profile image
Paul Lovelace •

The tenant one is the scariest of the four for me — not because it's a bug, but because it's the design working as intended. The model reads a tenant_id out of a document and fills it in, and nothing in the call looks wrong. The ctx injection in your enforcement sketch is the right shape, but I'm curious how it holds up for the legitimate cross-tenant case: a support agent who genuinely needs to look at another tenant's invoices. Do you give that a separate tool with its own approval, or does the same tool get a second, narrower path? That's where I'd expect the clean model to get messy.

Collapse
 
cyclopt_dimitrisk profile image
Dimitris Kyrkos •

I'd lean towards a separate, explicit path for cross-tenant access, especially for support workflows. The same underlying service can handle both, but the authorization policy should make the elevated access obvious and require a reason or approval where appropriate. I wouldn't let a tenant_id argument silently turn the normal lookup into a cross-tenant one.

Collapse
 
cadence_mira profile image
Cadence Studio •

The tenant one is why I stopped passing identity in as a tool parameter. The job that touches a client picks its credential off the queue message, not out of the model's reach, so the model can decide what to do inside one tenant but never which tenant. It costs you one tool per job instead of one clever general tool, and the audit log gets much easier to read. What it does not solve is support: someone still needs the cross-tenant view, so you end up writing that path on purpose instead of getting it by accident.

Collapse
 
speedrunjaen profile image
Jaen Carrodine •

the directories push the read/write split too. anthropic's connector review rejects one tool that takes both safe and unsafe methods, and openai wants readOnlyHint and destructiveHint set explicitly on every tool. we had a sql tool doing reads and writes in one call, and that's the tool we expect a reviewer to flag first

Collapse
 
cyclopt_dimitrisk profile image
Dimitris Kyrkos •

The SQL example is a good one. It's tempting to expose one flexible tool and let the model decide what query to run, but then you've mixed two very different risk levels behind one interface. Splitting read and write operations makes the boundaries much easier to review and enforce.

Collapse
 
smtahosin profile image
S M Tahosin •

Hey Dimitris! second user thing lol. I demoed an MCP server on one token, teammate asked 'can it delete'... yea it could. Testing as the wrong user, stealing that :)

Collapse
 
cyclopt_dimitrisk profile image
Dimitris Kyrkos •

Haha, that's exactly how these things slip through. The demo works perfectly until someone asks what happens when the user isn't supposed to do something. Testing with the wrong identity should probably be part of the default MCP checklist.

Collapse
 
smtahosin profile image
S M Tahosin •

haha Dimitris, yep. I keep a spare token just for that wrong-user delete test now, run it first thing. thanks :)