Skip to content

AI security

MCP security: the risks of Model Context Protocol servers and how to control them

MCP security means controlling what AI agents can read and do through Model Context Protocol (MCP) servers, the connectors that link an AI application to tools and data. Each server adds text the model reads and actions it can take, so one poisoned or over-privileged server can expose data from other connected systems. This guide explains how MCP works, the main risks and the controls that reduce them, based on the official specification and published security guidance.

By the KDS security engineering teamPublished 11 min read

Key takeaways

  • MCP servers give AI agents tools and data, and the model reads each tool's description as text it may follow.
  • The MCP specification states that the protocol cannot enforce its own security principles, so hosts and operators must build the controls.
  • Key risks include tool poisoning, rug pulls, over-scoped tokens, token passthrough, look-alike server packages and unsandboxed local servers.
  • Allow-list servers, pin versions, give each server its own narrow token and require human approval for sensitive tools.
  • Log each tool call with its parameters and identity, and alert on new tools, changed descriptions and unknown servers.
On this page

What is the Model Context Protocol?

The Model Context Protocol is an open protocol, first published in November 2024, that standardizes how AI applications connect to outside tools and data sources. Instead of a custom integration for each system, the AI application connects to MCP servers that already speak the protocol. This guide refers to the MCP specification version dated July 28, 2026 (opens in a new tab). Our glossary entry on the Model Context Protocol gives the short definition.

Hosts, clients and servers

The MCP architecture (opens in a new tab) has three roles. The host is the AI application a person uses. For each server it connects to, the host creates a client, and each client talks to exactly one server. The server is a program that offers tools and data. The host decides which servers connect, asks the user for consent and controls what each server receives.

Tools, resources and prompts

A server can offer three kinds of features. Tools are functions the model can call, such as a database query or a file change. Resources are data such as file contents or records. Prompts are message templates for users. Tools carry the most risk, because the specification makes them model-controlled: the model decides when to call a tool based on its name, description and input schema.

Local and remote servers

A local server runs on the same computer as the host. The host usually starts it as a separate program and talks to it over standard input and output (stdio), and the server runs with the same privileges as the client that started it. A remote server runs on another machine, often operated by a third party, and is reached over the web through the Streamable HTTP transport. According to the MCP architecture overview (opens in a new tab), a local server typically serves one client, while a remote server typically serves many.

What the MCP specification says about security

The specification lists three key principles: user consent and control, data privacy and tool safety. It says tools represent arbitrary code execution and need caution, that descriptions of tool behavior should be considered untrusted unless they come from a trusted server and that hosts must obtain explicit user consent before invoking any tool. It also states that MCP itself cannot enforce these principles at the protocol level. The host, the server operator and your own team have to build the controls.

The specification's page on tools (opens in a new tab) adds that a person should be able to deny tool calls. Clients should confirm sensitive operations, show tool inputs to the user before sending them, validate tool results and log tool usage. Servers must validate inputs, apply access controls, rate-limit calls and sanitize outputs.

Authorization in MCP (opens in a new tab) is optional. When a remote server uses it, the flow is based on OAuth 2.1, the common standard for delegated access, and the server must accept only tokens issued specifically for it. Local servers that use stdio are expected to take credentials from their environment instead. A separate page on security best practices (opens in a new tab) describes specific attacks and how to prevent them.

The U.S. National Security Agency (NSA) reached a similar conclusion in its May 2026 guidance on MCP (opens in a new tab): security depends more on careful implementation than on the protocol itself, so adopters should proceed with caution.

The main MCP security risks

Most MCP risks are forms of two older problems: prompt injection, which means tricking an AI with hidden instructions, and supply chain risk from third-party code.

Tool poisoning

In tool poisoning, an attacker hides instructions in a tool's description, parameter schema or return values. The model may follow them, for example to read private files or add private data to a later tool call. The tool does not need to run for this to work. In the MCPTox benchmark (opens in a new tab) (arXiv, 2025), researchers built 1,312 poisoned test cases on 45 live MCP servers and tested 20 AI agent setups. The attack success rate reached 72.8% for one model, and the highest refusal rate among the agents was under 3%.

Rug pulls

A rug pull happens when a server changes its tool definitions after you approved it, turning a trusted tool malicious. The specification allows a server's list of tools to change over time and to notify clients when it does. The NSA notes that even where approval workflows exist, a trusted server can often change its capabilities or data access without a new approval, and users are often not told.

