Repository navigation
fix(mcp): re-cap mcp dependency below 2.0 - #2941
Conversation
setup.py's [mcp] extra pins mcp>=1.1.0,<3.0, but the comment directly above it still says the dependency is "Capped below 2.0" because mcp 2.0.0 breaks MCPClient.connect(). The pin and the comment contradict each other, so a fresh install can silently resolve an incompatible mcp 2.x. Add a static packaging test that fails whenever the pin's upper bound drifts from <2.0 while the comment still claims that cap, so the contradiction can't return unnoticed. Currently red against the unfixed setup.py; the next commit fixes the pin.
…n constant Investigation while this guard was under review found the "breaks MCPClient.connect()" framing imprecise: MCPClient (src/gaia/mcp/client/ mcp_client.py) never imports the mcp package at all, so that specific method cannot break from an mcp version bump. The real break is mcp 2.0.0 removing mcp.server.fastmcp (FastMCP -> MCPServer), which every FastMCP-based server GAIA ships depends on. Update the test's docstrings and assertion messages to describe the verified mechanism instead of the stale one, and factor the expected pin/comment strings into named constants so a legitimate future change (the client port) only needs to update one place.
main's [mcp] extra pinned mcp>=1.1.0,<3.0, which resolves to mcp 2.0.0 today. That release removed mcp.server.fastmcp (FastMCP renamed to MCPServer, moved to mcp.server.mcpserver), so every FastMCP-based MCP server GAIA ships (agent_mcp_server.py, servers/agent_ui_mcp.py, servers/tui_mcp.py, and servers/docker_mcp.py transitively) fails to import under it. A prior fix correctly capped this at <2.0; a later mechanical dependency bump widened it again without the client port the adjacent comment calls for. Re-cap at <2.0 (mcp 1.29.0, the version this pin actually resolves to today) and correct the comment's description of the break -- it named MCPClient.connect() specifically, but that hand-rolled client imports no code from the mcp package; the failure is in GAIA's own MCP-server wrapping code, whose subprocess dies on import. Porting those servers to the mcp 2.x API is tracked separately since it needs a live wire-protocol round trip to verify, not just an import-level check.
Approve with suggestionsThis restores the mcp dependency cap to One thing to fix before merge: the new test file's own docstrings still describe the broken state in the present tense — they say the pin "reads Real-world evidenceN/A — packaging and test-only change with no runnable user surface; no evidence bundle was produced for this PR. My verdict rests on static review: I confirmed the imports the cap protects and traced the parsing logic by hand, but I could not execute 🔍 Technical detailsIssues🟢 Docstrings describe the pre-fix state as current ( and at 🟢 Prose wording is now a CI gate ( 🟢 Verified
Strengths
|
Verdict: Approve with suggestionsThis restores the mcp dependency cap to below 2.0 and adds a CI guard so it can't quietly widen again. The fix is right: GAIA's three MCP servers all import the module that mcp 2.0 deleted, so any install that resolved a 2.x would have shipped broken MCP servers. One thing to fix before merge is cosmetic but misleading: the new test file's docstrings still describe the old, broken state ("the pin currently reads Worth a follow-up thought: the widening came from an automated dependency bump, and nothing stops the same bump from being proposed again next week. The new guard will now turn that into a red build instead of a silent regression — which is the important half — but telling the dependency bot to leave this one alone would stop the weekly churn entirely. Real-world evidenceN/A — packaging + tests-only change with no runnable user surface; no evidence bundle was produced for this run. My verdict rests on static review: I confirmed against the checked-out tree that all three MCP servers import the module mcp 2.0 removed, that setup.py contains the only mcp pin in the repo, and that the CI job running these unit tests is triggered by setup.py changes, so the guard actually fires on a future widening. I could not execute the test suite in this environment (shell unavailable), so the new tests are reviewed by reading, not by running — please confirm CI is green. 🔍 Technical detailsVerified
🟢 Minor — stale docstrings describe the pre-fix state ( Both say the pin reads And at 🟢 Minor — the bump will be re-proposed (
🟢 Minor — the two tests overlap (
🟢 Minor — Strengths
|
…ix the sidecar's code-index root SkillLibraryToolsMixin imported nothing gaia-agent-specific — it is general 'let the model manage its own skill library' capability, and its four trust refusals are framework decisions a second agent would have re-derived. It now lives in gaia.agents.tools.skill_library_tools, is composable by name (KNOWN_TOOLS['skills']), and the old import path re-exports it. GaiaAgent's code index was rooted at os.getcwd() — the same wrong cwd its allowed_paths field documents rejecting (the daemon launches the sidecar with cwd = the package directory), so code search was sandboxed to the agent's own source tree and indexed it by default. It now shares allowed_paths' scope. The base class also moves first in the MRO, matching every other hub agent so a future mixin method can't silently win over ChatAgent's. setup.py's mcp comment is aligned with the block main merged in amd#2941, so the branches no longer conflict on that hunk.
Installing GAIA's
[mcp]extra today can resolvemcp2.0.0, which silently breaks every MCP server GAIA ships — not just onmain, but in thev0.23.0tag as already released. mcp 2.0.0 removed the API GAIA's server code imports (mcp.server.fastmcp.FastMCP, renamed toMCPServerand relocated), so any custom agent exposed as an MCP server, the TUI MCP server, and the Agent UI MCP server all fail to even import. GAIA's own CI already caught this — the "Custom agent MCP harness" job has been failing on thev0.23.0release branch — but that job doesn't block merges, so it shipped anyway.Verified independently:
main's tip, thev0.23.0release PR's head commit, and thev0.23.0tag itself all currently carry the broken<3.0cap. #2885's "not a v0.23.0 blocker" line is inaccurate; a follow-up comment on that issue covers it separately.This restores the
<2.0cap that a routine dependency bump had widened without doing the accompanying client port its own code comment called for, corrects that comment's description of what breaks (the hand-rolledMCPClient.connect()it named doesn't import themcppackage at all — the real failure is in GAIA's FastMCP-based server code), and adds a test that fails if the cap widens again without that port. The actual port to the mcp 2.x API is tracked separately (#2940) since it needs a live client/server round trip to verify, not just an import-level fix.Closes #2885
Test plan
python -m pytest tests/unit/test_mcp_extras.py -v— both new guard tests passpip install 'mcp>=1.1.0,<3.0'resolves tomcp==2.0.0;from mcp.server.fastmcp import FastMCPraisesModuleNotFoundErrorpip install -e ".[mcp]"resolves tomcp==1.29.0;from mcp.server.fastmcp import FastMCPsucceedstests/installer/test_custom_agent_mcp_harness.py— all 3 pass under the fixed cap (mcp 1.29.0); controlled A/B in the same venv forced to mcp 2.0.0 reproduces 1 of the 3 failing ("Unknown tool name" — the dummy MCP server dies on the same import before it can register its tool)python util/lint.py --allpassesReproduction evidence (before / after)
Before fix — today's
<3.0cap resolves to mcp 2.0.0:Before fix — the API GAIA's MCP servers import does not exist under it:
After fix — clean venv, fixed cap:
Controlled A/B — same venv, same test file, only the mcp version changes:
Root cause of that one failure: the harness's own dummy MCP server fixture (
tests/fixtures/mcp/dummy_server/server.py) has the samefrom mcp.server.fastmcp import FastMCPimport, so under mcp 2.0.0 it crashes on startup before it can register its tool — the client never sees it, hence "Unknown tool name" rather than a connection error.Live-CI corroboration (not generated for this PR — already existing, found while investigating):
build-installers.yml's "Custom agent MCP harness" job has failed with the identicalassert 'error' == 'success'signature on thev0.23.0release branch's own CI runs, on bothubuntu-latestandwindows-latest. That job isn't required for merge, so it shipped anyway.