All posts

    MCP security

    MCP Security: Top Risks, Attack Vectors, and Best Practices for 2026

    Understand MCP tool poisoning, excessive permissions, malicious servers, and unsafe tool calls, with practical controls for enterprise AI workflows.

    Harden MCP Security banner with connected code, database, infrastructure, and cloud icons, titled Top Risks, Attack Vectors, and Best Practices for 2026.

    Executive summary

    MCP connects AI agents to tools and enterprise data, creating boundaries that authentication alone cannot secure. This guide explains four attack vectors: prompt injection and tool poisoning, excessive access, malicious servers, and unsafe tool calls. Effective protection combines server inventory, scoped credentials, process restrictions, checks before sensitive actions, and decision records that teams can test in realistic workflows.

    AI agents are becoming part of everyday enterprise workflows. They search documentation, inspect code, query databases, and trigger operational workflows. The Model Context Protocol (MCP) makes these connections easier to build.

    An approved, authenticated MCP server can still enable an agent to expose confidential data or disrupt a system.

    MCP security must address what agents can do, what information influences them, and how unsafe actions are stopped before execution.

    What is MCP security, and where does the risk come from?#

    The Model Context Protocol is a standard for connecting AI applications to external tools and sources of context. An MCP server can expose tools for tasks such as searching a repository, retrieving a customer record, or executing a database query. An AI application discovers those capabilities and, when appropriate, invokes them with arguments.

    The server's code, tool descriptions, returned data, and downstream systems each introduce a trust boundary.

    For example, giving an agent access to a repository integration may be necessary to investigate a bug. It does not follow that the same agent should be able to change a protected workflow or send a credentials file to an outside service. Authentication tells the system who is connecting; it does not establish whether every proposed operation is appropriate for the task.

    Enterprise MCP security combines server integrity, credential controls, prompt-injection defenses, and action-level enforcement.

    Four MCP attack vectors enterprises need to understand#

    1. Prompt Injection and MCP Tool Poisoning#

    AI agents read content they did not create: issue comments, webpages, retrieved documents, and MCP tool responses. An attacker can place instructions inside that content and attempt to make the agent treat them as part of its assignment. Consider an agent diagnosing a failed build. A retrieved issue comment claims that troubleshooting requires uploading a local .env file to an external diagnostic endpoint. The comment is data, not an authorized instruction. If the agent follows it, legitimate file and network tools can be misused without either tool being compromised.

    MCP tool poisoning can target a server's tool descriptions or responses, including changes made after initial approval. Teams should treat returned content and tool metadata as lower-trust inputs, track changes to available capabilities, and avoid relying on prompts as the only boundary.

    2. Overprivileged Access and Insecure MCP Authorization#

    An MCP integration may receive more access than necessary: repository write privileges for read-only work or production database access for a test task. Unnecessary privileges amplify failures.

    Remote MCP deployments also need careful token handling. Access tokens should be validated for the intended resource, with appropriate issuer, audience, and scope checks. A server should not blindly pass a client's token to another service. The MCP authorization documentation describes the protocol's authorization model, but downstream services still need to enforce their own permissions. Least privilege must apply to the actual resource, not simply to the connector's name.

    3. Malicious MCP Servers and Supply-Chain Risks#

    A local MCP server is executable software on a developer's machine. Depending on its environment, it may access files, read environment variables, or launch other processes. A compromised package or dependency can therefore expose information independently of the agent's visible tool calls. A remote MCP gateway may govern requests that pass through it, but it cannot automatically control every operation performed by a local server process.

    Inventory server origins, versions, credentials, and accessible resources. Package review, approved configurations, version management, and operating-system restrictions are as important here as they are for other privileged developer tooling.

    4. Dangerous Tool Calls and Data Exfiltration#

    A legitimate tool can still be used in an unsafe way. An execute_query tool might run a bounded SELECT or a destructive DELETE. An upload tool might transfer a public build artifact or a private key. A shell command might run tests or pipe an unknown script directly into an interpreter.

    Tool-name allowlists miss those distinctions. Controls should inspect arguments, destinations, resources, and policy. When a step is sensitive or irreversible, an alert after execution is not a substitute for a decision before execution.

    MCP security best practices for enterprise environments#

    Maintain Visibility into MCP Servers#

    Start with visibility. Maintain an inventory of approved local and remote MCP servers, including their owners, exposed tools, versions, downstream systems, and permissions. Update it as developers adopt new coding agents and integrations. Approved AI assistants do not imply approved MCP servers.

    Apply Least Privilege and Secure MCP Authorization#

    Then narrow access. Give read-only tools read-only credentials, limit database access to relevant schemas, and restrict filesystem and network permissions. Separate development from production identities wherever possible. For remote MCP servers, apply resource-specific authorization and validate tokens at the service that receives them. For local servers, constrain the process as well as its API access. This limits damage from compromised agent behavior.

    Enforce Policies Before Sensitive Actions Execute#

    Next, enforce rules where actions occur. A policy should distinguish reading a staging log from deleting a production namespace, or uploading an approved artifact from transmitting a credentials file. Some controls belong at the gateway, some at the destination service, and some at the developer endpoint. The right combination depends on where an agent actually invokes tools. MCP gateways, sandboxing, and endpoint enforcement protect different boundaries and should not be treated as interchangeable.

    Maintain Auditable Security Decision Records#

    Keep decision records that are useful to security teams. For relevant actions, capture the tool or operation, target, policy decision, and outcome, while minimizing storage of secrets and source content. Distinguish blocked actions from those merely observed.

    Validate MCP Security Controls with Realistic Workflows#

    Finally, validate the controls with realistic workflows. In a disposable environment, use synthetic secrets and a legitimate development task, then introduce untrusted content requesting an unauthorized upload or destructive operation. Check that the dangerous step is stopped without unnecessarily interrupting the original task. Retest after agent, server, or policy changes.

    Securing MCP-enabled coding agents with Harden#

    MCP server authentication and access controls are necessary, but enterprises also need to govern what coding agents actually execute. Harden AIF adds a local-first, pre-execution security layer to supported agents, including Claude Code, Codex, and Cursor. It checks covered tool calls against security policies before they run, helping prevent destructive commands, sensitive-data exposure, and actions outside the organization's boundaries.

    Security teams can apply consistent policies across supported agents and use decision records for visibility and audit workflows. The documented enterprise MDM walkthrough covers managed Apple Silicon Macs and Jamf Now; teams using other MDM tools should confirm the supported deployment procedure with Harden. Checks run locally on developer machines, so source code does not need to be routinely sent to an external security service for evaluation. Optional organization activity capture and cloud delivery are separate settings that teams should review for their deployment. Harden complements MCP server and identity controls; coverage depends on the specific agent integration and actions it exposes.

    Enterprises can get started with Harden or book a call with the team to discuss their environment.

    Frequently asked questions about MCP security#

    What are the biggest MCP security risks?#

    The main risks include prompt injection, MCP tool poisoning, excessive tool permissions, insecure token handling, malicious server packages, and unsafe tool execution. The common issue is that a connection or tool may be trusted more broadly than the task requires.

    How can enterprises prevent MCP prompt injection?#

    Treat retrieved content, tool responses, and tool descriptions as untrusted input. Restrict the privileges available to each server and agent, review changes to tool capabilities, and enforce sensitive actions outside the model. No prompt instruction alone can reliably prevent every attempted injection.

    Are MCP servers secure by default?#

    No. MCP defines how applications and servers communicate; the security of a deployment depends on server code, configuration, authorization, credential scope, and controls on downstream actions. A server's presence in an approved catalog does not make every operation safe.

    Is an MCP gateway enough to secure AI coding agents?#

    Not by itself. A gateway can enforce policy on traffic it sees, but some coding-agent operations, local server activity, shell commands, and file changes can occur outside that path. Enterprises need controls at the points where those actions actually execute, alongside gateway and identity protections.

    What is the difference between MCP security and AI agent runtime security?#

    MCP security focuses on the protocol's servers, connections, tools, and associated permissions. AI agent runtime security focuses on the actions an agent attempts during execution, whether they use MCP or another interface. Enterprises often need both to protect complete development workflows.

    Secure the action, not just the connection#

    MCP makes AI agents more useful by connecting them to the systems where work happens. Those connections also bring untrusted information and powerful tools into the same workflow. Enterprise security depends on knowing what agents can reach and ensuring their next action is authorized for the task.

    Agents should keep working within boundaries that hold when the next tool call matters most.