1818)
1919from mcp .server .auth .provider import (
2020 AccessToken ,
21- OAuthServerProvider ,
21+ OAuthAuthorizationServerProvider ,
2222)
2323
2424
@@ -42,7 +42,7 @@ async def load_access_token(self, token: str) -> AccessToken | None:
4242
4343
4444def add_token_to_provider (
45- provider : OAuthServerProvider [Any , Any , Any ], token : str , access_token : AccessToken
45+ provider : OAuthAuthorizationServerProvider [Any , Any , Any ], token : str , access_token : AccessToken
4646) -> None :
4747 """Helper function to add a token to a provider.
4848
@@ -70,10 +70,10 @@ async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
7070
7171
7272@pytest .fixture
73- def mock_oauth_provider () -> OAuthServerProvider [Any , Any , Any ]:
73+ def mock_oauth_provider () -> OAuthAuthorizationServerProvider [Any , Any , Any ]:
7474 """Create a mock OAuth provider."""
7575 # Use type casting to satisfy the type checker
76- return cast (OAuthServerProvider [Any , Any , Any ], MockOAuthProvider ())
76+ return cast (OAuthAuthorizationServerProvider [Any , Any , Any ], MockOAuthProvider ())
7777
7878
7979@pytest .fixture
@@ -114,7 +114,7 @@ class TestBearerAuthBackend:
114114 """Tests for the BearerAuthBackend class."""
115115
116116 async def test_no_auth_header (
117- self , mock_oauth_provider : OAuthServerProvider [Any , Any , Any ]
117+ self , mock_oauth_provider : OAuthAuthorizationServerProvider [Any , Any , Any ]
118118 ):
119119 """Test authentication with no Authorization header."""
120120 backend = BearerAuthBackend (provider = mock_oauth_provider )
@@ -123,7 +123,7 @@ async def test_no_auth_header(
123123 assert result is None
124124
125125 async def test_non_bearer_auth_header (
126- self , mock_oauth_provider : OAuthServerProvider [Any , Any , Any ]
126+ self , mock_oauth_provider : OAuthAuthorizationServerProvider [Any , Any , Any ]
127127 ):
128128 """Test authentication with non-Bearer Authorization header."""
129129 backend = BearerAuthBackend (provider = mock_oauth_provider )
@@ -137,7 +137,7 @@ async def test_non_bearer_auth_header(
137137 assert result is None
138138
139139 async def test_invalid_token (
140- self , mock_oauth_provider : OAuthServerProvider [Any , Any , Any ]
140+ self , mock_oauth_provider : OAuthAuthorizationServerProvider [Any , Any , Any ]
141141 ):
142142 """Test authentication with invalid token."""
143143 backend = BearerAuthBackend (provider = mock_oauth_provider )
@@ -152,7 +152,7 @@ async def test_invalid_token(
152152
153153 async def test_expired_token (
154154 self ,
155- mock_oauth_provider : OAuthServerProvider [Any , Any , Any ],
155+ mock_oauth_provider : OAuthAuthorizationServerProvider [Any , Any , Any ],
156156 expired_access_token : AccessToken ,
157157 ):
158158 """Test authentication with expired token."""
@@ -171,7 +171,7 @@ async def test_expired_token(
171171
172172 async def test_valid_token (
173173 self ,
174- mock_oauth_provider : OAuthServerProvider [Any , Any , Any ],
174+ mock_oauth_provider : OAuthAuthorizationServerProvider [Any , Any , Any ],
175175 valid_access_token : AccessToken ,
176176 ):
177177 """Test authentication with valid token."""
@@ -195,7 +195,7 @@ async def test_valid_token(
195195
196196 async def test_token_without_expiry (
197197 self ,
198- mock_oauth_provider : OAuthServerProvider [Any , Any , Any ],
198+ mock_oauth_provider : OAuthAuthorizationServerProvider [Any , Any , Any ],
199199 no_expiry_access_token : AccessToken ,
200200 ):
201201 """Test authentication with token that has no expiry."""
0 commit comments