anthropics / anthropics/skills

mcp-builder: requirements.txt allows mcp>=2, where connections.py fails at import (streamablehttp_client renamed)

Đang mở Phù hợp với người mới
#1,668 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
176k
Fork
20.9k
Merge trung bình
7 giờ 21 phút
Pull request đã merge (30 ngày)
5

Mô tả

## Summary

`skills/mcp-builder/scripts/requirements.txt` pins `mcp>=1.1.0` with no upper bound. The MCP Python SDK is now at 2.x, where `streamablehttp_client` has been **renamed** to `streamable_http_client`. `connections.py` imports the old name at module scope, so a fresh install of the documented requirements fails at import — before any MCP server, evaluation file, or API key is involved.

This is the first thing anyone following the Phase-4 instructions hits today.

## Repro

```bash
python -m venv .venv
.venv/bin/pip install -r skills/mcp-builder/scripts/requirements.txt # resolves mcp 2.x
.venv/bin/python skills/mcp-builder/scripts/evaluation.py -t stdio -c node -a server.js eval.xml
```

```
Traceback (most recent call last):
File ".../scripts/evaluation.py", line 19, in
from connections import create_connection
File ".../scripts/connections.py", line 10, in
from mcp.client.streamable_http import streamablehttp_client
ImportError: cannot import name 'streamablehttp_client' from 'mcp.client.streamable_http'
```

Confirmed on `mcp` 2.1.1:

```python
>>> import mcp.client.streamable_http as s
>>> [n for n in dir(s) if 'client' in n.lower()]
['ClientMessageMetadata', 'create_mcp_http_client', 'streamable_http_client']
```

## Fix

Either cap the requirement:

```
mcp>=1.1.0,<2
```

or support both names in `connections.py`:

```python
try:
from mcp.client.streamable_http import streamable_http_client
except ImportError: # mcp < 2
from mcp.client.streamable_http import streamablehttp_client as streamable_http_client
```

The second is preferable — pinning `<2` in a shared environment holds back anything else on the machine using the SDK, which pushes users toward a throwaway venv for what should be a two-line install.

## Environment

- Windows 11, Python 3.13.14
- `mcp` 2.1.1 (fails), 1.29.1 (works)
- `anthropic` 1.0.0

## Context

Found while running the Phase-4 evaluation against a stdio MCP server exposing 66 tools. It was one of several independent failures between "follow the skill's instructions" and "get a score"; the others are #1390, #1386, and the report-write bug filed alongside this one. Happy to send a PR for whichever fix you prefer.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Start with skills/mcp-builder/scripts/requirements.txt and skills/mcp-builder/scripts/connections.py, then run the documented virtualenv installation and evaluation.py command. Verify that importing connections succeeds with mcp 2.1.1 while preserving compatibility with mcp 1.29.1, and confirm the Phase-4 evaluation can proceed past startup.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
tooling
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
85/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.