Home / Articles

Securing Write-Enabled MCP Tools: Seven Layers Beyond the Token

Why an MCP token does not authorize downstream writes, and the seven control layers, credential separation, exact-request approval and retry rules that do.

Publisher: REACTAPP.TOP8 min read1832 words

This article is published in English.

Sources: MCP Server Security for Write-Enabled Tools

A write-enabled MCP tool forces two separate authorization decisions. The first asks whether this client may connect to this server. The second asks whether this specific call may change this specific downstream resource. The Model Context Protocol settles the first at the transport layer. It does not decide whether a request such as PATCH /accounts/42 is an acceptable business action.

For that reason holding a valid MCP token should never amount to a general pass covering each tool, endpoint and payload behind the server. Consequential writes call for a narrow tool surface, deterministic downstream policy, an approval preview of the exact request, a separate credential for the target, and explicit execution state.

Connecting is not the same as being allowed to act

The current MCP authorization specification describes its scope as transport-level authorization for HTTP-based connections. It covers how a client obtains and presents a token to the server, including scope selection, resource indicators and token validation.

That is required, but it is only part of a write path. An MCP server may expose a tool that calls a second API, which has its own credential, resources, methods and business rules. The bearer token tells the server who is calling. Application code must still decide what that caller may do through it.

OWASP's guidance on excessive agency recommends complete mediation: permissions for actions are checked in downstream systems or in deterministic code, and an LLM is never asked to rule on whether its own requested operation is allowed.

Seven layers of control

An MCP integration cannot be secured with one permission check. Each layer answers a different question and needs its own control in production.

  • Transport. Question: may this client call this server? Control: check the token, tie it to its intended audience, insist on HTTPS and apply fitting scopes.
  • Tool catalog. Question: which capabilities does the model see? Control: expose only an explicit allowlist of tools, whether static or generated dynamically.
  • Tool arguments. Question: is this precise operation permitted? Control: validate the input schema and apply deterministic rules on destination, method, path and payload.
  • Human review. Question: should this consequential write go ahead now? Control: tie the approval to the exact request being reviewed, and not to a wide capability or some future action.
  • Target API. Question: which credential reaches the provider? Control: use a separate credential held on the server, with the narrowest provider scopes practical, and never show it to the agent.
  • Execution. Question: what happened after the request was released? Control: keep durable job state and the provider response, plus an explicit unknown-outcome state for cases where the result cannot be proven.
  • Environment. Question: can the agent route around the controlled path? Control: remove direct provider credentials and switch off alternative write connectors that skip the policy and approval boundary.

Strength is set by the weakest detour. A secure MCP tool has to govern transport, which capabilities are visible, the exact operation, approval, credentials, execution state and bypass routes.

A small, trusted tool surface

Some MCP servers expose tools that read data, transmit it, or take actions using credentials they are given. In OpenAI's Agents SDK documentation the advice is to connect only to servers you trust, use least-privilege credentials, put tokens in authorization headers instead of URLs, and require approval for sensitive operations.

Prior to attaching a server, list what every tool can read or modify, which credential it uses, whether the client is able to hide it, whether writes stop for review, and what evidence is left behind after a timeout.

Expose only what the workflow needs. A research agent has no use for a delete tool just because the server offers one. Filtering the tool list still falls short of authorization, though. A single update_record tool may accept many destinations and fields, so its arguments should be checked against a boundary defined by the owner.

Two kinds of credential

The MCP authorization security considerations require a server to verify that tokens were meant for it, and they forbid passing the client's MCP token through to an upstream API. When the server calls a third-party service, it should behave as a separate client holding its own upstream token.

  • The MCP token opens the server's published interface.
  • The target credential opens one particular business API.
  • Policy on the server narrows which target methods and resources an MCP caller can reach.

A target credential should never appear in model context, a tool schema, a tool result, a URL or logs. Where the provider offers scoped or temporary credentials, pick the smallest privilege and shortest lifetime that fit the job.

One gateway product keeps this split on its API-write path. The agent reaches the gateway over MCP or HTTP with a workspace API key, while the owner of the workspace sets up a distinct credential, either a bearer token or an API key, for the public HTTPS target. That credential is stored encrypted server-side and never comes back through agent discovery or job results.

