MCPClient StreamableHTTP import breaks with mcp>=2.0.0 (streamablehttp_client renamed to streamable_http_client)
envgap__huggingface__huggingface_hub-4733
01 / FAILURE SIGNATURE
As reported upstream
ImportError: cannot import name 'streamablehttp_client' from 'mcp.client.streamable_http'
Not a benchmark task.
- The project already builds and runs before the fix, so there is nothing to repair.
02 / ENVIRONMENT RECIPE
- Base commit
9d11a150912d68a06ab5784ec897046fbd09a4b7- Manifest
setup.py- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
huggingface/huggingface_hub #4733 · read the original issue
### Describe the bug
`MCPClient`'s StreamableHTTP connection path still imports the pre-2.0 `mcp` SDK symbol name, which was renamed/removed in `mcp==2.0.0`:
https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/inference/_mcp/mcp_client.py#L186
```python
elif type == "http":
# Handle StreamableHTTP server
from mcp.client.streamable_http import streamablehttp_client
```
As of `mcp==2.0.0`, this function was renamed to `streamable_http_client` (with an underscore between `streamable` and `http`) — `streamablehttp_client` no longer exists. Confirmed against the latest `huggingface_hub` release (1.28.0), the import is unchanged.
### Reproduction
```python
from huggingface_hub import MCPClient
client = MCPClient()
await client.add_mcp_server(type="http", url="http://localhost:8000/mcp")
```
with `mcp>=2.0.0` installed raises:
```
ImportError: cannot import name 'streamablehttp_client' from 'mcp.client.streamable_http'
```
### Expected behavior
The import should use the current `mcp` SDK name:
```python
from mcp.client.streamable_http import streamable_http_client
```
(possibly with a fallback for older `mcp<2.0.0` installs, since `huggingface_hub` doesn't currently pin an `mcp` version).
### Environment
- `huggingface_hub` version: 1.28.0 (latest, confirmed via the published wheel; also reproduced with 1.15.0/0.31.2)
- `mcp` version: 2.0.0+ (any version where the rename applies)
- Discovered while debugging an unrelated `ImportError` in a downstream project (`mcp` is pulled in independently, not as a declared `huggingface_hub` dependency)
04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]