Skip to content

Commit 61aee47

Browse files
committed
Fixed pre-commit hooks issues.
1 parent eef2596 commit 61aee47

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

.github/actions/conformance/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ async def run_cross_app_access_complete_flow(server_url: str) -> None:
361361
auth_issuer = context.get("auth_issuer", base_url)
362362
resource_id = context.get("resource_id", server_url)
363363

364-
logger.debug(f"Cross-app access flow:")
364+
logger.debug("Cross-app access flow:")
365365
logger.debug(f" IDP Issuer: {idp_issuer}")
366366
logger.debug(f" IDP Token Endpoint: {idp_token_endpoint}")
367367
logger.debug(f" Auth Issuer: {auth_issuer}")

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2651,7 +2651,7 @@ async def advanced_manual_flow() -> None:
26512651
print(f"Access token obtained, expires in: {access_token.expires_in}s")
26522652

26532653
# Use the access token for API calls
2654-
headers = {"Authorization": f"Bearer {access_token.access_token}"}
2654+
_ = {"Authorization": f"Bearer {access_token.access_token}"}
26552655
# ... make authenticated requests with headers
26562656

26572657

examples/snippets/clients/enterprise_managed_auth_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ async def advanced_manual_flow() -> None:
142142
print(f"Access token obtained, expires in: {access_token.expires_in}s")
143143

144144
# Use the access token for API calls
145-
headers = {"Authorization": f"Bearer {access_token.access_token}"}
145+
_ = {"Authorization": f"Bearer {access_token.access_token}"}
146146
# ... make authenticated requests with headers
147147

148148

src/mcp/client/auth/extensions/enterprise_managed_auth.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66

77
import logging
88
from collections.abc import Awaitable, Callable
9+
from typing import cast
910

1011
import httpx
1112
import jwt
1213
from pydantic import BaseModel, Field
1314
from typing_extensions import TypedDict
1415

1516
from mcp.client.auth import OAuthClientProvider, OAuthFlowError, OAuthTokenError, TokenStorage
16-
from mcp.shared.auth import OAuthClientMetadata, OAuthToken
17+
from mcp.shared.auth import OAuthClientMetadata
1718

1819
logger = logging.getLogger(__name__)
1920

@@ -330,9 +331,11 @@ async def exchange_id_jag_for_access_token(
330331

331332
# Apply client authentication method (handles client_secret_basic vs client_secret_post)
332333
headers: dict[str, str] = {"Content-Type": "application/x-www-form-urlencoded"}
333-
token_data, headers = self.context.prepare_token_auth(token_data, headers)
334+
# Cast to dict[str, str] for prepare_token_auth compatibility
335+
data_dict = cast(dict[str, str], token_data)
336+
data_dict, headers = self.context.prepare_token_auth(data_dict, headers)
334337

335-
return httpx.Request("POST", token_endpoint, data=token_data, headers=headers)
338+
return httpx.Request("POST", token_endpoint, data=data_dict, headers=headers)
336339

337340
async def _perform_authorization(self) -> httpx.Request:
338341
"""Perform enterprise authorization flow.

tests/client/auth/test_enterprise_managed_auth_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ async def test_perform_authorization_full_flow(mock_token_storage: Any, sample_i
472472
@pytest.mark.anyio
473473
async def test_perform_authorization_with_valid_tokens(mock_token_storage: Any, sample_id_jag: str):
474474
"""Test that _perform_authorization uses cached ID-JAG when tokens are valid."""
475-
from mcp.shared.auth import OAuthToken, OAuthMetadata
475+
from mcp.shared.auth import OAuthMetadata, OAuthToken
476476

477477
token_exchange_params = TokenExchangeParameters.from_id_token(
478478
id_token="dummy-token",
@@ -1035,7 +1035,7 @@ async def test_exchange_id_jag_with_existing_auth_method(sample_id_jag: str, moc
10351035
@pytest.mark.anyio
10361036
async def test_perform_authorization_with_valid_tokens_no_id_jag(mock_token_storage: Any):
10371037
"""Test _perform_authorization when tokens are valid but no cached ID-JAG (covers branch 354->360)."""
1038-
from mcp.shared.auth import OAuthToken, OAuthMetadata
1038+
from mcp.shared.auth import OAuthMetadata, OAuthToken
10391039

10401040
token_exchange_params = TokenExchangeParameters.from_id_token(
10411041
id_token="dummy-token",

0 commit comments

Comments
 (0)