MCPcopy Index your code
hub / github.com/modelcontextprotocol/python-sdk / ProviderTokenVerifier

Class ProviderTokenVerifier

src/mcp/server/auth/provider.py:285–298  ·  view source on GitHub ↗

Token verifier that uses an OAuthAuthorizationServerProvider. This is provided for backwards compatibility with existing auth_server_provider configurations. For new implementations using AS/RS separation, consider using the TokenVerifier protocol with a dedicated implementation like In

Source from the content-addressed store, hash-verified

283
284
285class ProviderTokenVerifier(TokenVerifier):
286 """Token verifier that uses an OAuthAuthorizationServerProvider.
287
288 This is provided for backwards compatibility with existing auth_server_provider
289 configurations. For new implementations using AS/RS separation, consider using
290 the TokenVerifier protocol with a dedicated implementation like IntrospectionTokenVerifier.
291 """
292
293 def __init__(self, provider: "OAuthAuthorizationServerProvider[AuthorizationCode, RefreshToken, AccessToken]"):
294 self.provider = provider
295
296 async def verify_token(self, token: str) -> AccessToken | None:
297 """Verify token using the provider's load_access_token method."""
298 return await self.provider.load_access_token(token)

Callers 12

__init__Method · 0.90
test_no_auth_headerMethod · 0.90
test_invalid_tokenMethod · 0.90
test_expired_tokenMethod · 0.90
test_valid_tokenMethod · 0.90
connect_with_oauthFunction · 0.90
as_appFunction · 0.90

Calls

no outgoing calls

Tested by 10

test_no_auth_headerMethod · 0.72
test_invalid_tokenMethod · 0.72
test_expired_tokenMethod · 0.72
test_valid_tokenMethod · 0.72
as_appFunction · 0.72