MCP security and authentication: risks, OAuth and what to check

How MCP authentication works under the current specification, the risks it covers and the ones it leaves to you, and the questions to ask before you connect a server to company systems.

By Juanma · 30 November 2026

MCP security comes down to three questions: who the server acts as, what it may do without a person agreeing, and whether you trust the code that runs it. For remote servers the protocol answers the first one with OAuth 2.1: each person signs in, and the server receives a token issued for it alone.

This guide explains how MCP authentication works under the current specification, which risks it covers and which it leaves to you, and what to ask before you connect a server to company systems. If the terms are new, start with what an MCP connector is.

Is MCP secure?

MCP is as safe as the server you connect and the permissions you give it. The protocol standardises how an assistant finds and calls tools; it does not make a careless server safe. The specification itself says that tools represent arbitrary code execution and that a person should be able to deny any tool call.

Most real problems sit in four places:

  • Identity. The server uses one shared key, so everyone who uses it gets that key's access.
  • Too much permission. The token or account can do far more than the task needs.
  • Untrusted content. An email, ticket or web page the assistant reads carries instructions meant to mislead it.
  • Untrusted code. A server installed from an unknown source, or one that changes its tools after you approved it.

How does MCP authentication work?

At the time of writing (November 2026) the current MCP specification is version 2026-07-28; check modelcontextprotocol.io for later changes. Its authorization rules apply to servers reached over HTTP, that is, remote servers. A local server that runs on the person's computer over standard input and output (stdio) does not use this flow: it reads its credentials from the environment it runs in.

For a remote server the roles are those of OAuth 2.1:

RoleIn MCPWhat it does
Resource serverThe MCP serverHolds the tools, accepts only tokens issued for it and checks them on every request
Authorization serverYour identity provider, or the system's own sign-inSigns the person in, asks for consent and issues short-lived tokens
ClientThe assistant: Claude, an IDE or your own agentFinds where to sign in, runs the flow and sends the token with each call

The flow, step by step:

  1. The client calls the server without a token and gets 401 Unauthorized. The WWW-Authenticate header points to the server's Protected Resource Metadata (RFC 9728), which names the authorization server.
  2. The client reads the authorization server's metadata and identifies itself. A client your administrators registered in advance comes first; otherwise the specification prefers Client ID Metadata Documents, where the client ID is an HTTPS address that describes it. Dynamic Client Registration was deprecated in version 2026-07-28.
  3. The person signs in and approves the requested scopes. The client must use PKCE and must name the exact MCP server the token is for with a resource indicator (RFC 8707).
  4. The client sends the access token with every request, never in the URL. The server checks that the token was issued for it and refuses any token meant for another service.
  5. If a tool needs more than was granted, the server answers 403 with insufficient_scope, and the client asks the person to approve the extra scope.

OAuth or an API key?

An API key is simpler and still common, above all in local servers. The difference is whose access the assistant ends up using.

AspectOAuth, each person signs inOne shared API key
Who the server acts asThe person who askedWhoever owns the key
What a person can seeWhat their account can already seeEverything the key can see
Removing one personDisable their account or revoke their tokenRotate the key for everyone
Audit trailEach action tied to a personEvery action looks like the same user
SetupAn identity provider and a client that supports OAuthA secret in a configuration file

Use OAuth with per-person sign-in wherever the system supports it. If a system only offers a shared account, limit that connector to what the whole group may see, and tell the people who use it.

Which risks does the specification name?

The specification's security best practices page lists attacks that matter mainly to the people who build servers and clients. In plain terms:

  • Token passthrough. A server forwards the token it received to another API. The specification forbids it: the server needs its own credentials for anything further down, so an audit can still tell who did what.
  • Confused deputy. A server that fronts a third-party API with one fixed client ID can be tricked into reusing consent that another person gave. The fix is consent per client on the server, checked before anything is forwarded.
  • Local server compromise. A one-click install can run any command on the person's computer. Clients must show the exact command and ask before running it.
  • Server-side request forgery (SSRF). A malicious server's metadata points the client at internal addresses. Clients should accept only HTTPS and block private network ranges.
  • Hijacked state. Something that identifies a conversation is taken as proof of who the user is. Servers must check authorization on every request.
  • Scope creep. A server asks for every permission up front. Start with the minimum and ask for more only when a tool needs it.

