MCP gives an AI application a standard way to call tools on other programs. Read a file, write a file, run a query. That is useful, and it is also the attack surface: every tool call is something happening on someone’s machine because a model, or a server, or a web page the model read, asked for it.

Update, 2026-10-19: since this series, MCP 2026-07-28 changed how servers ask clients for input (multi round-trip requests), and the reference repo moved to it. The posts and their code links describe the earlier, handshake-era version; MCP stopped waiting covers what changed and why the guarantees still hold.

The question I wanted answered is simple. When an MCP tool call is about to happen, who gets to stop it, and where is that code?

MCP Security through Client Policies and Server Elicitation

The reference implementation

I built a small reference repo to find out. One MCP client, one MCP server, four tools (three of them on files), connected over the stdio transport. A Gradio app shows each request, the client’s decision, the server’s questions and both audit logs.

There is no LLM in it yet. That is deliberate. The controls in this series are deterministic: they hold whoever makes the request, a person clicking a button or a model that has been prompt-injected. If a control only works when the model behaves, it isn’t a control. Putting a model in the loop comes in Part 2.

Every claim in these posts links to the code or the test that backs it, pinned to one commit so the line numbers stay right.

Part 1: no model in the loop

Between the parts: MCP stopped waiting. The move to MCP 2026-07-28.

Part 2: a model in the loop

Run it

python3 -m venv mcp_security_env && source mcp_security_env/bin/activate
pip install -r requirements-dev.txt
python3 client/app.py server/server.py

Open the local URL it prints. Set delete_file to ask on the Permissions tab, then try deleting something.