Spaces:
Sleeping
Sleeping
apple muncy
commited on
Commit
·
e0507be
1
Parent(s):
8a76396
update to MCP 1.13.0
Browse filesSigned-off-by: apple muncy <[email protected]>
- requirements.txt +1 -1
- token_verifier.py +3 -2
requirements.txt
CHANGED
@@ -1 +1 @@
|
|
1 |
-
mcp==1.
|
|
|
1 |
+
mcp==1.13.0
|
token_verifier.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
"""Example token verifier implementation using OAuth 2.0 Token Introspection (RFC 7662)."""
|
2 |
|
3 |
import logging
|
|
|
4 |
|
5 |
from mcp.server.auth.provider import AccessToken, TokenVerifier
|
6 |
from mcp.shared.auth_utils import check_resource_allowed, resource_url_from_server_url
|
@@ -79,13 +80,13 @@ class IntrospectionTokenVerifier(TokenVerifier):
|
|
79 |
logger.warning(f"Token introspection failed: {e}")
|
80 |
return None
|
81 |
|
82 |
-
def _validate_resource(self, token_data: dict) -> bool:
|
83 |
"""Validate token was issued for this resource server."""
|
84 |
if not self.server_url or not self.resource_url:
|
85 |
return False # Fail if strict validation requested but URLs missing
|
86 |
|
87 |
# Check 'aud' claim first (standard JWT audience)
|
88 |
-
aud = token_data.get("aud")
|
89 |
if isinstance(aud, list):
|
90 |
for audience in aud:
|
91 |
if self._is_valid_resource(audience):
|
|
|
1 |
"""Example token verifier implementation using OAuth 2.0 Token Introspection (RFC 7662)."""
|
2 |
|
3 |
import logging
|
4 |
+
from typing import Any
|
5 |
|
6 |
from mcp.server.auth.provider import AccessToken, TokenVerifier
|
7 |
from mcp.shared.auth_utils import check_resource_allowed, resource_url_from_server_url
|
|
|
80 |
logger.warning(f"Token introspection failed: {e}")
|
81 |
return None
|
82 |
|
83 |
+
def _validate_resource(self, token_data: dict[str, Any]) -> bool:
|
84 |
"""Validate token was issued for this resource server."""
|
85 |
if not self.server_url or not self.resource_url:
|
86 |
return False # Fail if strict validation requested but URLs missing
|
87 |
|
88 |
# Check 'aud' claim first (standard JWT audience)
|
89 |
+
aud: list[str] | str | None = token_data.get("aud")
|
90 |
if isinstance(aud, list):
|
91 |
for audience in aud:
|
92 |
if self._is_valid_resource(audience):
|