AAK-OAUTH-008: MCP OAuth surface with no RFC 9728 Protected Resource Metadata discovery
- Severity
- LOW
- Category
- MCP Configuration (
mcp-config) - Scanner
agent_audit_kit/scanners/oauth_misconfig.py- Auto-fixable
- No.
- SARIF name
OAuthMissingProtectedResourceMetadata
What it detects
A remote MCP OAuth surface presents no RFC 9728 Protected Resource Metadata discovery: a client config points at a remote (HTTP/SSE) MCP server and carries an inline / static credential (an Authorization / Bearer header, an auth block, or an embedded token) with no reference to /.well-known/oauth-protected-resource, authorization_servers, or resource_metadata; or MCP server source enforces bearer auth (e.g. WWW-Authenticate, a FastMCP BearerAuthProvider) without serving Protected Resource Metadata. The ratified MCP 2025-11-25 auth spec requires servers to implement RFC 9728 so clients can discover the authorization server and obtain an audience-bound token instead of relying on a pre-shared secret; the 2026-07-28 final auth profile builds on it. Without PRM the deployment cannot participate in discovery-based auth and typically hardcodes credentials.
How to fix
Serve RFC 9728 Protected Resource Metadata at /.well-known/oauth-protected-resource (with an authorization_servers entry) and have clients discover the authorization server from it — via the resource_metadata field of a 401 WWW-Authenticate challenge — instead of embedding a static bearer/token credential in the MCP client config.
To confirm the finding is gone, report only this rule:
agent-audit-kit scan . --rules AAK-OAUTH-008
Limitations
Fires on a config with double-quoted keys that declares a remote server ("type" or "transport" set to http, sse, streamable, streamablehttp or streamable-http, or a "url" starting http:// or https://) and carries an inline credential (an "Authorization": header, a Bearer value, an "auth": { block, or an access_token, api_key or token field), or on source that mentions WWW-Authenticate, BearerAuthProvider, RequireAuthMiddleware or require_auth, when the file never mentions oauth-protected-resource, protected_resource_metadata (also with - or no separator), resource_metadata, authorization_servers or RFC 9728. A static key in another header (X-API-Key) is not recognised as an inline credential, and a config with unquoted keys (YAML type: http) is not recognised as a remote server.
References
- CVE: CVE-2026-63127
- OWASP MCP Top 10: MCP01:2025 (Token Mismanagement & Secret Exposure), MCP07:2025 (Insufficient Authentication & Authorization)
- OWASP Agentic Top 10: ASI03 (Identity and Privilege Abuse)
- Adversa AI MCP Top 25 (AAK-defined ids): ADV-AUTH-11
- CSA AI Controls Matrix (AICM): IAM-01, IAM-16
All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-OAUTH-008.md: the page then shows that text, with the registry reference appended under it.