Static review of public source at commit 6affe5c0d358. No traffic was sent to any MCP environment.
OAuth route helpers wrap several endpoints with Starlette CORSMiddleware and a wildcard origin:
src/mcp/server/auth/routes.py:
def _cors(app: ASGIApp, allow_methods: list[str]) -> ASGIApp:
return CORSMiddleware(
app=app,
allow_origins="*",
allow_methods=allow_methods,
allow_headers=[MCP_PROTOCOL_VERSION_HEADER],
)
That wrapper is used for /.well-known/oauth-authorization-server, /token, and (when enabled) /register and /revoke. Wildcard ACAO is intentional for browser-based inspectors, and allow_credentials is not set here (browsers will not attach cookies under the * + credentials rule). Still, token and dynamic-registration endpoints are sensitive: a wildcard makes any future “reflect Origin + credentials” change, or a non-browser client that ignores CORS, easier to misuse.
Suggested change:
- Keep
* only on public metadata handlers.
- For
/token, /register, and /revoke, take an explicit allowed_origins list (or reuse TransportSecuritySettings.allowed_origins) and document the Inspector origin as an example allowlist entry.
- Add a one-line comment that credentials must stay off while
* remains.
Severity: low / configuration clarity and defense-in-depth. Not reported as an exploitable CORS bypass with the current header pair. No proof-of-concept.
Happy to send a focused PR if useful.
Static review of public source at commit
6affe5c0d358. No traffic was sent to any MCP environment.OAuth route helpers wrap several endpoints with Starlette
CORSMiddlewareand a wildcard origin:src/mcp/server/auth/routes.py:That wrapper is used for
/.well-known/oauth-authorization-server,/token, and (when enabled)/registerand/revoke. Wildcard ACAO is intentional for browser-based inspectors, andallow_credentialsis not set here (browsers will not attach cookies under the*+ credentials rule). Still, token and dynamic-registration endpoints are sensitive: a wildcard makes any future “reflect Origin + credentials” change, or a non-browser client that ignores CORS, easier to misuse.Suggested change:
*only on public metadata handlers./token,/register, and/revoke, take an explicitallowed_originslist (or reuseTransportSecuritySettings.allowed_origins) and document the Inspector origin as an example allowlist entry.*remains.Severity: low / configuration clarity and defense-in-depth. Not reported as an exploitable CORS bypass with the current header pair. No proof-of-concept.
Happy to send a focused PR if useful.