---
title: "Publish protected resource metadata for · Agent Wranglers"
url: https://agentwranglers.se/playbook/agents-as-users/delegated-access-and-consent/mcp-protected-resource-metadata
id: AGT-37
level: Required
risk: takeover
updated: 2026-10-27
build: a2a6bdfed830
tokens: 1206
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Publish protected resource metadata for every MCP server that needs sign-in

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Delegated access and consent](https://agentwranglers.se/playbook/agents-as-users/delegated-access-and-consent.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-27.

- ID: AGT-37
- Level: Required
- Chapter: [Delegated access and consent](https://agentwranglers.se/playbook/agents-as-users/delegated-access-and-consent.md)
- Rule: An MCP server that needs sign-in serves an RFC 9728 metadata document. Its `resource` equals the server's own URL, and `authorization_servers` lists at least one server. Every 401 names the document in `WWW-Authenticate`.
- Check: An MCP request without a token gets 401 with `resource_metadata` in `WWW-Authenticate`. That URL answers 200 with JSON whose `resource` equals the MCP endpoint's URL and whose `authorization_servers` holds at least one HTTPS URL.
- Risk: An account or system taken over
- Spec version: MCP 2026-07-28
- Review by: 2027-04-30
- How: MCP clients learn where to sign in only from this document, and the MCP specification makes it a MUST for servers. Without it, clients fall back to addresses typed in by hand, and a person can be talked into signing in at a look-alike server. Clients must refuse a document whose `resource` differs from the URL they called, so copy nothing from another server. Serve it at `/.well-known/oauth-protected-resource` followed by the endpoint path, such as `/.well-known/oauth-protected-resource/mcp`. List the smallest set of scopes for basic use in `scopes_supported`, and leave out `offline_access`. The form for any API is [Publish your sign-in server settings](https://agentwranglers.se/playbook/website/standard-addresses/oauth-authorization-server.md). Missing scopes later get [one challenge that names them all](https://agentwranglers.se/playbook/agents-as-users/delegated-access-and-consent/scope-challenge.md).

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### JavaScript example

```js
const RESOURCE = 'https://mcp.example.com/mcp';
const METADATA_URL = 'https://mcp.example.com/.well-known/oauth-protected-resource/mcp';

app.get('/.well-known/oauth-protected-resource/mcp', (req, res) => res.json({
  resource: RESOURCE,
  authorization_servers: ['https://auth.example.com'],
  scopes_supported: ['bookings:read'],
}));
export const unauthorized = res => res.status(401).set('WWW-Authenticate', `Bearer resource_metadata="${METADATA_URL}"`).end();
```

### Python example

```python
RESOURCE = "https://mcp.example.com/mcp"
METADATA_URL = "https://mcp.example.com/.well-known/oauth-protected-resource/mcp"

@app.get("/.well-known/oauth-protected-resource/mcp")
def protected_resource_metadata() -> dict:
    return {"resource": RESOURCE, "authorization_servers": ["https://auth.example.com"],
            "scopes_supported": ["bookings:read"]}

def unauthorized() -> Response:
    return Response(status_code=401, headers={"WWW-Authenticate": f'Bearer resource_metadata="{METADATA_URL}"'})
```

## Sources

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

## Related rules

- WEB-173 [Publish your sign-in server settings](https://agentwranglers.se/playbook/website/standard-addresses/oauth-authorization-server.md) in Website
- AGT-32 [Name every missing scope in one challenge](https://agentwranglers.se/playbook/agents-as-users/delegated-access-and-consent/scope-challenge.md) in Agents as users

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/agents-as-users/delegated-access-and-consent/mcp-protected-resource-metadata">Agent Wranglers agents as users playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Send the issuer with every authorization response](https://agentwranglers.se/playbook/agents-as-users/delegated-access-and-consent/issuer-in-authorization-response.md)
- Next: [Accept only tokens issued for your MCP server and never pass them on](https://agentwranglers.se/playbook/agents-as-users/delegated-access-and-consent/mcp-token-audience-no-passthrough.md)
- [Delegated access and consent](https://agentwranglers.se/playbook/agents-as-users/delegated-access-and-consent.md)
