part 1Foundations: before OAuth·lesson 1.3 of 5·3 min read
Classic HTTP credentials: API keys, Basic auth, cookies and mTLS
Before (and outside of) OAuth, an HTTP server has five common ways to know who is calling: static Bearer tokens, API keys, Basic auth, session cookies and mTLS. This lesson covers how each credential travels, its pros and cons, and why none of these "custom mechanisms" that MCP still allows is discoverable by a generic client.
In this lesson
Describe how the credential travels in each classic mechanism.
Weigh their advantages and risks.
Explain why none of them lets a generic client configure itself.
The five classic mechanisms
The MCP 2024-11-05 spec did not define any authorization mechanism, so any of these was equally valid; in later revisions they remain possible, but outside the standard.
Static Bearer
POST /mcp HTTP/1.1
Authorization: Bearer sk_live_9f8a7b6c5d
A long, random secret string that the server compares with the ones it has stored. Same header format as OAuth, but the token was generated by hand and does not expire.
Pro: dead simple to implement and use. Con: permanent, usually grants full access, has to be distributed by hand.
API key
POST /mcp HTTP/1.1
X-API-Key: 3c6e0b8a9c15224a
Same as the static Bearer, but in a custom header (or, worse, in the URL: ?api_key=…). Each service decides the header name, so the client has to know it in advance.
Pro: easy. Con: non-standard header; if it goes in the URL, it ends up in logs and browser history.
Basic auth
POST /mcp HTTP/1.1
Authorization: Basic YWxpY2U6c3VwZXJzZWNyZXQ=
Username and password joined by : and encoded in Base64. Base64 is not encryption: anyone can decode it (try the demo below). It is only acceptable over HTTPS, and even then the real password travels with every request.
Pro: supported by everything. Con: the real password always travels; no scoped permissions.
Session cookie
POST /mcp HTTP/1.1
Cookie: session=7d1c3f0e2b
What a website uses when you sign in: the server gives you a cookie and the browser sends it back automatically. Designed for browsers, not for programmatic clients such as an MCP client.
Pro: natural on websites. Con: exposed to CSRF; awkward outside the browser.
mTLS
TLS handshake
Server → Client : server certificate
Client → Server : client certificate ← the credential
(no header: the identity travels in the connection)
Mutual TLS: besides the server, the client also presents a certificate. The identity travels in the encrypted connection itself. Very robust between services within the same organization that runs its own PKI.
Pro: very secure, nothing to steal from headers. Con: managing certificates is expensive; not suitable for end users.
Demo: Base64 is not encryption
Type a username and password to see the resulting Authorization: Basic header, or paste any Basic header to "decrypt" it instantly.
Interactive exercise: it loads in your browser.
What they have in common
Problem
Why it happens
Not discoverable
There is no standard way for the server to say "authenticate like this". The client has to know in advance.
Manual configuration
Someone has to obtain the credential and put it into every client.
No delegation
The credential is "yours", not "a limited permission for this app".
No defined error response
In 2024-11-05 the spec did not even say what to respond when it failed.
Summary
Static Bearer, API key, Basic, cookie and mTLS: all valid in MCP, but outside the standard.
None is discoverable: the client needs manual configuration.
Base64 (Basic) is not encryption; HTTPS is always essential.
quiz · 2 questions
1. A server uses Basic auth over plain HTTP (no TLS). An attacker on the same Wi-Fi captures the Authorization: Basic header. What do they get?
Base64 is a reversible encoding, not encryption. Without TLS, the password travels practically in clear text.
2. Which of these mechanisms is best suited between two internal microservices of a company that runs its own certificate infrastructure?
mTLS is very robust between services: the identity travels in the connection and there are no secrets in headers. Its cost (managing certificates) pays off when a PKI already exists.