RetailboxMessage us

MCP Security: 8 Risks of Connecting AI Agents to Your Tools, and How to Check Each

By Mikhail Oskola, Founder & AI Automation Architect · · 11 min read

Checked: The MCP specification and docs for protocol version 2026-07-28 (Tools, Security Best Practices, Local Server Security), Invariant Labs' posts on tool poisoning and the GitHub MCP attack, JFrog's write-up and GitHub's advisory for CVE-2025-6514, all read on 18 November 2026.

MCP (Model Context Protocol) is the standard way to give an AI agent tools: your CRM, your inbox, your files. MCP security comes down to three questions. Who does the server trust, meaning which tokens it accepts and passes on? What does the agent read, since tool descriptions and the data tools return can carry hidden instructions? And what can the server do on the machine it runs on? The protocol answers the first in writing: servers must not accept tokens that weren't issued to them. The second is on you and your client. The third depends on whether the server runs on your laptop or as a remote service. Checked against the MCP specification and docs for protocol version 2026-07-28 on 18 November 2026.

What MCP is, in one paragraph

An MCP server is a small program that offers an AI model a list of tools, each with a name and a description, such as "search contacts" or "send email". An MCP client, like a desktop AI app or an agent your team built, connects to the server, shows those tools to the model, and runs them when the model asks. One server can wrap your CRM, another your file share. Some run on your own computer as a local process; others are remote services you sign in to, usually through OAuth.

That is the appeal: connecting a tool is a config change, not a project. It is also where the risk sits. The model reads every tool description as instructions, and every server you add works with the access you gave it.

The 8 MCP security risks

The first two risks are about what the agent reads, and they apply to anyone who connects a server. Risks 3 to 6 are mistakes in how a server or client handles sign-in; you can't fix them yourself, but you can ask the vendor about them. Risks 7 and 8 are about how much access you hand over.

1. Tool poisoning: instructions hidden in a tool description

What it is. Invariant Labs, a security research firm, described it on 1 April 2025: "A Tool Poisoning Attack occurs when malicious instructions are embedded within MCP tool descriptions that are invisible to users but visible to AI models." In their demo, a harmless-looking tool told the model to read the user's SSH private key and the client's MCP config file and pass them along.

What it looks like. The tool works as advertised, and the instructions sit in the part of the description the model reads but the user doesn't see. MCP's own Local Server Security guide adds two variants: a description that steers how the agent uses another server's tools (tool shadowing), and a server that changes its descriptions after you approved it (a rug pull), so "a one-time consent dialog and package pinning do not cover this surface."

How to check. Read the full tool list before you rely on a server. The guide points to the MCP Inspector, which lists every tool a server exposes without a model involved. If a description contains instructions that have nothing to do with the tool's job, remove the server. Prefer a client that asks again when a tool definition changes; the guide notes the protocol doesn't require this.

2. Prompt injection through the data tools return

What it is. A clean server can still hand the model text written by an attacker: an email, a support ticket, a web page, a GitHub issue. If the model treats that text as instructions, it acts on them with every tool it has.

What it looks like. On 26 May 2025 Invariant Labs published an attack on the official GitHub MCP server. An issue in a public repository carried instructions. When a user asked the agent (Claude 4 Opus in Claude Desktop) to look at open issues, the agent "willingly pulls private repository data into context, and leaks it into a pull request" in the public repo. Invariant called it "not a flaw in the GitHub MCP server code itself, but rather a fundamental architectural issue." A patch to the server wouldn't have stopped it.

How to check. Look at which servers share one agent. If the same agent reads content strangers can write (public issues, inbound email, web pages) and holds a tool that can publish or send, that combination is the risk. Split them into separate agents, or limit the token to the repositories or folders the task needs. The tools part of the spec says there SHOULD always be a human in the loop who can deny a tool call; keep confirmation on for anything that sends, publishes or deletes.

3. Token passthrough

What it is. A server accepts an access token that was issued for some other service and forwards it to that service's API. MCP's Security Best Practices calls it an anti-pattern and says the authorization spec forbids it outright.

What it looks like. The server works, but it can't tell its callers apart, its own rate limits and checks are skipped, and the downstream API's logs show requests that seem to come from someone else. A stolen token can then use the server as a relay.

How to check. For a remote server you don't run, ask the vendor whether it validates the token's audience, meaning that the token was issued for the MCP server itself. The rule in the docs is one line: "MCP servers MUST NOT accept any tokens that were not explicitly issued for the MCP server."

4. Confused deputy in proxy servers

What it is. Some MCP servers sit in front of another company's API and sign in to it with one shared app identity (a static client ID). The Security Best Practices page walks through the attack: you approve the real connection once, the third-party site remembers that approval in a cookie, and later a crafted link sends a fresh sign-in request through the same proxy. The consent screen is skipped and the access code goes to the attacker's address.

