The direct answer

Do not treat an MCP tool annotation such as readOnlyHint as permission to perform a write. Use it as a risk cue only.

For tools that change data, enforce confirmation at the point of execution. The confirmation should identify the exact operation, target, arguments and expected consequence; it should expire; and it should authorize one bounded attempt, not a general permission to continue. The server should then record an immutable audit event and reject a reused or altered approval.

That approach protects the business without turning every agent action into a manual approval queue. It also gives customers, employees and auditors evidence of what happened instead of an ambiguous model-generated tool call.

Why this matters for a developer entrepreneur

An MCP tool that reads data is usually easy to recover from. A bad read may return the wrong result, but it does not usually send an invoice, change production configuration, cancel a subscription or delete customer records.

Write tools create a different commercial risk. One overly broad approval can cause direct financial loss or customer harm. On the other hand, asking for approval on every harmless action makes the product frustrating, increases latency and discourages people from trusting the agent.

The design goal is not maximum safety. It is proportionate friction: automatic execution where consequences are bounded and reversible, and explicit human confirmation where the action changes an external system in a material way.

This is also why MCP tool annotations need care. The protocol describes readOnlyHint, destructiveHint, idempotentHint and openWorldHint as hints. The specification says clients must treat them as untrusted unless they come from a trusted server. A server can label a tool as read-only and still perform a mutation, so your actual boundary must live in trusted server-side policy and authorization code.

For a broader inventory of the controls around permissions and boundaries, see the MCP production security checklist.

Step 1: Classify tools by consequence, not by name

A name such as update_customer is not enough. Tool behavior can differ by arguments, resource and current state.

Build a risk matrix with at least these columns:

Dimension Low consequence High consequence
Data change Adds a draft note Deletes customer records
External effect Updates an internal cache Sends an email or charges a card
Recoverability Easily reversed Irreversible or expensive to reverse
Scope One explicitly named item Broad collection, tenant or production environment
Sensitivity Non-sensitive metadata Credentials, payment data or regulated records

Then classify each operation path.

Tier 0: observational reads

Examples include listing projects or retrieving a public product record. These can normally run without confirmation, provided the underlying API credentials are read-only and the response contains no unnecessarily sensitive data.

Tier 1: reversible internal writes

Examples include saving a draft or adding a label. These may run automatically if the user has granted scoped access, the action is idempotent and the product can show what changed. Reversibility matters more than whether the action is technically a write.

Tier 2: consequential writes

Examples include sending email, publishing content, changing access permissions, modifying billing or modifying production configuration. Require scoped human confirmation by default.

Tier 3: irreversible or high-impact operations

Examples include deleting a tenant, issuing a refund, transferring funds or deleting production data. Require explicit confirmation, server-side authorization and possibly a second approval mechanism, such as a two-person rule for the highest-impact actions.

Do not make the model decide the tier. Compute it from trusted server policy using the authenticated principal, tool identity, validated arguments, target resource and effect class.

Step 2: Turn the confirmation into a scoped capability

A confirmation dialog that says “Allow this tool?” is too vague. It does not tell the user what the agent is about to change.

A useful confirmation presents a concrete summary:

  • Action: Archive project “Northstar”
  • Resource: Project 482 in Acme workspace
  • Reason: The task requires closing the completed project
  • Effect: The project becomes read-only for non-administrators
  • Reversibility: An administrator can restore it within 30 days
  • Authorization expires: In five minutes

The user should be able to deny the request. A “cancel” or “edit parameters” action is more useful than a bare confirmation button.

Under the hood, issue a single-use approval token containing or referencing a canonical representation of:

  • tool name and server identity;
  • normalized arguments;
  • target resource;
  • authenticated user or delegated principal;
  • risk class and effect summary;
  • a unique nonce;
  • expiry time;
  • the exact scope of the approval, such as one call to one resource.

The approval must not grant a broader capability such as “write to the customer database.” It should apply only to the operation the user actually reviewed.

