`import tinyagent` raises NameError with mcp >= 2.0
@tonycoder-hub がすでに取り組んでいます。
2026年9月28日 から。
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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:
-
Cap the dependency at
mcp<2. -
mcp_client.pyrecordsmissing_mcp_errorand raises a readable ImportError frommodel_post_init, but that guard never runs:ClientSessionandMCPToolare referenced in annotations evaluated at class creation, so the module raises NameError during import first. Binding both to placeholders in theexcept ImportErrorbranch 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.
- 主要言語
- Python
- スター
- 33
- フォーク
- 7
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
mozilla-ai/tinyagent のほかの issue
-
Running an agent mutates the caller-provided message list対応中かも @cyyecao-lappland が 24 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
mozilla-ai/tinyagent#27 ·
-
Add Python 3.14 support対応中かも @barredterra が 125 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
mozilla-ai/tinyagent#16 ·
-
Invalid JSON tool arguments abort the run or prematurely return a final-answer error対応中かも @cyyecao-lappland が 24 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
mozilla-ai/tinyagent#29 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
mozilla-ai/tinyagent#24 ·
-
`uses_openai` gateway prefix is unreachable since any-llm retired the `gateway` provider対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 5/5 1週間以上 初心者へのやさしさ 42/100
mozilla-ai/tinyagent#23 · コメント 2 件 ·
mozilla-ai/tinyagent の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
yzhao062/awesome-auditable-ai#45 ·
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
NVIDIA/flare-local-inference#90 ·
メンテナーはふだん 1 日以内に返信
-
area/streaming comp/gateway P2 platform/telegram type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NousResearch/hermes-agent#144897 ·
メンテナーはふだん 1 日以内に返信
-
request-theme
難易度 1/5 1時間未満 初心者へのやさしさ 66/100
LizardByte/ThemerrDB#9575 ·
メンテナーはふだん 1 日以内に返信