Skip to content

Commit 87288eb

Browse files
committed
fix(auth): add lax no cover to Protocol stubs for Python 3.14 coverage
1 parent ea5910d commit 87288eb

File tree

4 files changed

+20
-11
lines changed

4 files changed

+20
-11
lines changed

src/mcp/client/auth/_oauth_401_flow.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ class _OAuth401FlowProvider(Protocol):
3535
"""Provider interface for oauth_401_flow_generator (OAuthClientProvider duck type)."""
3636

3737
@property
38-
def context(self) -> Any: ...
38+
def context(self) -> Any: ... # pragma: lax no cover
3939

40-
async def _perform_authorization(self) -> httpx.Request: ...
40+
async def _perform_authorization(self) -> httpx.Request: ... # pragma: lax no cover
4141

42-
async def _handle_token_response(self, response: httpx.Response) -> None: ...
42+
async def _handle_token_response(self, response: httpx.Response) -> None: ... # pragma: lax no cover
4343

4444

4545
logger = logging.getLogger(__name__)

src/mcp/client/auth/multi_protocol.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ def _credentials_to_storage(credentials: AuthCredentials) -> AuthCredentials | O
127127
class _OAuthTokenOnlyStorage(Protocol):
128128
"""OAuthToken-only storage contract (wrapped by OAuthTokenStorageAdapter)."""
129129

130-
async def get_tokens(self) -> OAuthToken | None: ...
130+
async def get_tokens(self) -> OAuthToken | None: ... # pragma: lax no cover
131131

132-
async def set_tokens(self, tokens: OAuthToken) -> None: ...
132+
async def set_tokens(self, tokens: OAuthToken) -> None: ... # pragma: lax no cover
133133

134134

135135
class OAuthTokenStorageAdapter:

src/mcp/client/auth/protocol.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,23 @@
1515
class DPoPStorage(Protocol):
1616
"""Storage interface for DPoP key pairs."""
1717

18-
async def get_key_pair(self, protocol_id: str) -> Any: ...
19-
async def set_key_pair(self, protocol_id: str, key_pair: Any) -> None: ...
18+
async def get_key_pair(self, protocol_id: str) -> Any: ... # pragma: lax no cover
19+
20+
async def set_key_pair(self, protocol_id: str, key_pair: Any) -> None: ... # pragma: lax no cover
2021

2122

2223
class DPoPProofGenerator(Protocol):
2324
"""DPoP proof generator interface."""
2425

25-
def generate_proof(self, method: str, uri: str, credential: str | None = None, nonce: str | None = None) -> str: ...
26-
def get_public_key_jwk(self) -> dict[str, Any]: ...
26+
def generate_proof( # pragma: lax no cover
27+
self,
28+
method: str,
29+
uri: str,
30+
credential: str | None = None,
31+
nonce: str | None = None,
32+
) -> str: ...
33+
34+
def get_public_key_jwk(self) -> dict[str, Any]: ... # pragma: lax no cover
2735

2836

2937
class ClientRegistrationResult(Protocol):

src/mcp/server/auth/dpop.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ async def check_and_store(self, jti: str, exp_time: float) -> bool:
5656
class DPoPNonceStore(Protocol):
5757
"""Protocol for server-managed DPoP nonce (optional feature)."""
5858

59-
async def generate_nonce(self) -> str: ...
60-
async def validate_nonce(self, nonce: str) -> bool: ...
59+
async def generate_nonce(self) -> str: ... # pragma: lax no cover
60+
61+
async def validate_nonce(self, nonce: str) -> bool: ... # pragma: lax no cover
6162

6263

6364
class InMemoryJTIReplayStore:

0 commit comments

Comments
 (0)