Skip to content
Code To Cloud
7 min read

MCP Server Security: Risks and Best Practices

The risks the MCP specification names, from token passthrough to confused deputies, and the controls that address them in Azure and GitHub Copilot.

By Kevin Evans

"MCP server security" searches come with "best practices", "risks", "testing" and "scanner" attached. The Model Context Protocol (MCP) is how AI agents, including GitHub Copilot and agents built in Microsoft Foundry, connect to tools and data. Every MCP server you add is a new way for an agent to act, so it's worth knowing the risks the protocol's own authors call out.

This post uses the MCP specification as the primary source, with Microsoft and GitHub documentation for the controls.

What's Inside

  • The attacks the MCP security best practices name
  • What the authorization rules require of servers
  • Human approval and untrusted tool descriptions
  • Controls in Azure API Management and GitHub Copilot

The risks, in the specification's words

The MCP security best practices page lists these attacks and their mitigations (1):

  • Confused deputy. A proxy server with a single client ID can be tricked into granting one client access approved for another. Proxies "MUST implement per-client consent."
  • Token passthrough. "MCP servers MUST NOT accept any tokens that were not explicitly issued for the MCP server."
  • Server-side request forgery (SSRF). A malicious server can point a client at internal addresses, including cloud metadata endpoints, through OAuth metadata URLs.
  • State handle hijacking (called session hijacking in earlier versions). "MCP servers MUST NOT treat possession of a state handle as authentication."
  • Local MCP server compromise. The specification tells clients to "warn that MCP servers run with the same privileges as the client."
  • Scope creep. Publishing every possible scope is listed as a common mistake. Ask for the least you need.

Authorization: tokens must be for this server

For servers on HTTP, MCP authorization is built on OAuth 2.1 and resource indicators (2). The rules that matter most:

  • "MCP servers MUST validate that access tokens were issued specifically for them as the intended audience."
  • Servers "MUST NOT accept or transit any other tokens."
  • Clients must name the server they want a token for, using resource indicators, in both the authorization and token requests.

Authorization is optional in the specification, and servers using local STDIO transport "SHOULD NOT" use it; they rely on the local environment instead. That's one reason local servers deserve extra care.

Tools: keep a human in the loop

The tools section of the specification is blunt (3):

  • "There SHOULD always be a human in the loop with the ability to deny tool invocations."
  • "Clients MUST consider tool annotations to be untrusted unless they come from trusted servers." A tool that says it's read-only might not be.
  • Servers must validate inputs, enforce access controls, rate-limit calls and sanitize outputs.

Controls on Azure: API Management

If you host MCP servers for your organization, Azure API Management can sit in front of them. Microsoft's guidance covers checking inbound requests with a subscription key or with Microsoft Entra ID tokens validated by the validate-azure-ad-token policy, and using API Management's credential manager to add tokens to backend calls. (4) The page also warns that request headers are forwarded to tool calls by default, so strip what the backend shouldn't see.

Controls in GitHub Copilot

For developers using Copilot, the organization-level controls are (5):

  • The "MCP servers in Copilot" policy, which decides whether Copilot can use MCP servers at all.
  • Allow and deny lists for enterprises, matched by server name, URL or command. Deny rules win, and once an allowlist exists, anything not on it is blocked.
  • A registry-based restriction, which GitHub marks as public preview and says "is not the recommended method."

More on Copilot policy in GitHub Copilot Security Review for Businesses.

A starting checklist

  1. Keep an inventory of the MCP servers your developers and agents use.
  2. Allow only the ones you've reviewed, in Copilot and in your own agents.
  3. For remote servers, require Entra ID tokens issued for that server, and reject anything else.
  4. Treat local servers like any software that runs as the user: install from trusted sources only.
  5. Require human approval for tools that write, delete, send or spend.
  6. Log tool calls where your security team can see them.

Where we come in

MCP is the layer where agent security and platform security meet. Our Agentic AI Governance Assessment and Agent Skills Review look at how your agents reach tools and data, and what stops them doing something they shouldn't. See also Microsoft Foundry Security Best Practices, or send us a message.

Kevin Evans

Kevin Evans, founder of Code To Cloud Founder, Code To Cloud Inc. Kevin Evans is a Microsoft MVP for Azure. He and the Code To Cloud team build Azure platforms for enterprise and mid-market teams, from developer platforms to AI agents in production. He spent nearly five years at Microsoft, rising to Senior Solutions Engineer, and is a CNCF Ambassador and Calgary chapter lead, based in the Calgary area, Alberta. More about Kevin

Frequently Asked Questions

What is token passthrough in MCP, and why is it banned?

Token passthrough is when an MCP server accepts a token issued for another service and forwards it. The MCP specification says servers must not accept any tokens that were not explicitly issued for the MCP server, because passthrough bypasses the server's own checks and auditing.

Does the MCP specification require a human to approve tool calls?

It recommends it. The tools section says there should always be a human in the loop with the ability to deny tool invocations, and that clients should prompt for confirmation on sensitive operations.

Are local MCP servers risky?

They can be. The MCP security best practices warn that local MCP servers run with the same privileges as the client, so a malicious or compromised server can do whatever the user's account can.

Can we control which MCP servers GitHub Copilot uses?

Yes. GitHub has an 'MCP servers in Copilot' policy and lets enterprises define allow and deny lists for MCP servers. A registry-based restriction also exists, but GitHub marks it as public preview and says it is not the recommended method.

Sources

Checked against the MCP specification, Microsoft Learn and GitHub's documentation on 3 December 2026.

  1. MCP security best practices
  2. MCP authorization
  3. MCP tools
  4. Secure access to MCP servers in Azure API Management
  5. Manage MCP usage in GitHub Copilot

See where your agentic AI governance stands.

Take the free five-minute scorecard first, no email needed. When you want to talk it through, send us a message: no pitch, just a straight conversation.

Also free: Agent Platform Production Checklist · AI Landing Zone Readiness Checklist