MCP OAuth discovery URLs must be HTTPS and public: fix localhost and http:// metadata
Every URL in your OAuth metadata must be HTTPS on a public host. Private, loopback or link-local targets can be blocked by clients as SSRF.
Serve the protected resource metadata, the authorization server URLs and every endpoint listed in their metadata over HTTPS on public hostnames. The rule auth.discovery-urls-unsafe is a major finding for OAuth servers. It checks resource_metadata, each authorization_servers entry, and issuer, authorization_endpoint, token_endpoint, registration_endpoint and jwks_uri.
What you see
- A scan reports lines such as
token_endpoint http://auth.acme.example/token is not HTTPSorissuer http://localhost:8080 is points at a private or loopback address. - Sign-in fails or never starts. The exact client message is not verified here.
Why it happens
- The metadata was generated while developing locally and the
localhostorhttp://base URL shipped to production. - The app sits behind a proxy and builds URLs from the internal address, so metadata shows
http://10.0.0.5:3000/.... - A forwarded-protocol header is not trusted, so the app thinks the request was plain HTTP.
The MCP security best practices page describes SSRF during OAuth discovery. It says clients SHOULD require HTTPS for OAuth URLs and SHOULD block private and reserved ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 127.0.0.0/8, 169.254.0.0/16, fc00::/7, fe80::/10). The rule flags those targets because hosted clients commonly apply that guidance. Whether a given client blocks them is not verified here.
Check it yourself
curl -s https://mcp.acme.example/.well-known/oauth-protected-resource | jq .
curl -s https://auth.acme.example/.well-known/oauth-authorization-server \
| jq '{issuer, authorization_endpoint, token_endpoint, registration_endpoint, jwks_uri}'
Every value must start with https:// and name a public host.
Fix
- Set one public base URL in configuration and build all metadata from it, not from the request host.
- Behind a proxy, trust the forwarded protocol and host headers from your own proxy only.
- Keep the loopback addresses for local development environments, never in the production metadata.
- Check the
resource_metadatavalue in your401response too (auth.challenge-401).
Verify
Re-run the two curl commands and confirm no http:// or private address remains, then re-scan. If the identity provider is on another host, also check auth.as-metadata-missing.
Which clients care
General, Claude and ChatGPT, per the rule. The spec guidance is aimed at any client that fetches OAuth discovery URLs.
Source
MCP security best practices (SSRF): https://modelcontextprotocol.io/specification/2026-07-28/basic/security_best_practices
Run a free scan at https://mcpshipyard.com/scan to check every rule at once.
Check every rule at once
A free scan runs this check and the other 152 against your live URL.
Related fixes
- Add Client ID Metadata Documents (CIMD) next to Dynamic Client Registration
- API key or token in the MCP server URL (?key=): why it fails and how to fix
- ChatGPT MCP: dynamic client registration not supported (CIMD or DCR required)
- Claude says "Couldn't reach the MCP server": missing protected resource metadata