Check the exact downstream request

Tool names and OAuth scopes are usually too blunt to describe a business transaction. A production write boundary needs to resolve and verify the connection ID, the HTTP verb, the normalized path, query string, body, connection version and the target destination.

In that same gateway, a single execute call submits one such request. Deterministic policy compares the method and path with the connection the owner configured. The operation then waits until a signed-in workspace owner reviews the exact preview. Editing the connection invalidates the older proposal, so a past decision never quietly executes something different.

The pattern leaves the reasoning with the calling agent and puts authorization outside it.

Prompt injection raises the stakes

MCP connects a model to more data and more capability, which increases the damage indirect prompt injection can do. Hostile instructions may arrive in a document, a web result, a tool description or a tool output, and not only in the user's visible prompt.

OpenAI's guidance on MCP and connectors points to approvals for sensitive actions, trusted servers, a close look at what data goes to remote servers, and logging, and it cautions that a remote server may alter its tool behavior or carry hidden instructions. OWASP's advice on prompt injection is to narrow what the model may do, check expected formats in plain code, grant least privilege, and bring in a human for high-risk operations.

Defenses at the prompt level are useful but should not be the last gate. A check by a model on whether a request seems reasonable can flag odd intent for a reviewer, yet it must not approve any method, path or destination that deterministic policy has denied.

Using new protocol features without overreading them

The 2026-07-28 MCP release brought authorization hardening and request headers such as Mcp-Method and Mcp-Name. Per the release notes, gateways and rate limiters can use these headers for routing and metering.

Where an implementation adopts that version, the headers can feed coarse policy at the infrastructure level. They cannot validate a tool body, show that a path is permitted, or authorize a downstream operation, so the server still has to confirm request consistency, check arguments and apply application policy.

Retries and unclear outcomes

Delivery over MCP, execution on the server and the downstream API call are three separate failure domains. After a timeout, the caller may be unable to tell whether the write took effect. A stable idempotency key on the submission helps, as does a provider key downstream when one is supported. The two controls work at different boundaries, and neither promises exactly-once behavior across every API.

When delivery becomes ambiguous, a sound design records an explicit unknown-execution state and suppresses automatic retries. The operator then reconciles the target's state before submitting another write. Likewise, an execution record is evidence of what the gateway observed and not independent proof of the provider's present state, a distinction worth keeping in security reviews and in claims made to customers.

Checklist before enabling a consequential tool

  1. Trust and tools: confirm where the server's code comes from and how it updates, and show the agent only the tools it needs.
  2. Transport: protect the client-to-server link with HTTPS and current MCP authorization requirements.
  3. Audience: make the server reject any token not issued for its own resource.
  4. Arguments: restrict destination and operation through schemas plus deterministic policy.
  5. Credentials: never reuse the MCP token downstream, and keep target secrets on the server.
  6. Approval and identity: pause writes with an exact preview, and ensure whoever submitted a request cannot approve it.
  7. Outcome: give success, failure, rejection and ambiguous delivery explicit states, with records that hold no secrets.
  8. Retries: deduplicate with stable keys and reconcile writes of unknown result before trying again.
  9. Bypass: remove direct keys, browser sessions and native write connectors, or accept them knowingly as alternate paths.

The last item is essential. A gateway controls only the writes routed through it. If an agent keeps an authenticated browser or a direct target credential, it can bypass the policy and approval path entirely.

Common questions

Does a valid MCP token authorize every downstream action? It does not. The token grants access to the server within that server's scopes, and each tool and each downstream resource still needs its own deterministic application policy.

Should every tool call require human approval? Not necessarily. A team may let bounded read-only tools run without per-call review. Consequential writes need a gate proportionate to the risk, and some products simply require owner approval for every write.

Can a gateway stop an agent from using a browser or a direct connector? No. It governs only calls routed through it. If the gateway is meant to be the enforced boundary, alternate credentials and write paths must be removed or restricted.

A sensible way to begin is with one operation, one target API and one accountable reviewer, building the smallest useful boundary around a single write before widening the surface.