If the agent changes the resource, arguments, amount, recipient or scope after approval, the old approval must become invalid. Bind the token to a canonical digest of the intended operation rather than relying only on a tool name.

Step 3: Put enforcement in the server

The model and the client UI may help gather consent, but the server owns the consequential action. It must enforce the policy independently.

A safe execution sequence is:

  1. Validate the tool arguments against a strict schema.
  2. Authorize the principal for the requested resource and action.
  3. Calculate the effect class from trusted policy.
  4. If confirmation is required, verify a valid, unexpired, single-use approval token.
  5. Check that the token matches the canonical operation digest.
  6. Atomically consume the token.
  7. Execute the mutation using a server-owned credential.
  8. Record the result in the audit trail.

The important detail is the order. Consume the token atomically with execution where the underlying system supports it. Otherwise, a crash between “execute” and “mark consumed” could leave a replayable approval.

If the downstream API supports idempotency keys, derive the key from the approved operation and store its outcome. That lets you distinguish “the first request timed out” from “the agent deliberately invoked the action again.” An idempotentHint annotation does not deduplicate calls for you; it only describes expected behavior.

Step 4: Prevent replay without breaking legitimate retries

Strict replay prevention can make agents unreliable because networks time out. A useful design distinguishes three cases:

  1. Same approved operation, same idempotency key: return or safely reconcile the original result.
  2. Same approved operation, no reusable outcome record: require the server to look up the operation by idempotency key before executing again.
  3. New operation or changed arguments: perform normal authorization and confirmation checks.

Do not solve ambiguity by making every write retryable. Two calls may look identical while representing two intended actions. Conversely, never permit a human to approve one token and then let an agent reuse it for a later invocation.

A compact token payload might look like this:

{
  "approval_id": "apr_01J...",
  "nonce": "n_7c91...",
  "server_id": "billing-mcp",
  "tool": "update_invoice",
  "principal": "user_42",
  "resource_id": "inv_908",
  "arguments_digest": "sha256:...",
  "effect": "invoice_draft_updated",
  "expires_at": "2026-04-03T10:05:00Z",
  "max_uses": 1
}

The important properties are not the exact field names. They are single use, short expiry, principal binding, resource binding and argument binding. Sign or protect the token so the client cannot change its scope.

Step 5: Record an audit trail that supports investigation

A useful MCP audit trail answers more than “did the endpoint receive a request?” It should let you reconstruct:

  • which tool was requested;
  • which server and version handled it;
  • which authenticated principal or delegated identity initiated it;
  • which arguments were approved, with sensitive values redacted;
  • which resource was affected;
  • whether a confirmation was required;
  • who or what approved it;
  • whether the approval was consumed;
  • the resulting status and external reference;
  • any rejection, timeout or policy failure.

Include a request ID, tool-call ID, approval ID and idempotency key where available. Store timestamps in UTC and preserve the original server identity.

Avoid recording secrets, full payment details or unrestricted file contents. An audit system is not a convenient place to duplicate the full payload of every tool call. Store a redacted argument representation, a digest of the approved canonical operation and the minimum identifiers needed for investigation.

Protect the audit record from ordinary application edits. At minimum, make it append-only. If your threat model or regulatory obligations justify it, export records to immutable or independently controlled storage.

A practical event should resemble this:

{
  "event_type": "mcp.tool.write",
  "request_id": "req_1042",
  "approval_id": "apr_01J...",
  "server_id": "billing-mcp",
  "tool": "update_invoice",
  "principal": "user_42",
  "resource": {"type": "invoice", "id": "inv_908"},
  "effect": "invoice_draft_updated",
  "approval": {
    "required": true,
    "method": "interactive",
    "approved_at": "2026-04-03T10:00:21Z",
    "expires_at": "2026-04-03T10:05:00Z"
  },
  "arguments_redacted": {
    "invoice_id": "inv_908",
    "amount": "redacted"
  },
  "arguments_digest": "sha256:...",
  "status": "succeeded",
  "external_reference": "api_update_881"
}

