---
title: "Let agents discover how to authorize against your MCP server"
description: "How OAuth protected resource metadata (RFC 9728) tells an agent where to sign in before calling a store's MCP server, and why a public server can skip it."
canonical_url: https://agentic-readiness-scanner.space.fast/knowledge-base/oauth-discovery-for-mcp
check_id: A4.3
check_title: "OAuth discovery for the MCP endpoint"
section: "A4 Protocol discovery"
priority: nice_to_have
weight: 1
level_gate: none
depends_on: [A4.1]
keywords: ["MCP OAuth", "oauth-protected-resource", "RFC 9728", "RFC 8414", "WWW-Authenticate resource_metadata", "MCP authorization discovery"]
author: "Matthias Reinholz"
updated: 2026-11-03
---

# Let agents discover how to authorize against your MCP server

> How OAuth protected resource metadata (RFC 9728) tells an agent where to sign in before calling a store's MCP server, and why a public server can skip it.

Check A4.3 (OAuth discovery for the MCP endpoint) in section A4, Protocol discovery. Priority: nice to have. Weight 1. Helps agents, rarely decisive on its own. Not a level gate. It counts toward its section score. Runs after A4.1.

## In short

An MCP (Model Context Protocol) server, which lets AI agents call a site's tools, must tell agents where to get a token when it needs a login. The MCP specification requires such servers to publish OAuth 2.0 protected resource metadata (RFC 9728), which names the authorization server. This check looks for that metadata for the endpoint found by the [MCP server discovery check](https://agentic-readiness-scanner.space.fast/knowledge-base/mcp-server-discovery). It runs only when that endpoint exists, and it carries weight 1, nice to have.

## What this check looks at

OAuth 2.0 is the standard way for a client to get an access token for an API. Before a client can start an OAuth flow, it needs to know which authorization server issues tokens for the API. Two IETF standards publish that information:

- **RFC 9728, protected resource metadata.** The API (here, the MCP server) publishes a JSON document at `/.well-known/oauth-protected-resource`. Its `authorization_servers` array names who issues tokens. For an API at a path, the document can live at `/.well-known/oauth-protected-resource/{path}`.
- **RFC 8414, authorization server metadata.** The authorization server publishes its own endpoints, such as `authorization_endpoint` and `token_endpoint`, at `/.well-known/oauth-authorization-server`.

The MCP authorization specification chains them. An MCP server that requires authorization answers an unauthenticated request with HTTP 401 and a `WWW-Authenticate` header whose `resource_metadata` parameter points at its RFC 9728 document. The client reads that document, picks an authorization server, reads its RFC 8414 metadata and starts the flow.

A typical challenge looks like this:

```http
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer resource_metadata="https://example.com/.well-known/oauth-protected-resource/mcp"
```

## Why it matters for AI agents

An agent that hits a 401 without any pointer has no standard next step. It cannot ask the user to sign in, because it does not know where. Protected resource metadata turns "access denied" into "sign in here". MCP clients that follow the specification use exactly this route.

Not every MCP server needs authorization. A read-only product catalog that anyone may query can be public. Such a server is not scored on this check, because the MCP specification makes authorization optional. Authorization matters when the server touches customer data: order history, saved addresses, a signed-in cart.

This check gates no level. Passing it shows that the discovery documents exist. It does not test that the sign-in flow works.

## How the scanner decides

The check is skipped when the MCP server discovery check found no endpoint. Otherwise it works on the endpoint's own origin, which may differ from the store's.

1. It requests `/.well-known/oauth-protected-resource/{endpoint path}`, then `/.well-known/oauth-protected-resource`. When the endpoint has no path, only the second. A document counts only when it answers 200 with a non-empty `authorization_servers` list.
2. If neither yields metadata, it sends a GET request to the endpoint and reads the status and the `WWW-Authenticate` header.
3. If that does not help either, it requests `/.well-known/oauth-authorization-server`.

- **Pass:** a protected resource metadata document was found, or the endpoint answered 401 with a `WWW-Authenticate` header that names `resource_metadata`.
- **Warn:** the endpoint answers 401 and only authorization server metadata was found. It must be JSON with an `issuer` and an `authorization_endpoint` or `token_endpoint`. An agent can see that an OAuth server exists, but not that it guards this MCP endpoint.
- **Fail:** the endpoint answers 401, and none of the three was found, so an agent cannot tell where to sign in.
- **Not scored:** the endpoint does not answer 401. The scanner then looks no further. The MCP specification makes authorization optional, so an endpoint that does not ask for it needs no OAuth discovery. Shopify's and Wix's MCP endpoints work this way.

The evidence lists every URL tried with its status, the authorization servers found and the first part of the `WWW-Authenticate` header.

## How to fix it

