This article was originally published on the Agentic AI Foundation blog.
An engineer I talked to recently described OAuth as MCP’s biggest mistake. Wouldn’t it be way simpler to just use API keys?
Fair question! OAuth is complicated and jargon-y, and it feels like overkill if all you want to do is give some tools or data to an agent.
Some MCP servers really do need OAuth, but not all. I’ll explain when OAuth is needed, and when it might not be.
The general-purpose vision
MCP’s big vision is that clients and servers that have never met can communicate with each other. As the user of an agent, I just paste a URL into my agent and go, without configuring a custom integration.
This is how web browsers work: to visit google.com I just type that address into my browser. I don’t need to manually set up a relationship between my computer and Google. The same idea applied to MCP means general-purpose clients1 like Claude and goose can connect to any server that speaks MCP.
Remote2 MCP servers fall into two categories themselves:
- Unprotected servers, like a weather server that anyone can access, that do not require auth
- Protected servers that deal with your data specifically, or otherwise require login or authentication
When you think of connecting your agent to a service like GitHub, Linear, or Figma, that’s a remote protected MCP server. In this post, I’m focusing on that category.
There are two reasons why API keys aren’t a good solution here. First, user experience: finding or generating an API key in a service I want to use, then pasting it into my MCP client isn’t a user-friendly experience for non-developers.
Let’s say we required MCP servers to host an endpoint that automatically provisioned API keys, so the user’s experience was simple (no complex pre-setup, just type and go to start connecting). Then we have a different problem: standardization.
Auth by any other name
There are many MCP servers in the wild. General-purpose clients can’t have special code to deal with each one, because that won’t scale: client developers would spend all their time writing similar code for thousands of different servers.
So, auth must be standardized. Auth must also be discoverable, because a client connecting to a server it’s never seen before needs to ask, “What do I need to provide in order to connect?”
Could API keys work in a user-friendly, standard, and discoverable way?
They could. Clients need a way to obtain an API key for a server they haven’t talked to before, like the provisioning endpoint we imagined above. It’s important for the client to identify itself so the server knows who is calling, and for the server to verify the end-user’s identity. It’s also crucial to get the end-user’s consent for the client to act on their behalf.
Clients and servers also need:
- A way to agree on what the API key can do (read-only? read and write?)
- A way for the API key to expire after a period of time, so a leaked key’s exposure is minimized
- A way to get a fresh API key after one expires
It’s possible to do all of this with API keys. The hard part is getting everyone on both sides of the client/server equation to agree on how to do it. If you manage to do that, you’ve basically reinvented OAuth! 😉
The reason MCP adopted OAuth 2.1 and its extensions is because they provide the things MCP needs: first-connection discovery, client identification, explicit user consent and scoped access, expiry and renewal. These standards already exist, are widely used, and in many cases have been stress-tested for years or decades.
But that’s not the whole story, because not every MCP client/server pair needs OAuth!
You ain’t gonna might not need it
I think what developers are often actually struggling with is,
- Do I really need to understand all this OAuth stuff to build an MCP server?
- What if my company’s requirements differ from what the MCP spec says?
Many enterprises already have a well-defined security architecture built on top of API keys, mTLS, OAuth client credentials, or something else. The team building MCP servers is asked to fit MCP’s square OAuth peg into a round hole.
This is where the distinction between general-purpose clients and custom clients matters. If your goal is for off-the-shelf ChatGPT or Cursor to talk to your MCP server, you should stick closely to the spec, and that means OAuth for protected servers. However, if only custom clients will talk to your MCP server, you have a lot more leeway:
| General-purpose client | Custom client | |
|---|---|---|
| Unprotected server | No auth needed | No auth needed |
| Protected server | Follow MCP’s OAuth flow | Agree on auth ahead of time |
Teams building vertical or in-house agents often build the client and server together. If you control both sides of the equation, then you can pre-arrange the relationship and use API keys, the OAuth client credentials or EMA extensions, or your own internal auth scheme. You can’t assume a general-purpose client is pre-configured for it, but you can ensure your custom client is.
Conclusion
MCP’s big vision is that general-purpose clients can talk to servers they haven’t met before, and OAuth supplies an existing standard for achieving that vision. Many MCP server developers I talk to are building servers for that general-purpose vision, but not all.
The client/server mix you’re building for matters. A protected server that needs to work with general-purpose clients is exactly the problem MCP’s OAuth flow solves. If you’re building the client and server together, you can agree on another approach.
Is there a specific MCP + OAuth topic you’d like demystified? Let me know on LinkedIn or X!
Notes
-
By general-purpose, I mean a client that can connect to MCP servers it doesn’t have any prior relationship to. You can also call them “off-the-shelf clients”. Claude, ChatGPT, goose, Hermes, Cursor, and OpenClaw are all examples of general-purpose clients.
The key distinction is: These clients and agents do not have special code to handle specific MCP servers. They support the “type and go” experience, and don’t require the user to manually set up special connection details for each server.
The opposite are custom clients, which are purpose-built to talk to specific MCP servers. They are often embedded directly within a vertical or special-purpose agent. ↩
-
Local (stdio) MCP servers are out of scope here, because they run on the end-user’s machine and are not multi-user. ↩