AI Blog

The MCP Auth Gap Is Real, and the NSA Just Put It in Writing

mcpclaudecybersecuritycloudflarensaauthentication 7 min read
Conceptual illustration of the Model Context Protocol connecting an AI client to files, APIs, databases, services, search, and custom tools
The Model Context Protocol is the emerging standard for connecting AI assistants to tools, data, and services. Adoption is racing ahead of the protocol's security model.

A few weeks ago I sat down to build something I had been putting off: a custom Model Context Protocol server that I could self-host on a public web server and connect to from authorized Claude clients. The idea was straightforward. The Claude client would call my MCP server, the MCP server would call a handful of internal tools, and the model would have access to capabilities I could not get out of the box.

The server part went smoothly. MCP is well documented as a protocol, the open source implementations are reasonable starting points, and Anthropic has done a decent job making the developer experience approachable.

The auth part did not go smoothly.

What I expected vs what I found

When I think about authenticating an HTTP-based service that lives on a public web server, I think about a fairly well trodden path. You pick an identity provider. You issue tokens. You define scopes. You handle refresh and revocation. There are battle tested libraries for every language. The shape of the problem is familiar even when the specifics are not.

MCP does not give you that shape.

The protocol does not require authentication. It does not define a session-to-identity mapping. It mentions OAuth as a possible model in some of its specification documents, but it does not mandate token lifecycle management. There is no protocol-level concept of refresh rotation, revocation, or reuse control. Whether your MCP server enforces any of this at all comes down to the implementer.

I spent more time than I expected piecing together what “auth on a public MCP server” was even supposed to look like. The protocol pointed in a general direction. The implementations I looked at all made different calls. The result felt less like building on a standard and more like building on a suggestion.

I shipped a working version eventually, but I was not happy with it. Something was off, and I could not quite articulate what.

”MCP’s rapid proliferation has outpaced the development of its security model”

That was the moment I read the NSA’s Cybersecurity Information Sheet on Model Context Protocol security, released on May 20, 2026. The opening line of the executive summary put words to what I had been struggling with:

“MCP’s rapid proliferation has outpaced the development of its security model. Much like early web protocols, MCP was released with a flexible and underspecified design, allowing implementers freedom of design but also introducing ambiguity for safe usage.”

The report walks through a list of concrete gaps. A few that lined up with what I had run into:

This was not a niche observation by a single security researcher. This was the NSA, in formal published guidance, describing the exact category of problem that had been chewing up my evenings.

The report’s closing position is the part I cannot stop thinking about:

“[MCP’s] current security posture remains uneven and highly dependent on implementation discipline rather than protocol guarantees.”

That sentence is the whole problem in one line. Every MCP operator running anything serious is currently inventing their own auth story, with no protocol obligating them to get it right.

What I changed

After reading the report I went back to my MCP server and made a fundamental shift in approach.

The original version had auth bolted into the MCP server itself. Tokens were issued by the server, validated by the server, and refreshed by the server. Everything ran inside the same process I was also trying to use to serve MCP traffic.

That is the version of the architecture that the NSA report essentially warns against. Not because it cannot work, but because it puts the entire weight of getting auth right on one developer (me) writing one piece of code.

So I stopped doing that.

The new version puts Cloudflare in front of the MCP server and offloads almost every auth concern to infrastructure that already takes these problems seriously. Cloudflare has been actively positioning Workers as the place to host remote MCP servers, and the supporting products line up cleanly with the gaps the NSA names.

Architecture diagram showing Cloudflare Access, Workers OAuth Provider, and an MCP server on Workers, mapped to NSA-identified MCP security gaps
The architecture I landed on. Identity, token lifecycle, and rate limiting are handled by Cloudflare at the edge, not by the MCP server itself. Each layer is paired with the specific NSA-identified gap it closes.

Here is what each layer does, and which NSA-identified gap it addresses:

The net effect is that the auth layer is no longer a piece of code I wrote. It is a piece of infrastructure I configured. That is a much better place for it to be.

What this does not solve

I want to be honest about the limits of this approach, because the NSA report is broader than auth.

This architecture closes the authentication and authorization gaps that the report leads with. It does not, on its own, solve the trust boundary problems between agents, the indirect prompt injection risks in tool outputs, the serialization vulnerabilities in MCP payloads, or the inconsistent behavior across MCP implementations. Those are deeper, more structural issues that the NSA frames as architectural rather than something a single deployment can fully patch.

So the honest position is this. The stack closes a specific category of high-severity gap, the one I personally hit, and the one the NSA report opens with. It does not make an MCP deployment “secure” in any broader sense. Output filtering, tool sandboxing discipline, and audit log review still belong on the operator’s plate.

The NSA’s own conclusion is worth quoting in full here:

“Adopters should therefore proceed with caution, drawing on lessons from prior distributed and plugin-based ecosystems while applying heightened scrutiny to the novel integration and automation patterns introduced by MCP.”

That is the right framing. MCP is not unsafe. It is early. The protocol’s security model is going to mature, and the implementations are going to harden, but right now every public-facing MCP operator is doing security work that the protocol probably should be doing for them.

The short version

If you are running an MCP server in production, especially one that is reachable from the public internet, the auth story is your responsibility in a way that should make you uncomfortable. The NSA has now formally written that down.

The way I closed the gap was to stop treating auth as something my MCP server needed to do, and instead put a layer of infrastructure in front of it that handles identity, tokens, scope enforcement, and rate limiting on my behalf. Cloudflare was the fit for my deployment. Other zero-trust platforms with similar feature sets would work equivalently.

The important point is not the vendor. The important point is the architectural decision. Stop building MCP auth inside the MCP server. Put it at the edge, on infrastructure designed for the job. Until the protocol catches up, that is the most defensible posture available.

If you are deploying anything on MCP for production use, the full NSA report is worth reading. You can find it here: Model Context Protocol (MCP): Security Design Considerations for AI-Driven Automation (CSI U/OO/6030316-26, May 2026). It is the clearest articulation of the current state of the protocol’s security posture that I have come across, and it is going to age well.