Fix this only if your MCP server requires a login. If it is meant to be public, leave it.

### WordPress and WooCommerce

- If an MCP plugin exposes customer data, check whether it supports OAuth and publishes protected resource metadata. Prefer a plugin that follows the MCP authorization specification over one that expects a static API key.
- When an external identity provider issues the tokens, it serves the RFC 8414 document itself. Your site serves only the RFC 9728 document and the 401 challenge.

### Shopify

- Shopify's storefront catalog endpoint at `/api/ucp/mcp` does not use this flow. Its documentation asks agents to identify themselves in each request with an agent profile for UCP (Universal Commerce Protocol, an open standard for agents to discover and buy from stores). There is nothing to configure here for a standard Shopify store.

### Any other stack

- Publish `/.well-known/oauth-protected-resource/{endpoint path}` with `resource` set to the endpoint URL and `authorization_servers` listing your issuer.
- Return 401 with `WWW-Authenticate: Bearer resource_metadata="..."` for unauthenticated MCP requests. This is the route MCP clients try first.
- Make sure the authorization server answers `/.well-known/oauth-authorization-server`. Most hosted identity providers already do.
- Keep the `resource` value identical to the URL agents connect to, including the path. A mismatch makes careful clients reject the metadata.

## Verify it yourself

Request the metadata and the endpoint's challenge:

```bash
curl -s https://example.com/.well-known/oauth-protected-resource/mcp
curl -si https://example.com/mcp | grep -i www-authenticate
```

The first should return JSON with `authorization_servers`. The second should show a header that names `resource_metadata`. Then fetch the authorization server's `/.well-known/oauth-authorization-server` to confirm it answers.

## Common mistakes

- **Publishing only RFC 8414 metadata.** An authorization server exists, but nothing links it to the MCP endpoint. The check warns.
- **A 401 without `resource_metadata`.** `WWW-Authenticate: Bearer` alone tells the agent to bring a token, not where to get one.
- **Metadata on the wrong host.** The documents belong on the origin of the MCP endpoint. If the endpoint lives on `mcp.example.com`, the store's main domain does not help.
- **Requiring a login for public catalog data.** It adds friction for every agent. Keep read-only product data open and protect only personal data.

## FAQ

### Does every MCP server need OAuth?

No. The MCP specification makes authorization optional. A server that needs it must publish protected resource metadata. A public, read-only server needs none.

### What is the difference between RFC 9728 and RFC 8414?

RFC 9728 is published by the API and says which authorization servers protect it. RFC 8414 is published by the authorization server and lists its own endpoints. MCP clients read the first to find the second.

### Can I use an API key instead of OAuth for my MCP server?

You can, but no agent will know how to obtain one without your help. The MCP specification defines OAuth discovery so that clients can sign in on their own.

### Why does this check skip on my store?

It needs an MCP endpoint from the server discovery check. Without a server card there is no endpoint to inspect, so the check is skipped rather than failed.

## The fix in one step

If the MCP server needs authorization, publish OAuth 2.0 protected resource metadata (RFC 9728) for its path, answer unauthenticated requests with 401 and a WWW-Authenticate header naming it, and point it at an authorization server with RFC 8414 metadata.

```json
{
  "resource": "https://example.com/mcp",
  "authorization_servers": ["https://auth.example.com"],
  "scopes_supported": ["catalog:read"]
}
```

### Prompt for a coding agent

A scan found that the MCP endpoint of this site answers 401 without any OAuth discovery metadata, or that only authorization server metadata exists and no protected resource metadata for the endpoint. Only act if the MCP server requires authorization. Publish `/.well-known/oauth-protected-resource/<endpoint path>` (and the root form) on the endpoint's origin, with `resource` set to the exact endpoint URL and an `authorization_servers` list. Return 401 with `WWW-Authenticate: Bearer resource_metadata="<that URL>"` on unauthenticated requests, and make sure the authorization server serves `/.well-known/oauth-authorization-server`. Follow the discovery order of the MCP authorization specification. Verify with `curl -s` on the metadata URL (JSON with `authorization_servers`) and `curl -si <endpoint>` (a 401 whose WWW-Authenticate names `resource_metadata`).

## Sources and specifications

- [MCP authorization: authorization server discovery](https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization/authorization-server-discovery)
- [RFC 9728 OAuth 2.0 Protected Resource Metadata](https://www.rfc-editor.org/rfc/rfc9728)
- [RFC 8414 OAuth 2.0 Authorization Server Metadata](https://www.rfc-editor.org/rfc/rfc8414)

Source: https://agentic-readiness-scanner.space.fast/knowledge-base/oauth-discovery-for-mcp (Agentic Readiness Scanner knowledge base, by Matthias Reinholz).
