Repository navigation
fix(connectors): pin every catalog MCP server to an exact version - #4356
Conversation
Catalog MCP servers launched at whatever npm served that day, so an upstream tool rename broke users' connectors with no GAIA change; they now launch at tested, exact versions and a unit test rejects any unpinned or @latest spec. - Tavily, GitHub, and Memory are pinned to their current releases; each was launched and its tool list checked. - The Git connector pointed at an npm package that was never published, so it could not start at all. It now runs the reference server from PyPI via uvx. - The Tavily docs named tools that no longer exist (tavily-search); they are tavily_search / tavily_extract in the pinned release. - docs/reference/dependency-management.mdx gains the manual refresh steps, since Dependabot can't read pins held in Python string literals. Fixes amd#4351
Verdict: Approve with suggestionsCatalog MCP connectors now launch at an exact version instead of whatever the registry served that day, a unit test fails any spec that isn't pinned, and the Git connector is switched off an npm package that never existed onto the real one from PyPI. This is a solid fix for a real breakage class, and the pins check out — I verified all four against npm/PyPI and they are the current releases. Two things worth handling before merge, neither a blocker on the pinning itself:
Smaller points (write capability of the Git server, the guard's coverage, and the un-linked follow-up issue) are in the details below. Real-world evidenceNo I confirmed independently against the live registries: Beyond that, the verdict rests on static review: the connector is not exercised through the Agent UI or a live agent here. 🔍 Technical details🟡 Important1. A missing
This shape predates the PR, but it bites much harder now: (Needs 2. Unpinned MCP spawns outside the catalog ( super().__init__(command=["npx", "-y", "@upstash/context7-mcp"], env=env)
...
command=["npx", "-y", "server-perplexity-ask"],Identical failure mode to the one this PR fixes — an upstream rename breaks 🟢 Minor3. The guard covers one module, not "every catalog MCP server" ( Importing 4.
Same clause is worth adding to the Git bullet in 5. The deferred GitHub-connector problems have no issue to point at The description says the deprecation and the Strengths
|
amd#4359) Stacked on amd#4356 — merge that first. Connecting GitHub did nothing: GAIA passed the token as `GITHUB_TOKEN`, but the GitHub MCP server only reads `GITHUB_PERSONAL_ACCESS_TOKEN`, so every call went out anonymous. Private repos were invisible and users hit the unauthenticated rate limit. After this change, a newly connected GitHub account authenticates, and disconnecting or reconnecting an old connection also removes the token it stored under the old name. - **Existing installs keep the old env mapping until amd#4358 is solved.** Their saved `~/.gaia/mcp_servers.json` entry still names `GITHUB_TOKEN`, so they stay unauthenticated until the user reconnects GitHub. The GitHub connector page now tells them to. - **Follow-up (not in this PR):** `@modelcontextprotocol/server-github` is deprecated upstream, and 2025.4.8 is its final release. Moving to GitHub's maintained server (`github/github-mcp-server`) needs its own PR. <details> <summary>🔍 Technical details</summary> - Verified against the pinned package: `npm pack @modelcontextprotocol/[email protected]` → `dist/common/utils.js` reads only `process.env.GITHUB_PERSONAL_ACCESS_TOKEN`. - There is no GitHub OAuth provider (`connectors/providers/` has only Google and Microsoft), so there is no shared token storage to reconcile. The config key, keyring username (`mcp-github:<key>`), `$keyring` ref, and launch env var are all the same string, so renaming the catalog key moves all four together. - `configure`/`disconnect` now also delete keyring slots that the saved entry's `$keyring` refs point to within the connector's own `gaia.connections:<id>:` namespace. Without this, the rename would orphan the old `mcp-github:GITHUB_TOKEN` secret. Refs outside that namespace are never touched. - The connectors-demo agent read `env["GITHUB_TOKEN"]` from `get_credential("mcp-github")`, so it would have broken. It's updated, and a test now ties it to the catalog key. - Doc examples in the MCP client guide, SDK, and spec that launched `server-github` with `GITHUB_TOKEN` were fixed the same way. The CLI and SDK connector docs also used connector id `github`, which doesn't exist; they now use `mcp-github`. The adjacent `configure brave` example names a connector that isn't in the catalog either. That one is left for a separate fix. </details> ## Test plan - [x] `python -m pytest tests/unit/connectors/test_github_mcp_env.py -q`: the two launch-env tests fail on the base branch and pass after the fix. The legacy-slot disconnect test fails with the key renamed but without the cleanup. - [x] `python -m pytest tests/unit/connectors/ tests/mcp/ tests/unit/chat/ui/test_chat_helpers.py tests/unit/test_amd_gaia_urls.py -q`: 998 passed, 17 skipped - [x] `PYTHONPATH=hub/agents/connectors-demo/python python -m pytest hub/agents/connectors-demo/python/tests -q`: the new catalog-key test fails with the old key and passes with the new one. 3 `TestRegistry` tests fail locally only because the package isn't pip-installed (entry-point discovery); CI installs it. - [x] black, isort, and pylint (repo rcfile and disabled set) on the changed Python files - [ ] Manual: `gaia connectors configure mcp-github --set GITHUB_PERSONAL_ACCESS_TOKEN=<pat>`, then list a private repo through the GitHub MCP tools Fixes amd#4357 --------- Co-authored-by: Kalin Ovtcharov <[email protected]> Co-authored-by: Kalin Ovtcharov <[email protected]>
## Summary Connectors you already set up now pick up catalog fixes (a new version pin, command or env var name) the next time GAIA loads them, without reconnecting. GitHub connections saved before amd#4359 work again: their saved token is passed under the name the server reads. ## Why `~/.gaia/mcp_servers.json` kept the command, version pin and env names from when the user connected, so catalog fixes like amd#4356's pins never reached existing users until they ran `gaia connectors configure` again. After amd#4359 renamed the GitHub token variable, older GitHub connections send it as `GITHUB_TOKEN`, which the server ignores, so every call goes out anonymous. The connector's **Test** also reported the token as missing. ## Linked issue Closes amd#4358 ## Changes - Each catalog connector's `command`, `args` and `env` are rebuilt from the current catalog when the global `mcp_servers.json` loads. The user's own fields (`disabled`, `timeout`) are kept. Hand-added servers and a project-local `mcp_servers.json` are used as written. - A renamed env key (exactly one key gone and one new) reads the secret from the slot it was saved under. The connector's **Test** and `get_credential` find it there too, so the user isn't asked to reconfigure. - Updated the GitHub connector troubleshooting note and the pin-bump note in the dependency docs, which both said existing users had to reconfigure. <details> <summary>🔍 Technical details</summary> - Nothing is written back at load time, so `configure` / `disconnect` / `set_enabled` stay the only writers of the file (`test_no_dual_writer`). Since the daemon, Agent UI and CLI all read the file, loading also never races to write it. - The new env name points at the old keyring slot instead of copying the secret. The next `configure` or `disconnect` already deletes the old slot (amd#4359). - With more than one changed key it doesn't guess. It points at the new slots, and the existing "reconfigure" error appears. - Refs are only followed inside the connector's own `gaia.connections:<id>:` namespace. - `get_credential` and `test` read `mcp_servers.json` only when the new slot is empty, so a normal lookup (including Tavily web search) doesn't change. - Skipped when `keyring` isn't installed (base install). `configure` can't run without it, so no entry in the file came from the catalog. - Not covered: the C++ client (`cpp/src/mcp_registry.cpp`) reads the file on its own. It already refuses connector entries with `$keyring` env (amd#2819), so it only matters there for the no-secret connectors (memory, git). </details> ## Test plan - [x] `python -m pytest tests/unit/connectors/test_catalog_rederive.py -q`: 11 passed. The old-pin and renamed-token tests fail without the `config.py` change, and the **Test** / `get_credential` tests fail without the handler change. - [x] `python -m pytest tests/unit/mcp tests/unit/connectors tests/unit/test_mcp_and_agents_follow_gaia_home.py tests/unit/test_gaia_mcp_stub.py tests/unit/test_amd_gaia_urls.py -q`: 1585 passed, 15 skipped - [x] black, isort, flake8, pylint and bandit (repo settings from `util/lint.py`) on the changed files, `util/check_added_lines.py`, `util/check_test_lane_coverage.py`, and `util/check_module_skips.py --workflow test_unit.yml --job unit-tests`: all pass. I didn't finish a full `util/lint.py --all` or `pytest tests/unit/` run on Windows. Both are left to CI. ## Evidence - [ ] **Agent exposed in the Agent UI**: N/A, no UI change. - [x] **MCP tools / servers**: a saved `mcp-memory` entry pinned to a version that doesn't exist, with the user's `"timeout": 60`, then `gaia mcp tools mcp-memory`: ``` # main 📡 Connecting to MCP server 'mcp-memory'... ❌ MCP server 'mcp-memory' not found # this branch 📡 Connecting to MCP server 'mcp-memory'... 🔧 Tools from 'mcp-memory' (9): 🔹 create_entities 🔹 create_relations 🔹 add_observations ... ``` The file on disk is byte-for-byte unchanged after the run. - [x] **CLI**: a GitHub connection saved before amd#4359 (`GITHUB_TOKEN` env, token in the old keyring slot), then `gaia connectors test mcp-github`: ``` # main mcp-github: FAIL missing keyring entries: ['GITHUB_PERSONAL_ACCESS_TOKEN'] # this branch mcp-github: OK keyring_entries_present ``` - [ ] **HTTP API / REST**: N/A, no route changed. The connector Test route calls the same handler method as the CLI above. ## Checklist - [x] I have linked a GitHub issue above (`Closes #N` / `Fixes #N` / `Refs #N`). - [x] I have described **why** this change is being made, not just what changed. - [x] I have run linting and tests locally (`python util/lint.py --all`, `pytest tests/unit/`). The lint tools ran on the changed files and the tests on `tests/unit/mcp` and `tests/unit/connectors`; see the Test plan. - [x] I have attached **real-world evidence matched to the surface I changed** (see Evidence above), or marked each surface N/A. - [x] I have updated documentation if user-visible behavior changed (see [CONTRIBUTING.md](../CONTRIBUTING.md)). --------- Co-authored-by: Kalin Ovtcharov <[email protected]>
Catalog MCP connectors launched at whatever npm served that day, so an upstream tool rename could break them with no GAIA change. Tavily's has already drifted: the docs still name
tavily-search, but the tool is nowtavily_search. Each catalog server now launches at an exact version that was started and had its tool list checked, and a unit test fails on any unpinned or@latestspec. The Git connector pointed at an npm package that was never published, so it could never start. It now runs the reference server from PyPI viauvx.Follow-ups, left out to keep this PR scoped:
~/.gaia/mcp_servers.jsonuntil the user re-runsgaia connectors configure <id>. The new docs section says so, but syncing catalog pins into saved entries needs a design call.lemonade-version-bump.ymlis a follow-up.@modelcontextprotocol/server-githubis deprecated upstream (2025.4.8 is its final release). The server also readsGITHUB_PERSONAL_ACCESS_TOKEN, while the catalog passesGITHUB_TOKEN, so its calls go out unauthenticated. Both belong in their own issue.Test plan
python -m pytest tests/unit/connectors/test_catalog_pins.py -q: 4 catalog cases fail onmain; 18/18 pass on this branchpython -m pytest tests/unit/connectors/ tests/unit/test_skills_marketplace.py tests/unit/test_skills_manager.py -q: 1060 passed, 6 skippedutil/check_doc_links.pyandutil/check_doc_code.pypass[email protected](tavily_search/tavily_extract/…),[email protected],[email protected],mcp-server-git==2026.8.18gaia mcp tools check --config <scratch config with [email protected]>lists the fivetavily_*tools (the refresh step as documented)uvx mcp-server-git==2026.8.18on a machine with uv (checked here viapip installinto a venv, since uv isn't installed locally)gaia eval agentfor an agent withmcp-gitactivated (the connector now exposes tools where it used to fail to start)Fixes #4351