MCP authorization: what the check tests and how to fix it

Weight 1.5. If your MCP endpoint answers 401 with a Bearer challenge, passes when it links its own valid protected resource metadata. Skipped without MCP.

Agent Auth · Weight 1.5 in the w2agent Score

How common is it?

Fewer than 20 measured sites have a result for this check, so no rate is shown yet.

What this check tests

First the audit has to find an MCP endpoint. It tries up to five addresses: up to two links on your homepage that point to your own site and end in /mcp or /sse (or sit on a host starting mcp.), then <origin>/mcp, mcp.<domain>/mcp and mcp.<domain>/. At each it sends an MCP server/discover request, then a legacy initialize request, then an SSE GET. A 401 only registers an endpoint when its WWW-Authenticate: Bearer challenge carries a resource_metadata parameter.

Then, for an endpoint that answered 401:

  • Fail 0: the 401 has no Bearer challenge. Because of the rule above this is rare.
  • Partial 50: a Bearer challenge, but no valid protected resource metadata. The audit fetches the resource_metadata URL, or, if there is none, /.well-known/oauth-protected-resource with the endpoint path inserted and then at the root. The document must be JSON with a resource that matches the endpoint and a non-empty authorization_servers array.
  • Pass 100: valid metadata, and it is a different document from the one the OAuth discovery check already measured.
  • Skip: no endpoint was found; no handshake was recorded; the endpoint does not answer 401 (it does not require authorization); or its metadata is the same document OAuth discovery used. The last case is the usual one on a site that only has an MCP server, because OAuth discovery also follows the MCP endpoint's 401. The check avoids counting one document twice.

The audit also forces this check to skip, with a score of 0, whenever it found no MCP endpoint, even if the check would otherwise have passed.

Why it matters to agents

The MCP authorization specification (2026-07-28) says authorization is optional. When a server does use it, MCP servers MUST implement protected resource metadata (RFC 9728) with at least one entry in authorization_servers, and clients MUST use that metadata to find the authorization server. A server can signal the metadata URL in the 401's WWW-Authenticate header or serve it at the well-known URI. Clients must support both and use the header value when it is present.

If your MCP server is public and needs no login, this check is skipped and nothing is expected from you. Only servers that require authorization are tested.

How to fix it

Only if your MCP endpoint requires authorization:

  1. Answer unauthenticated requests with 401 and the metadata URL, as RFC 9728 section 5.1 shows. If the MCP endpoint is your only protected resource, OAuth discovery already credits this same metadata document and this check then skips, so these steps lead to a pass here only when this document differs from the one OAuth discovery used:
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer resource_metadata="https://mcp.example.com/.well-known/oauth-protected-resource", scope="files:read"
  1. Serve that document as JSON. resource must identify the MCP endpoint a client calls, such as https://mcp.example.com/mcp, and authorization_servers must list at least one issuer. Per RFC 9728 section 3.3, a client rejects the document if resource does not match the URL it requested.

  2. Check the issuer's own metadata, which is covered by OAuth discovery, PKCE S256 and Client ID Metadata Documents.

This page and OAuth discovery can read the same document. You see a pass here only when your MCP endpoint has metadata of its own, for example when your website API and your MCP server are protected resources with separate documents. Otherwise a skip means the document was already credited, not that something is missing.

Examples from measured sites

Up to 10 of the highest-scoring sites in each group, from recent audits. Failing includes partial results.

Passing

Failing or partial

Sources

Verified against these sources on

Does your site pass this check?

Check your own site →