Log denials as well as successes. Repeated denied attempts, expired approvals and mismatched digests can reveal broken clients, confused agents or abuse.

Step 6: Keep normal agent work moving

Confirmation works best when it is specific and rare enough to deserve attention.

Avoid one prompt per low-risk internal step. Instead, offer an approval session for a bounded sequence when every action in that sequence has the same narrow scope and risk ceiling. For example, “Approve up to five draft updates in project 482” is different from “Allow edits to all projects.” Even within a session, retain server-side limits and log each operation.

Also preserve the distinction between planning and execution. The model can propose a plan without receiving permission. A write approval should come when the exact mutation is ready, not when the agent merely discusses it.

If a tool fails after approval, do not silently request the same permission for every retry. Reuse the original approval only when the retry is demonstrably the same operation, the token remains valid and the downstream idempotency mechanism can prevent duplicates. Otherwise, explain the failure and request fresh confirmation.

For related guidance on narrowing access before designing the approval flow, use the MCP server permission scope audit checklist.

A practical approval policy

You can start with this default and adjust it from real incident data and customer expectations:

Condition Default behavior
Read-only API credential, no external effect Execute automatically
Internal, additive and reversible write Execute automatically within granted scope; log the result
External communication, permission change, billing change or production change Require scoped confirmation
Deletion, fund movement, credential change or broad batch operation Require explicit confirmation plus additional policy checks
Changed arguments after approval Reject and request new confirmation
Expired or already-consumed approval Reject and request new confirmation
Repeated same request with the same idempotency key Reconcile with the original result rather than repeat

What to test before launch

Add automated tests around the authorization boundary, not just the tool description. At minimum, verify that:

  • a tool marked readOnlyHint: true cannot mutate through the protected server path;
  • a valid approval cannot be reused;
  • an expired approval cannot be used;
  • changing one argument invalidates the approval;
  • a different principal cannot use the approval;
  • a different server cannot use the approval;
  • an unauthorized resource is rejected;
  • a repeated request with the same idempotency key does not create a duplicate mutation;
  • redacted audit records still contain enough evidence to investigate;
  • the client cannot bypass the server to call the downstream API.

Also inspect the actual tools/list response in CI. Tool annotations are useful metadata for hosts and reviewers, but they are not a substitute for these behavioral tests.

Frequently asked questions

Should every MCP write require human confirmation?

No. Use confirmation according to consequence, reversibility and scope. Drafting an internal label does not deserve the same friction as changing production access. The mistake is using one rule for every write or assuming every tool is safe because its name sounds harmless.

Can the client enforce safety using readOnlyHint?

No. It is a server-supplied hint, not a permission boundary. Enforcement requires trusted server-side authorization, constrained credentials and independent policy checks.

Is a short-lived token enough to prevent replay?\n

It reduces the window but does not by itself prevent replay. The token also needs single-use enforcement, operation binding and, where possible, an idempotency key tied to downstream execution.

Where should the audit trail live?

Keep it under your control and away from the agent’s prompt context. Protect it from ordinary mutation, redact sensitive arguments and preserve stable identifiers that link an approval to the resulting operation.

Is manual approval a bad user experience?

It can be, especially when prompts are vague or approval remains necessary after harmless failures. Scope the request to the exact effect, allow correction where possible and reuse valid approvals only for the same idempotent operation.

The founder-level takeaway

A safe MCP write tool is not defined by a polite warning in the tool description. It is defined by a server that will not perform the mutation unless trusted policy, a valid approval and the intended operation all agree.

That architecture gives you two commercial advantages: customers can approve consequential work without giving the agent unrestricted access, and you can explain exactly who changed what. For an indie developer, those are not merely security features. They are the difference between an agent that can be sold as operational software and one that remains an experimental demo.

Sources