Skip to content

Commit aca6036

Browse files
committed
fix: scope issuer loopback exception to http scheme only
1 parent cdbc445 commit aca6036

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/mcp/server/auth/url_validators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""OAuth 2.0 URL validation helpers for MCP authorization servers.
1+
"""OAuth 2.0 URL validation helpers for MCP authorization servers.
22
33
RFC 9700 4.1.1 and RFC 7591 2 require HTTPS for authorization endpoint URLs
44
and registered redirect_uris, with an HTTP loopback exception for local
@@ -17,7 +17,7 @@ def validate_issuer_url(url: AnyUrl):
1717
Raises:
1818
ValueError: If the issuer URL is invalid.
1919
"""
20-
if url.scheme != "https" and url.host not in ("localhost", "127.0.0.1", "[::1]"):
20+
if url.scheme != "https" and not (url.scheme == "http" and url.host in ("localhost", "127.0.0.1", "[::1]")):
2121
raise ValueError("Issuer URL must be HTTPS")
2222

2323
if url.fragment:

0 commit comments

Comments
 (0)