5050 azure .identity .DefaultAzureCredential (), "https://cognitiveservices.azure.com/.default"
5151 )
5252 base_model = ChatOpenAI (
53- model = os .environ .get ("AZURE_OPENAI_CHAT_DEPLOYMENT" ),
53+ model = os .environ .get ("AZURE_OPENAI_CHAT_DEPLOYMENT" , "gpt-4o" ),
5454 base_url = os .environ ["AZURE_OPENAI_ENDPOINT" ] + "/openai/v1/" ,
5555 api_key = token_provider ,
5656 )
@@ -88,7 +88,12 @@ async def register_client_via_dcr() -> tuple[str, str]:
8888 )
8989
9090 if response .status_code not in (200 , 201 ):
91- raise Exception (f"DCR failed: { response .status_code } - { response .text } " )
91+ raise Exception (
92+ f"DCR registration failed at { dcr_url } : "
93+ f"status={ response .status_code } , "
94+ f"response={ response .text } , "
95+ f"headers={ dict (response .headers )} "
96+ )
9297
9398 data = response .json ()
9499 client_id = data ["client_id" ]
@@ -116,7 +121,12 @@ async def get_keycloak_token(client_id: str, client_secret: str) -> str:
116121 )
117122
118123 if response .status_code != 200 :
119- raise Exception (f"Failed to get token: { response .status_code } - { response .text } " )
124+ raise Exception (
125+ f"Token request failed at { token_url } : "
126+ f"status={ response .status_code } , "
127+ f"response={ response .text } , "
128+ f"headers={ dict (response .headers )} "
129+ )
120130
121131 token_data = response .json ()
122132 access_token = token_data ["access_token" ]
@@ -137,7 +147,7 @@ async def run_agent() -> None:
137147 logger .info (f"📡 Connecting to MCP server: { MCP_SERVER_URL } " )
138148
139149 # Initialize MCP client with Bearer token auth
140- client = MultiServerMCPClient (
150+ client = MultiServerMCPClient ( # type: ignore[arg-type]
141151 {
142152 "expenses" : {
143153 "url" : MCP_SERVER_URL ,
0 commit comments