How to check. Relevant if you connect through a server that proxies a third-party API, such as a hosted connector for a CRM or a calendar. Ask the vendor whether it asks for consent per client, not just once per user. The docs say proxy servers MUST do this, and MUST match the address that tokens are sent back to exactly, with no wildcards.

5. SSRF during sign-in discovery

What it is. When a client connects to a remote server that needs sign-in, it fetches several addresses that the server itself supplies. A malicious server can point those at internal targets: an admin panel on your network, a local database, or the cloud metadata address 169.254.169.254, which can hand out cloud credentials.

How to check. This matters most when the MCP client runs on a server, for example an agent hosted in your cloud account. The docs say such clients MUST consider this risk, SHOULD require HTTPS for sign-in addresses and SHOULD block private and reserved IP ranges, including the metadata range. If your team built the agent, ask whoever built it whether it does. An egress proxy that only allows known destinations covers this and several other risks.

6. State handle hijacking

What it is. As of protocol version 2026-07-28, MCP has no sessions at the protocol level. A server that needs to remember something between calls, like a cart or a workflow ID, hands out a handle and gets it back with the next request. If someone guesses or steals that handle and the server doesn't check who is presenting it, they can read or change another user's state.

How to check. A question for the server's builder: are handles random and tied to the signed-in user? The docs: "MCP servers MUST NOT treat possession of a state handle as authentication."

7. A compromised local server

What it is. A local MCP server is an ordinary program on your computer. MCP's Local Server Security guide is blunt: it inherits your environment variables and "can read anything your account can read — SSH keys, cloud credentials, browser profiles, your home directory", and can connect anywhere on the internet. The stdio transport most local servers use "is not a sandbox."

What it looks like. A typosquatted package, an abandoned project taken over by a new publisher, a compromised dependency, or a bad start command pasted into a config file. Or a legitimate bridge with a bug: CVE-2025-6514 in mcp-remote, a package that connects local clients to remote servers, let a malicious server run commands on the user's machine just by being connected to (CVSS 9.6, versions 0.0.5 to 0.1.15, fixed in 0.1.16).

How to check. Install only servers whose publisher you can identify and whose source you can read, and pin the version. Run third-party servers in a container with nothing mounted except the folder they work on. When a client offers one-click setup, read the command it shows you. The docs say such clients MUST show the exact command, untruncated, and get your explicit approval first.

8. Scopes and tokens that are too broad

What it is. A token granted every permission up front (the docs give files:*, db:* and admin:* as examples) turns a small leak into a full one. The same goes for local servers: a personal access token for your whole account, exported in your shell profile, is readable by every server you start.

How to check. Give each server its own token, with the smallest scope that works: one repository, one mailbox, read-only where possible. Pass it in that server's own config, not as a global environment variable. Revoke it when you remove the server.

Real MCP incidents so far

Three public cases that show the risks above are real, each from the researchers who found it. None needed a bug in the AI model.

WhenWhat happenedRiskSource
1 Apr 2025Hidden instructions in a tool description made the agent read the user's SSH private key and MCP config fileTool poisoningInvariant Labs
26 May 2025A malicious public GitHub issue led the agent to copy private repository data into a public pull request through the GitHub MCP serverPrompt injection through dataInvariant Labs
9 Jul 2025CVE-2025-6514 in mcp-remote: connecting to a malicious server could run commands on the user's machine; CVSS 9.6, fixed in 0.1.16Vulnerable local bridgeJFrog; GitHub advisory GHSA-6xpm-ggf7-wc3p

What the MCP specification and its security guide require

The requirements below are quoted or closely paraphrased from MCP's documents for protocol version 2026-07-28: the Tools section of the specification, the Security Best Practices page that complements the authorization spec, and the Local Server Security guide. MUST is a hard requirement; SHOULD is a strong recommendation.

  • Servers MUST NOT accept any tokens that were not explicitly issued for the MCP server (Security Best Practices, Token Passthrough).
  • MCP proxy servers MUST implement per-client consent and match each redirect address exactly, with no wildcards (Confused Deputy).
  • MCP servers MUST NOT treat possession of a state handle as authentication (State Handle Hijacking).
  • A client that offers one-click local server setup MUST show the exact command, without truncation, and require explicit approval before running it (Local MCP Server Compromise).
  • Servers MUST validate all tool inputs, implement access controls, rate limit tool calls and sanitize tool outputs (Tools, Security Considerations).
  • Clients MUST treat tool annotations as untrusted unless they come from trusted servers, and there SHOULD always be a human in the loop who can deny a tool call (Tools).

MCP security checklist before you connect a server