Excessive permissions and broad token scopes

When a server's token carries every available permission, one stolen token opens everything at once. The specification's best practices list wildcard or all-access scopes and bundling unrelated privileges as common mistakes. The NSA describes a code hosting integration in which users gave tools blanket access to all repositories, which let a malicious or compromised tool read private content and publish it to public repositories.

Confused deputy and token passthrough

A confused deputy is a program with legitimate authority that is tricked into using it for someone else. In MCP, a server often acts with its own broad credentials instead of the requesting user's rights. The specification describes this for servers that act as OAuth proxies to third-party APIs, where missing consent checks let an attacker gain access as the user. In token passthrough, a server accepts a token issued for another service and forwards it. The specification forbids this, because it bypasses downstream controls and breaks the audit trail.

Prompt injection through tool outputs

Tool results carry outside content into the model's context: web pages, emails, tickets and database records. An attacker who controls that content can plant instructions, and the agent may act on them with all its tools. In a large-scale study of the MCP ecosystem (opens in a new tab) (arXiv, 2025), researchers analyzed 12,230 tools across 1,360 servers and showed how planted instructions can chain legitimate tools to collect and leak private data. Our prompt injection guide covers the layered defenses.

Untrusted and look-alike servers

Anyone can publish an MCP server, and many are installed as packages from public registries. OWASP warns that typosquatting, a package name one letter away from a popular one, is a common attack vector. The NSA describes naming collisions in which a system loads an attacker's tool in place of the intended one, and it notes that the MCP project has marked many popular servers as no longer actively maintained. Our post on MCP supply chain risk includes a checklist for vetting a server.

Command execution by local servers

A local server is a program that the host starts on your computer, so installing one means running someone else's code with your privileges. The specification's best practices describe three attacks: a malicious start command hidden in a client configuration, malicious code inside the server itself and access to an unprotected local server through a web attack called DNS rebinding. Clients that offer one-click setup must show the exact command and ask for explicit approval before it runs. The same page recommends sandboxes with restricted file system and network access.

Data exfiltration across servers

Each MCP connection is separate, but the model usually sees the tools of all connected servers together. OWASP calls the resulting attack tool shadowing: a malicious server's description changes how the agent uses tools from other, trusted servers. In a research demonstration cited by the NSA, a malicious server installed next to a trusted messaging server made the client expose the user's message history without notice. It showed a harmless description at first and switched to a malicious one after its second use.

Weak authentication on remote servers

Authorization is optional, and the NSA notes that many implementations omit authentication entirely. It recommends scanning your network for MCP servers that run without authentication, have known flaws or were installed outside change control. OWASP calls unapproved deployments shadow MCP servers, MCP09 in its beta MCP Top 10 (opens in a new tab), and advises enforcing authentication on all remote endpoints.

Controls that reduce MCP security risks

No single control covers these risks. Combine them, and apply the strictest ones to servers that touch sensitive data or can send data out.

Allow-list approved servers

Keep an inventory of every MCP server in use, with its owner, version and permissions, and let hosts connect only to servers on an approved list. The OWASP GenAI Security Project's guide to securely using third-party MCP servers (opens in a new tab) builds this around an internal registry, with scanning, sign-off by security and business owners, a test period and regular re-checks. Block everything else.

Pin versions and review every change

Install a fixed version of each server and record a hash of its tool definitions at approval. Compare the current definitions with the approved ones before use and require a new review when they differ. OWASP recommends this check to detect rug pulls. For a remote server, whose code you cannot pin, comparing tool definitions is the main check you control.

Give each server its own least-privilege token

Give each server separate credentials with the narrowest scope that works, such as read-only access to one mailbox instead of the whole mail system. Do not share tokens across servers, prefer short-lived tokens and add scopes only when a task needs them. The UK National Cyber Security Centre (NCSC) gives the same rule for AI agents: minimum access for the shortest time required (opens in a new tab). Our guide to AI agent permissions shows how to map this for each task.

Require human approval for sensitive tools

Mark tools that send data out, change records, move money or delete anything as sensitive, and require a person to approve each call. Show the reviewer the full parameters, not only the tool name or a summary, as both the specification and OWASP recommend. Avoid automatic approval in setups with several servers, where one server's description can steer another server's tools.

