File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 5050 from websockets .client import ClientConnection # type: ignore
5151 from websockets .client import connect as ws_connect # type: ignore
5252
53+ try :
54+ from google .auth .transport import requests
55+ except ImportError :
56+ requests = None # type: ignore[assignment]
57+
5358if typing .TYPE_CHECKING :
5459 from mcp import ClientSession as McpClientSession
5560 from mcp .types import Tool as McpTool
@@ -1027,7 +1032,9 @@ async def connect(
10271032 # creds.valid is False, and creds.token is None
10281033 # Need to refresh credentials to populate those
10291034 if not (creds .token and creds .valid ):
1030- auth_req = google .auth .transport .requests .Request () # type: ignore
1035+ if requests is None :
1036+ raise ValueError ('The requests module is required to refresh google-auth credentials. Please install with `pip install google-auth[requests]`' )
1037+ auth_req = requests .Request () # type: ignore
10311038 creds .refresh (auth_req )
10321039 bearer_token = creds .token
10331040
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ classifiers = [
2626]
2727dependencies = [
2828 " anyio>=4.8.0, <5.0.0" ,
29- " google-auth>=2.14.1, <3.0.0" ,
29+ " google-auth[requests] >=2.14.1, <3.0.0" ,
3030 " httpx>=0.28.1, <1.0.0" ,
3131 " pydantic>=2.9.0, <3.0.0" ,
3232 " requests>=2.28.1, <3.0.0" ,
You can’t perform that action at this time.
0 commit comments