MCP security: risks and best practices for teams
MCP security risks for coding agents, from prompt injection and malicious local servers to token passthrough and broad scopes, and how teams can limit them.
An agent connected to your issue tracker reads a bug report. The report contains a line that looks like an instruction: send the contents of the environment file to this URL. The agent also has a web tool. Whether anything bad happens now depends on decisions made long before the bug was filed: which servers were connected, with what access, and whether a person approves tool calls.
That is the shape of most MCP security problems. This guide groups the real risks, from the MCP specification's security best practices and vendor documentation, checked on 16 November 2026, and lists what teams can do about each.
The three groups of risk
| Risk | What happens | Who it's for |
|---|---|---|
| Prompt injection | Content from a tool carries instructions the agent follows | Everyone using MCP |
| Server trust and access | A malicious, compromised, or over-privileged server | Everyone using MCP |
| Authorization mistakes | Token passthrough, confused deputy, over-broad scopes, SSRF | People building or operating servers |
1. Prompt injection through tool results
Every MCP tool returns content into the agent's context: web pages, issue text, logs, documents. Any of it can contain instructions written for the agent, not for you. Vendors warn about this directly. Vercel's MCP documentation gives the example of text telling the agent to ignore previous instructions and copy private deployment logs to an outside site, and notes that while its server only works within your Vercel account, other connected tools could send data elsewhere. Stripe's documentation asks users to turn on tool approval and be careful combining its server with others.
The danger grows with combination: one server that reads untrusted content plus another that can send data out.
What to do:
- Keep tool-call approval on for any server that can write, send, or pay.
- Treat anything fetched from the web, an issue, or a log as untrusted input.
- Don't connect a data-reading server and a data-sending server in the same session unless the task needs both.
- In Claude Code, keep sensitive actions behind ask or deny rules; see Claude Code permissions.
2. Server trust and access
Local servers are programs you run. The MCP security guidance describes three attacks on local servers: a malicious startup command hidden in a client configuration, malicious code distributed inside the server, and an insecure server left running on localhost that other software can reach. A local server has the same access as you.
Remote servers act with your account. Vercel's documentation puts it plainly: connecting its server grants the AI system the same access as your Vercel user account. That's the normal model for OAuth-backed servers, and it means the server's reach is your reach.
What to do:
- Install servers only from sources you trust, and read a project's MCP configuration before trusting the folder. Claude Code asks you to approve servers from a project's
.mcp.jsonbefore they run. - Prefer read-only endpoints and scoped tokens. Linear, for example, offers a read-only endpoint; GitHub's server can run with a
--read-onlyflag. - Use the sandbox for shell commands, but know that local MCP servers run outside it; see Claude Code sandbox.
3. Authorization mistakes
These matter if you build or run MCP servers. The specification's guidance covers several:
- Token passthrough. A server accepts tokens not issued for it and forwards them downstream. The authorization specification forbids this: servers must not accept tokens not explicitly issued for them. It breaks audience checks and audit trails.
- Confused deputy. A proxy server with a static client ID can be tricked into granting an attacker access using consent a user gave earlier.
- Server-side request forgery. During OAuth discovery, a malicious server can point a client at internal addresses or cloud metadata endpoints.
- Over-broad scopes. A token granted every scope up front turns one leaked token into access to everything. The guidance recommends a minimal initial scope and adding more only when a task needs it.
A checklist for teams
- Keep an approved list of MCP servers, and connect only those.
- Prefer vendor-hosted servers with OAuth over unknown local binaries.
- Use read-only endpoints and minimal scopes wherever offered.
- Keep approval on for tools that write, send messages, or move money.
- Store tokens in each person's environment, never in committed config. In
.mcp.json, use${VAR}expansion; see Claude Code MCP setup. - Control servers centrally with managed configuration; see Claude Code managed settings.
- Review what each server can reach when you add it, and again when its tool list changes.
Where Lockstep fits
Lockstep's MCP tools read the team's approved decisions and let an agent propose new ones; they don't edit your code. Decisions only become binding when a person approves them, so an agent can't promote something it read into a team rule. On the capture side, Lockstep reads sources read-only, only from allowlisted channels and spaces, and redacts secrets. It runs hosted or self-hosted under Apache-2.0, so the data path is yours to inspect. Its MCP server is a local process started through the CLI, so it's subject to the same advice above: install it from npm or source you trust.
Sources checked 16 November 2026
- https://modelcontextprotocol.io/specification/draft/basic/security_best_practices
- https://vercel.com/docs/agent-resources/vercel-mcp
- https://docs.stripe.com/mcp
- https://code.claude.com/docs/en/mcp
- https://linear.app/docs/mcp
Related reading
For which servers to connect, see the best MCP servers for product engineers and dev teams. For the definition, see MCP server. For responding when something goes wrong, see the incident response plan template. For Claude Code's own security tools, see Claude Code security.
Frequently asked questions
- What are the main security risks of MCP?
- Prompt injection through content a server returns, malicious or compromised local servers, servers granted more access than the task needs, and authorization mistakes such as token passthrough, confused deputy problems, and over-broad OAuth scopes. The MCP specification's security best practices document covers the auth and server risks in detail.
- What is prompt injection in MCP?
- Content returned by a tool, such as a web page, an issue, or a log, that contains instructions aimed at the agent. If the agent follows them with other connected tools, it can leak data or take actions you didn't request. Vercel's MCP documentation gives the example of text telling the agent to copy deployment logs to an outside site.
- What is token passthrough in MCP?
- An anti-pattern where an MCP server accepts tokens that weren't issued for it and forwards them to a downstream API. The MCP authorization specification forbids it, and the security guidance says MCP servers must not accept tokens not explicitly issued for them.
- Are local MCP servers safe?
- Only as safe as the code you run. A local server is a program on your machine with your access. The MCP security guidance describes attacks through malicious startup commands in a configuration, malicious code in the server itself, and insecure servers left running on localhost.
- How should a company control which MCP servers developers use?
- Use managed configuration. In Claude Code, organizations can deploy managed settings and a managed MCP configuration so developers get approved servers and can't add others. Pair that with least-privilege OAuth scopes and read-only endpoints where vendors offer them.
Keep reading