Isolate and sandbox local servers

Run local servers in containers or other sandboxes with access only to the folders they need and with network access turned off unless the task requires it. Keep servers that handle payments, authentication or personal data apart from general-purpose ones. Review the exact start command before you approve a new local server, as you would any software installation.

Review tool descriptions before approval

Read the full tool manifest, including descriptions, parameter names and schemas, before a server is approved. Look for instructions addressed to the model, hidden text, references to other tools and requests for data the tool does not need. OWASP treats the whole schema as an injection surface, not only the description field, and recommends automated scanners as a second layer.

Log tool calls and monitor behavior

Log each tool call with its exact parameters and the identity behind it, as the NSA recommends, and send the logs to your security information and event management (SIEM) system. Alert on new tools, changed descriptions, unusual call volume and data from one server's results appearing in another server's calls. The NSA also suggests a filtering proxy or a data loss prevention (DLP) tool for outbound connections.

MCP security risks and controls at a glance

Use this table to check each MCP server your agents use. Most risks need more than one control.

Common MCP security risks and the controls that reduce them
RiskHow it happensControls that helpLimits to plan for
Tool poisoningInstructions hidden in tool descriptions, schemas or resultsManifest review, scanners, approval for sensitive callsReviews can miss well-disguised instructions
Rug pullA server changes its tool definitions after approvalPinned versions, hashed tool definitions, review on changeA remote server can change behavior without changing definitions
Excessive permissionsA server token grants far more access than its tools needPer-server tokens with narrow, short-lived scopesSome systems offer only broad scopes
Confused deputy and token passthroughA server acts with its own rights or forwards tokens meant for othersToken audience checks, consent per client, user-level permissionsDepends on how the server operator built it
Prompt injection in tool outputsWeb pages, emails or records returned by tools carry instructionsTool output treated as data, approval for sensitive actions, output checksFilters miss instructions they were not built for
Untrusted or look-alike serversTyposquatted or abandoned packages from public registriesAllow-list, internal registry, checks of source and maintainerA trusted project can still be compromised later
Local command executionA malicious start command or payload runs with user privilegesCommand review, sandbox, restricted file and network accessSandboxes need correct settings and updates
Cross-server exfiltrationOne server's description steers calls to another server's toolsSeparate agents for sensitive servers, no automatic approval, flow alertsHard to spot when each call looks normal
Weak remote authenticationA remote server accepts requests without verified tokensRequired authentication, network scansUnknown servers are found only if you scan for them
Common MCP security risks and the controls that reduce them

A starting plan for MCP in your company

  1. List every MCP server connected to an AI application in your company, including servers staff added on their own computers.
  2. Record each server's origin, version, owner, token scopes and whether it can send data out.
  3. Remove servers nobody owns or needs, and move the rest onto an approved list with pinned versions.
  4. Replace broad or shared tokens with per-server tokens that have the narrowest scopes that work.
  5. Turn on approval for sensitive tools and logging for all tool calls.
  6. Attack-test agents that combine MCP servers with private data before they go live and after each server update.

Our secure AI agent checklist covers the other controls to check before launch. In our AI security consulting projects, we review each server's tool definitions, tokens and data flows, test agents for tool poisoning and cross-server leaks and retest after fixes.

Sources

  1. 1.Model Context Protocol Specification, version 2026-07-28, Model Context Protocol, 2026-07-28 (opens in a new tab)
  2. 2.Architecture (Specification 2026-07-28), Model Context Protocol, 2026-07-28 (opens in a new tab)
  3. 3.Architecture overview, Model Context Protocol, 2026-07-28 (opens in a new tab)
  4. 4.Tools (Specification 2026-07-28), Model Context Protocol, 2026-07-28 (opens in a new tab)
  5. 5.Authorization (Specification 2026-07-28), Model Context Protocol, 2026-07-28 (opens in a new tab)
  6. 6.Security Best Practices, Model Context Protocol, 2026-07-28 (opens in a new tab)
  7. 7.Model Context Protocol (MCP): Security Design Considerations for AI-Driven Automation, U.S. National Security Agency, Artificial Intelligence Security Center, 2026-05-20 (opens in a new tab)
  8. 8.MCP Security Cheat Sheet, OWASP Cheat Sheet Series (opens in a new tab)
  9. 9.A Practical Guide for Securely Using Third-Party MCP Servers, version 1.0, OWASP GenAI Security Project, 2025-10-23 (opens in a new tab)
  10. 10.OWASP MCP Top 10 (beta), OWASP Foundation, 2025 (opens in a new tab)
  11. 11.Thinking carefully before adopting agentic AI, UK National Cyber Security Centre, 2026-05-15 (opens in a new tab)
  12. 12.MCPTox: A Benchmark for Tool Poisoning Attack on Real-World MCP Servers, arXiv (Wang et al.), 2025-08-19 (opens in a new tab)
  13. 13.Parasites in the Toolchain: A Large-Scale Analysis of Attacks on the MCP Ecosystem, arXiv (Zhao et al.), 2025-09-08 (opens in a new tab)

