Live on Product Hunt Intraface launched today. Less steering, more vacations. See the launch
Start for free

What is MCP security?

MCP security is the set of risks and controls around letting an AI agent talk to MCP servers: who the server is, what its tools may do, which token it accepts, and whether content coming back can steer the model. The spec's security best practices name the attacks and the fixes: confused deputies, token passthrough, hijacked handles and more.

Part of Glossary: the terms behind MCP, coding agents and shared pages, defined plainly.

How it works

Three trust boundaries: you approve what the agent does, the server accepts only tokens issued for it, and whatever comes back is data, not instructions.you approveeach risky calltoken issuedfor this server onlyyouMCP clientyour agentMCP serverupstream APIits own credentialresults are data,never instructionsallow, denytools/call + tokenserver's own sign-inuntrusted content
  1. Decide whether to trust the server. A local one runs with your privileges, so read the exact command a one-click install will run. A remote one acts as you.

  2. Sign in with a token issued for that server alone. The server checks the audience and never forwards your token to another API.

  3. Treat everything a tool returns as untrusted input to the model. A hidden instruction in a web page or ticket can steer the agent's next action.

  4. Keep a person in the loop for calls that write, send or delete, and grant the smallest scopes first, stepping up only when a tool needs more.

  5. Harden the transport: validate the Origin header, bind local HTTP servers to 127.0.0.1, require HTTPS, and bind any state handle to the signed-in user.

Source: MCP specification: security best practices

MCP security versus AI agent security

Agent security asks what an autonomous model may do at all: which files it can touch, whether it can run shell commands, whether a person reviews a destructive step. MCP security is the slice of that at the joint between the agent and each tool it reaches over the protocol. It has three parts. Identity: is this the server I meant, and is the token I am sending meant for it? Authority: which of its tools may run, with which scopes, and does anyone get asked? Content: when a result comes back, is it treated as data or as an order?

The protocol fixes the first two with rules an implementer can follow. The third it can only warn about. A tool result is text the model will read, and text can say "ignore your previous instructions". The spec puts the burden on hosts: show tool inputs before they are sent, ask before sensitive operations, validate results before the model sees them, and treat a tool's own annotations as untrusted unless the server is.

Example: the confused deputy

A proxy server sits in front of a third-party API and signs in to it as one fixed OAuth client for everyone. You use it once, approve the consent screen, and the API's authorization server leaves a consent cookie in your browser. An attacker then sends you a link that starts a new authorization request through the same proxy, with a redirect pointing at the attacker's own address. Your browser carries the cookie, the consent screen is skipped, and the code lands with the attacker, who trades it for access to the API as you.

The fix the spec requires is a consent step owned by the proxy, shown before it forwards anyone to the third party, naming the client, the scopes and the redirect address, and stored per client. It is a good illustration of the whole field: nothing was broken in OAuth, the model never saw anything, and a person still lost an account to a server that forwarded too readily.

Why it matters

An agent with MCP servers attached is a person with their credentials spread across a dozen services, acting at machine speed, reading untrusted text all day. Each server you add widens what a single bad result can reach. The controls are cheap individually: audience-checked tokens, scopes that start small, a confirmation before writes, servers bound to localhost, the exact install command shown before it runs. They are only expensive when skipped, because the failure is an agent that did exactly what it was told by the wrong party.

Common mistakes

  • Accepting any token that looks valid. A server must verify the token was issued for it. One token honoured by three services means one leak reaches all three.
  • Installing a local server from a one-click link without reading the command. It runs with your privileges. The spec requires clients to show the full command and get consent; do not click through it.
  • Requesting every scope up front. A stolen broad token is a stolen account. Ask for the minimum and let the server challenge for more with insufficient_scope.
  • Trusting a session or handle as proof of identity. Possession of an id is not authentication. Servers key state as user plus handle and check the user on every request.
  • Reading tool output as if a colleague wrote it. It came from a service you do not control, possibly quoting a web page an attacker wrote. The model should act on it only within what you already approved.

FAQ

What are the main MCP security risks?
The spec's list: a proxy server acting as a confused deputy, token passthrough, server-side request forgery during OAuth discovery, hijacked state handles, malicious local servers, dangerous authorization URLs, authorization server mix-ups, and over-broad scopes. On top of those sits prompt injection through tool results, which the protocol cannot prevent on its own.
Is MCP security different from AI agent security in general?
MCP security is the part of agent security that lives at the connection between agent and tool: identity, tokens, transport, consent. Agent security also covers the model's own judgement, the sandbox it runs in, and what it is allowed to do with files and the shell. You need both; a perfect MCP setup still lets a tricked model call a legitimate tool.
Does using OAuth make an MCP server secure?
It settles who is calling, which is one piece. It says nothing about whether the server's tools are safe to run, whether its results carry injected instructions, or whether a local server was installed with a malicious startup command. OAuth is necessary for a remote server and sufficient for nothing.

Stop sending HTMLover Slack.

Create an account in a minute, connect your coding agent, and make your first board.