Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

`import tinyagent` raises NameError with mcp >= 2.0

Đang mở
#22 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

@tonycoder-hub đang làm issue này rồi.

Từ ngày 28/9/2026.

  • #25 của @tonycoder-hub — đang mở
  • #28 của @cyyecao-lappland — đang mở
  • #30 của @cyyecao-lappland — đang mở

Đánh giá

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

Hướng nghiên cứu

Start by reproducing the failure with the pip install and python import commands from the issue. Inspect the dependency declaration and tinyagent/tools/mcp/mcp_client.py, including its ImportError handling and annotations. Done means mcp is capped below 2 and importing tinyagent succeeds or produces the existing readable ImportError instead of a NameError.

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

Mô tả

mozilla-ai-tinyagent 0.1.1 declares mcp without an upper bound, and mcp 2.0 renamed mcp.client.streamable_http.streamablehttp_client to streamable_http_client. A fresh install resolves mcp 2.2.0 and the package cannot be imported.

pip install mozilla-ai-tinyagent
python -c "import tinyagent"
File ".../tinyagent/tools/mcp/mcp_client.py", line 88, in MCPClient
    async def list_raw_tools(self) -> list[MCPTool]:
NameError: name 'MCPTool' is not defined

Two fixes, both worth making:

  1. Cap the dependency at mcp<2.

  2. mcp_client.py records missing_mcp_error and raises a readable ImportError from model_post_init, but that guard never runs: ClientSession and MCPTool are referenced in annotations evaluated at class creation, so the module raises NameError during import first. Binding both to placeholders in the except ImportError branch makes the existing guard work, so a future mcp change degrades instead of breaking the import.

This also breaks any-agent, which imports tinyagent.config at package import and now hard-depends on this package. any-agent is capping mcp on its side, but that does not help direct tinyagent users.

Note: this issue was drafted by Claude Opus 5 via back-and-forth with @njbrake. The reasoning and decisions are his; the prose is Claude's.

Ngôn ngữ chính
Python
Star
34
Fork
7
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của mozilla-ai/tinyagent

Tất cả issue của mozilla-ai/tinyagent

Issue tương tự

Thêm issue về Python

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.