Read-only at 10:00, write-capable at 10:01: why the MCP trust gate has to decide twice


You marked a third-party MCP server trust: untrusted for one clear reason: it can rewrite your ticket database, and you do not want it doing that while you are not looking. For the first few days it behaves. Read-only lookups never bother you, write calls always prompt, and you click through them with reasonable confidence.

Then one afternoon a write call that should have prompted simply runs. Nothing in the logs looks wrong. The server did not error. It reconnected once.

What this gate is actually defending

MCP servers list their tools to the client, and each tool may carry a readOnlyHint annotation meaning “I only read, I do not change anything”. Hermes’ trust gate uses that annotation to split traffic:

  • server is trust: untrusted, tool is not annotated read-only: ask before every call;
  • server is trust: untrusted, tool is annotated readOnlyHint: true: let it through without interrupting you.

The whole design assumes the annotation is still true when the call runs. The annotation is not a constant.

The gap: between reading the hint and using the connection

A call roughly goes: pass the gate, then acquire (or lazily start) the server connection, then dispatch. The gate runs first, using the cached readOnlyHint.

Acquiring the connection can do something nobody planned for: if the connection is lazily started, or has just been re-established, it re-runs discovery — it asks the server for its tool list again. The server reporting readOnlyHint: false this time is entirely legitimate: it may have been upgraded, its backend may have changed, or it may simply be a different implementation.

Hence the seam: the gate clears the call against the old annotation, while the call that actually goes out belongs to the new one. In between, nobody re-checked.

There was a second, quieter bug: reconnecting an already-registered server never refreshed the hints at all — the registration path returned before recording trust metadata. The cache could stay pinned to whatever discovery saw the first time.

The shape of the fix: snapshot, re-read under the lock, refuse instead of prompting

PR #155485, merged on November 15, 2026, closes the seam in three layers.

One: take a snapshot. Record the hint before the gate. After the connection is acquired, if the tool flipped from read-only to write-capable while the server is untrusted and no grant covers it, ask. That ask is consent only — it does not reserve a second spend charge — and if you decline, a charge already booked is refunded.

Two: re-read inside the lock. Every dispatch attempt re-reads the hint under _rpc_lock. That is the same lock tools/list holds, and hints are written synchronously while a listing is handled. So a call queued behind a reconnect’s listing, or behind a list_changed refresh, always sees the fresh value instead of a half-updated cache.

Three: no prompts from a recovery path. This is the one people miss. If a retry — session expiry, stdio respawn, OAuth refresh — finds that the tool has become write-capable, it does not pop an approval box mid-recovery. It refuses, and says the call was not run without approval, so re-invoke it to ask. The reasoning is sound: a prompt that appears during recovery reads like “the follow-up to what you just did”, and a reflexive click is not real consent.

Two details come with it. A call Hermes refused itself is not the server’s fault, so it is not counted as a circuit-breaker strike. And when no attempt ever reached the server — refused on the first attempt, stdio child dead before dispatch, a 401 — the booked spend is refunded.

Why refusing beats prompting

Put the three layers together and one principle shows: when in doubt, lean toward not doing it.

The fix only fires in one direction — read-only flipping to write-capable. The reverse does not revoke a grant you already gave, and an existing session or always grant, or YOLO mode, still covers the tool. In other words it does not add extra clicks; it catches the calls that should have asked and were skipped because a cache went stale.

The same window also landed PR #155565, which covers the opposite edge: if there is no trust record at all — a mangled config, a lost record — that is now treated as untrusted, with a warning that names which default was used, rather than being read as “absent, therefore permissive”. Together the two PRs make both ends of the gate fail closed.

One premise worth stating plainly

This gate is an in-process heuristic, not a security boundary. The project’s security notes say so, and the PR repeats it. Its job is to make write operations on untrusted servers ask first; it is not a guarantee that malicious code cannot run. Real boundaries are the sandbox, OS permissions, and which servers you put in your config.

That framing is exactly why “refuse, do not prompt” is acceptable in a recovery path: a prompt in the middle of recovery was never a trustworthy consent point to begin with.

What it means for you, and how to check

No new settings — trust: keeps its syntax and meaning. Coverage lives in tests/tools/test_mcp_trust_gate_rediscovery.py, which drives the real discovery path rather than stubs.

On the release timeline, v0.23.1 shipped on November 10, 2026 and these two PRs merged on November 14–15, so they are on main only, not in a release yet.

Update (2026-11-17): these changes shipped in v0.23.2 (November 16) — hermes update brings them in. The “not in v0.23.1” wording above is a snapshot from publication time.

To check whether your own setup only looks safe, the full way to declare trust: untrusted for a packaged server is in a plugin that gates its own MCP server; if that server also has a spend limit, MCP tool costs and spend limits explains how charges are booked and refunded; and MCP multiplexing and fan-out covers the multi-profile case.

The one-line version

The fragile part of a security decision is rarely the rule — it is that the world moved after the decision was made. Snapshot the evidence at the door, re-read it under the lock when you act, and in a recovery path prefer refusing to pretending you asked.