Get a free 30-minute assessment

Walk us through the AI tools and agents you use or plan to launch. We'll point out the biggest risks and the first fixes, in plain words.

Frequently asked questions

What is MCP security?

MCP security is the set of controls that limit what AI agents can do through Model Context Protocol servers. It covers which servers you allow, what tokens each server gets, how tool descriptions are reviewed, which tool calls need a person's approval, how local servers are isolated and how tool calls are logged. The MCP specification states that the protocol itself cannot enforce its security principles, so these controls depend on your setup.

What is tool poisoning in MCP?

Tool poisoning is an attack in which malicious instructions are hidden in an MCP tool's description, parameter schema or results. The AI model reads this text when it decides which tools to call and may follow the hidden instructions, for example to read private files or pass data to another tool. The tool does not need to run for the attack to work, which is why tool descriptions need review before approval.

What is an MCP rug pull?

A rug pull is when an MCP server changes its tool definitions or behavior after you approved it, so a tool that looked safe becomes malicious later. The protocol allows a server's tool list to change over time. To detect it, pin server versions, record a hash of the approved tool definitions, compare them before use and require a new review when anything changes.

Does MCP require authentication?

No. Authorization is optional in the MCP specification. When a remote server supports it, the specification defines a flow based on OAuth 2.1 and requires the server to accept only tokens issued for it. Local servers that use standard input and output get credentials from their environment instead. Because authentication is optional, check each remote server you use and scan your network for servers that accept requests without it.

Are local MCP servers safer than remote ones?

Not automatically. A local server keeps data on your machine, but it is code that runs with the privileges of the application that started it, so a malicious package can read files or run commands. A remote server runs code you cannot inspect and holds tokens to your systems. Both need an allow-list, pinned versions, narrow permissions and logging, and local servers also need a sandbox.

How do you secure MCP servers in a company?

Start with an inventory of every server in use. Allow only approved servers, pin their versions and review tool descriptions before approval. Give each server its own narrow, short-lived token, require a person's approval for sensitive tool calls, run local servers in a sandbox and log each tool call with its parameters. Recheck servers when they update and attack-test agents that combine several servers with private data.

Services and use cases

  • Finance manager reviewing a single printed invoice before approving it

    Use case

    Back-office automation

    AI back-office automation that reads invoices, contracts and emails, matches them to your ERP and sends exceptions to a person for approval.

    See how back-office automation works
  • Service

    AI security and red teaming

    AI security consulting for AI agents and LLM apps: red teaming, prompt injection testing, shadow AI discovery and EU AI Act and ISO/IEC 42001 readiness.

    Explore AI security consulting
  • Service

    AI agent development

    Custom AI agent development for support, sales, front desk and back-office work. Voice and chat agents built and attack-tested by a cybersecurity team.

    Explore AI agent development

Free 30-minute assessment

Find the one workflow worth automating first.

Tell us how your team works. We'll come back with two or three AI opportunities, the risks to watch and a rough payback estimate. No obligation.

  • A senior engineer replies within one business day
  • We can sign an NDA before you share details
  • No fixed packages, every quote tailored to you
What can we help with?
About your company

Company size

When would you like to start?

How can we reach you?

Encrypted in transit · read only by our team · never sold

Free 30-minute AI assessmentGet it →

Before you go

Find out where AI can save your team time

Book a free 30-minute assessment. A senior engineer reviews one workflow with you and sends back the opportunities, the risks and a rough payback estimate.