Two risks have nothing to do with the protocol, and they cause most of the trouble in practice: content the assistant reads that carries hidden instructions (prompt injection), and tools that change after you approved the server. Authentication does not stop either. What stops them is limiting what an action may do without a person.

Risk, control and who checks it

RiskWhat it looks likeControlWho checks it
Shared identityEveryone sees what the service account seesPer-person OAuth sign-inIT, when the connector is approved
Too much permissionA question that only reads runs with write accessMinimal scopes; read-only connectors firstWhoever builds the connector
Prompt injectionAn email tells the assistant to forward a fileActions that change or send something wait for a team memberThe owner of the process
Changed toolsA new tool appears after approvalPinned versions; tool lists reviewed after each updateIT, on a schedule
Untrusted serverA connector from an unknown sourceOnly servers you, or a supplier you trust, maintainIT, before installing
Leaked tokenA token found in a log or a URLShort-lived tokens, never in URLs; refresh tokens rotatedWhoever runs the server
No trailNobody can say who changed a recordEvery tool call logged with the person and the inputsSecurity, in review

What to ask before you connect a server

  1. Who wrote it, and who maintains it now?
  2. Does each person sign in, or does it use one shared key?
  3. Which scopes does it request, and can it run read-only?
  4. Which actions change or send something, and can they wait for a team member's approval?
  5. Where does it run, and does company data pass through anyone else's servers?
  6. Does it forward tokens to other services, or use its own credentials?
  7. What is logged for each call, and where?
  8. How will you hear about new tools or changed tool descriptions?
  9. How do you remove access for one person, and for everyone?
  10. Who owns the code if the supplier goes away?

How we build connectors

When we build a custom connector, these are the defaults, also described on our security page:

  • Each person connects with their own account wherever the system supports it, so the connector returns only what that account can already see.
  • Where a system only offers a shared account, we say so and limit that connector to what the whole group may see.
  • Many connectors start read-only. When one can create or change records, the actions that matter wait for a team member's approval in Teams or Slack.
  • The connector runs on your infrastructure, next to the system it connects, behind one secured address your IT team controls.
  • Our access during the build is listed in writing and removed at handover.

If you are weighing an MCP connector against a direct integration, MCP vs API covers what each one decides. When the system you need has no MCP server, that is what we build: custom MCP connectors that run on your infrastructure, with the source code yours.

The service behind this guide

Questions and answers

Is MCP secure?

MCP is a protocol, so it is as secure as the server you connect and what you let it do. For remote servers the current specification requires OAuth 2.1 with PKCE and tokens bound to one server. Risks such as prompt injection and untrusted servers are handled by limiting what actions can do and by approving what you install.

How does MCP authentication work?

A remote MCP server acts as an OAuth 2.1 resource server. The client finds the authorization server through the server's metadata, the person signs in, and the client sends a short-lived token issued for that server alone. Local servers that run over stdio read their credentials from the environment instead.

Does MCP use OAuth 2.1?

Yes, for servers reached over HTTP. The specification requires authorization servers to implement OAuth 2.1, clients to use PKCE and resource indicators, and servers to refuse tokens not issued for them. Authorization is optional in the specification, so check that the server you connect actually requires it.

What is token passthrough in MCP?

It is a server forwarding the token it received from the client to another API. The specification forbids it, because the other API cannot tell who is really calling and the server's own checks are skipped. A server that calls other services must use its own credentials for them.

Are local MCP servers safer than remote ones?

Not by default. A local server runs with the person's own permissions on their computer, so a malicious one can read files or run commands. A remote server keeps credentials off laptops and can be managed in one place, but it must use OAuth and HTTPS.

Who should approve what an AI agent does through MCP?

A team member who owns the process. The specification says a person should be able to deny any tool call. In practice reading can be left to the assistant, while payments, deletions and messages to customers should wait for approval.

Start with one process.

The report your team dreads building, or the approval that sits in an inbox for days. Tell us about it and a senior engineer tells you whether it can be automated and what it would take.

Get a free assessment

Email social@deepbluecoding.com
We reply within one working day.