We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9721a01 commit 186f821Copy full SHA for 186f821
src/mcp/server/auth/routes.py
@@ -1,5 +1,5 @@
1
from collections.abc import Awaitable, Callable
2
-from typing import Any, cast
+from typing import Any
3
4
from pydantic import AnyHttpUrl
5
from starlette.middleware.cors import CORSMiddleware
@@ -32,8 +32,11 @@ def validate_issuer_url(url: AnyHttpUrl):
32
"""
33
34
# RFC 8414 requires HTTPS, but we allow localhost HTTP for testing
35
- host = cast(str, url.host)
36
- if url.scheme != "https" and host != "localhost" and not host.startswith("127.0.0.1"):
+ if (
+ url.scheme != "https"
37
+ and url.host != "localhost"
38
+ and (url.host is not None and not url.host.startswith("127.0.0.1"))
39
+ ):
40
raise ValueError("Issuer URL must be HTTPS")
41
42
# No fragments or query parameters allowed
0 commit comments