Run these for every server before it touches company data, and again when a server updates or you add another one to the same agent. Most of them need the app's settings screen and a conversation with whoever runs the server, not a developer.

8 checks before you connect an MCP server

  1. Name the publisher. Wrong if you can't tie the server to a real company or maintainer and a source repository, or the package name is one letter off from the one in the docs.
  2. Prefer remote when the server only wraps an internet API. MCP's own guide says such a server "gains nothing from running on your laptop". Wrong if a CRM or email connector ships only as a local process with no reason given.
  3. Read every tool description in full. Use the MCP Inspector or your client's tool view. Wrong if a description tells the model to read files, call other tools, or keep something from the user.
  4. Choose a client that re-asks when tools change. Wrong if a server can change its descriptions after you approved it and nothing tells you.
  5. Give the server its own narrow token. One token per server, the smallest scope that works, passed in that server's config. Wrong if it reuses a personal account-wide token or reads one from your shell profile.
  6. Separate reading from acting. Wrong if one agent both reads content strangers can write (public issues, inbound email, web pages) and can send, publish or delete without asking you.
  7. Contain local servers. Run third-party local servers in a container or sandbox with only the folder they need mounted, and pin the version. Wrong if a server runs as a bare process with access to your home directory and SSH keys.
  8. Ask remote vendors three questions. Do you validate that tokens were issued for your server? Do you ask for consent per client? Are state handles tied to the signed-in user? Wrong if the answer to any is "we're not sure".

Checked against the MCP specification and docs for protocol version 2026-07-28 (Tools, Security Best Practices, Local Server Security) on 18 November 2026. The protocol changes between versions: the 2025-11-25 version still had protocol-level sessions, for example.

Remote vs local MCP servers: which is riskier for a small team

Local is riskier for most small teams, because a local server runs with your account's access and the only fence around it is one you build yourself. MCP's guide puts it plainly: a remote server "runs no code on your machine, uses the protocol's authorization flow instead of a token in a local config file, and is patched in one place."

Remote isn't free of risk. You trade risks 7 and 8 on your laptop for risks 3 to 6 on someone else's server, and you can't inspect that server's code. You can still read its tool descriptions, keep its scopes narrow, and ask the three vendor questions above.

Our reading, not the spec's: run locally only what genuinely needs your files, a local tool or your local network. Everything that only talks to a web service should connect remotely, and if the vendor offers no remote version, ask why.

Where MCP fits in AI agent security

MCP covers how an agent gets its tools. It doesn't cover what the agent remembers, what it's allowed to decide on its own, or what happens when it writes something wrong. When we built FleetMemory, our own shared memory for AI agents, the red-team run went after the memory, not the tools: what our red-team run found in agent memory is a different layer of the same problem. For the whole picture, our guide to AI agent security risks walks through OWASP's ten risks for agentic applications, with one check for each.

If what you're securing is an app built with an AI coding tool rather than an agent, start with our vibe coding security checklist. Many of its checks, like one key per service and a spending limit on each, apply to MCP tokens too. If you're building an agent that connects to company systems, our AI agent development page covers where we put the human approval step.

Retailbox Automation runs security reviews of vibe-coded apps, AI agents and Zapier, Make and n8n automations. If your agents connect to company systems through MCP and you're not sure what they can reach, tell us which servers you use and what they connect to.

Sources

Frequently asked questions

Is MCP secure?+

The protocol sets security rules, but it can't make a server trustworthy. MCP's own Local Server Security guide says no check proves what a server will do. Your security depends on which servers you connect, what tokens you give them, whether they run locally or remotely, and whether one agent both reads untrusted content and can send or publish.

What is MCP tool poisoning?+

Tool poisoning is hiding instructions in an MCP tool's description. The model reads the full description, including parts the user doesn't see. Invariant Labs showed it in April 2025 with a tool that made the agent read the user's SSH key. A server can also change descriptions after you approve it, which MCP's guide calls a rug pull.

Can an MCP server steal my API keys?+

A local one can, if it's malicious or compromised. MCP's guide says a local server inherits your environment variables and can read anything your account can read, including SSH keys and cloud credentials. Give each server its own narrow token in its own config, and run third-party servers in a container.

Should we run MCP servers locally or remotely?+

Remotely, unless the server needs your files, a local tool or your local network. MCP's guide says a remote server runs no code on your machine, uses the protocol's sign-in flow instead of a token in a config file, and is patched in one place. A remote server still needs narrow scopes and a vendor you trust.

How do I check an MCP server before installing it?+

Identify the publisher and source repository, confirm the exact package name, and pin the version. Read every tool description in full, for example in the MCP Inspector. Give the server its own narrowly scoped token. Run a local server in a container, and use the remote version if the server only wraps a web API.

Ready to automate?

30-minute free call. We'll find your highest-ROI automation — no obligation.