-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
Initial Checks
- I confirm that I'm using the latest version of MCP Python SDK
- I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue
Description
| File "/app/app/clients/mcp_client.py", line 98, in connect_and_get_tool
| self._adapter = await StreamableHttpMcpToolAdapter.from_server_params(
| File "/usr/local/lib/python3.10/dist-packages/autogen_ext/tools/mcp/_base.py", line 140, in from_server_params
| async with create_mcp_server_session(server_params) as session:
| File "/usr/lib/python3.10/contextlib.py", line 217, in aexit
| await self.gen.athrow(typ, value, traceback)
| File "/usr/local/lib/python3.10/dist-packages/autogen_ext/tools/mcp/_session.py", line 40, in create_mcp_server_session
| async with streamablehttp_client(**params_dict) as (
| File "/usr/lib/python3.10/contextlib.py", line 217, in aexit
| await self.gen.athrow(typ, value, traceback)
| File "/usr/local/lib/python3.10/dist-packages/mcp/client/streamable_http.py", line 480, in streamablehttp_client
| async with anyio.create_task_group() as tg:
| File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py", line 783, in aexit
| raise BaseExceptionGroup(
| exceptiongroup.ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/usr/local/lib/python3.10/dist-packages/mcp/client/streamable_http.py", line 411, in handle_request_async
| await self._handle_post_request(ctx)
| File "/usr/local/lib/python3.10/dist-packages/mcp/client/streamable_http.py", line 280, in _handle_post_request
| response.raise_for_status()
| File "/usr/local/lib/python3.10/dist-packages/httpx/_models.py", line 829, in raise_for_status
| raise HTTPStatusError(message, request=request, response=self)
| httpx.HTTPStatusError: Client error '421 Misdirected Request' for url 'http://10.244.209.39:18658/mcp/time_manager/'
| For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/421
Example Code
Python & MCP Python SDK
1.24.0