Skip to content

fix(connectors): pin every catalog MCP server to an exact version - #4356

Merged
kovtcharov-amd merged 1 commit into
amd:mainfrom
kovtcharov:claude/pin-mcp-catalog
Sep 25, 2026
Merged

kovtcharov-amd merged 1 commit into
amd:mainfrom
kovtcharov:claude/pin-mcp-catalog

Conversation

@kovtcharov

Copy link
Copy Markdown
Contributor

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 now tavily_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 @latest spec. 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 via uvx.

Follow-ups, left out to keep this PR scoped:

  • Existing installs keep their old command. Connectors that are already configured keep the command saved in ~/.gaia/mcp_servers.json until the user re-runs gaia connectors configure <id>. The new docs section says so, but syncing catalog pins into saved entries needs a design call.
  • The refresh is still manual. Dependabot can't read Python string literals, so a scheduled bump workflow modelled on lemonade-version-bump.yml is a follow-up.
  • The GitHub connector has two problems of its own. @modelcontextprotocol/server-github is deprecated upstream (2025.4.8 is its final release). The server also reads GITHUB_PERSONAL_ACCESS_TOKEN, while the catalog passes GITHUB_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 on main; 18/18 pass on this branch
  • python -m pytest tests/unit/connectors/ tests/unit/test_skills_marketplace.py tests/unit/test_skills_manager.py -q: 1060 passed, 6 skipped
  • black, isort, and pylint (CI flags) are clean on the changed files; util/check_doc_links.py and util/check_doc_code.py pass
  • Started each pinned server over stdio and listed its tools: [email protected] (tavily_search/tavily_extract/…), [email protected], [email protected], mcp-server-git==2026.8.18
  • gaia mcp tools check --config <scratch config with [email protected]> lists the five tavily_* tools (the refresh step as documented)
  • uvx mcp-server-git==2026.8.18 on a machine with uv (checked here via pip install into a venv, since uv isn't installed locally)
  • gaia eval agent for an agent with mcp-git activated (the connector now exposes tools where it used to fail to start)

Fixes #4351

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
@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Approve with suggestions

Catalog 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:

  • The Git connector now needs uv installed, and GAIA never checks for it. The docs tell users to install it, but if it's missing the connector's built-in test still reports "ready" and the server then fails to start with a generic error that never mentions uv. The PR's own test plan leaves the uvx path unchecked. Worth either a preflight check on the launcher binary or an actual run on a machine with uv.
  • The same drift risk still exists outside the catalog. Two MCP servers spawned elsewhere in the codebase are still unpinned, so the new guard doesn't cover them. Either pin those too or say in the new docs section that the catalog is deliberately the only scope.

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 evidence

No evidence-bundle.md was produced for this PR, so the automated evidence stage didn't run here. The PR description carries its own: gaia mcp tools check against a scratch config listing the five tavily_* tools (this is the surface the tool-name doc change depends on), plus a stdio tool-list check of each pinned server. Two boxes are explicitly left unchecked by the author — uvx mcp-server-git on a machine that actually has uv (checked via pip install into a venv instead), and gaia eval agent with mcp-git activated. So the one genuinely new launcher path in this PR is the one that hasn't been exercised end to end.

I confirmed independently against the live registries:

tavily-mcp                              latest = 0.2.22     ✓ matches pin
@modelcontextprotocol/server-github     latest = 2025.4.8   ✓ matches pin (marked deprecated upstream)
@modelcontextprotocol/server-memory     latest = 2026.8.31  ✓ matches pin
mcp-server-git (PyPI)                   latest = 2026.8.18  ✓ matches pin, not yanked
@modelcontextprotocol/server-git (npm)  404 — never published ✓ confirms the PR's rationale

Beyond that, the verdict rests on static review: the connector is not exercised through the Agent UI or a live agent here.

🔍 Technical details

🟡 Important

1. A missing uvx fails opaquely, and the connector self-test still says "ok" (src/gaia/connectors/catalog/mcp_servers.py:99)

mcp-git has no mcp_env_keys, so McpServerHandler.test() returns {"ok": True, "detail": "no_secrets_required"} unconditionally — it deliberately never spawns the process (src/gaia/connectors/mcp_server.py:319-343). When the server is actually launched, a missing binary lands in the catch-all at src/gaia/mcp/client/transports/stdio.py:198-201 and becomes Failed to start MCP server: [Errno 2], with nothing naming uv. src/gaia/mcp/external_services.py:70-71 already does the right thing for npx ("Install Node.js — it provides npx") but the hint is npx-only.

This shape predates the PR, but it bites much harder now: npx is on most dev machines via Node, uvx usually is not. A cheap preflight in test() would turn a silent dud into an actionable error:

        if spec.mcp_command and not shutil.which(spec.mcp_command):
            return {
                "ok": False,
                "detail": (
                    f"launcher {spec.mcp_command!r} not found on PATH. "
                    "Install uv (https://docs.astral.sh/uv/) for uvx servers, "
                    "or Node.js for npx servers."
                ),
            }
        if not spec.mcp_env_keys:
            return {"ok": True, "detail": "no_secrets_required"}

(Needs import shutil at the top of mcp_server.py.)

2. Unpinned MCP spawns outside the catalog (src/gaia/mcp/external_services.py:197, :506)

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 search_documentation / search_web with no GAIA change — and test_catalog_pins.py doesn't reach them because they aren't ConnectorSpecs. Either pin them in the same sweep, or add a sentence to the new docs section stating that the catalog is the intentional boundary and why.

🟢 Minor

3. The guard covers one module, not "every catalog MCP server" (tests/unit/connectors/test_catalog_pins.py:142)

Importing _ALL_SPECS from mcp_servers means a type="mcp_server" spec registered from another catalog/ module slips past — and the catalog package docstring explicitly invites new modules. Sibling tests iterate the registry instead (test_catalog_docs_url.py:36, test_catalog_ledger.py:79). The tradeoff is real: parametrizing on REGISTRY.all() at collection time interacts with the autouse fixture in tests/unit/connectors/conftest.py:61 that swaps in a fresh registry, which is presumably why _ALL_SPECS was chosen. A non-parametrized test body that imports gaia.connectors.catalog and walks REGISTRY.all() (with the same emptiness guard test_catalog_docs_url.py uses) gets both.

4. mcp-git is the catalog's only write-capable server, and the description undersells it (src/gaia/connectors/catalog/mcp_servers.py:97)

[email protected] exposes git_add, git_commit, git_create_branch, git_checkout, and git_reset alongside the read tools. The description names "branch, and commit", which is accurate but reads as a list of inspection verbs. Since this connector previously could never start, this is the first time an agent can stage and commit in a user's repo — worth saying out loud in the tile:

    description="Git repository tools: status, diff, log, show, plus branch/add/commit (writes to your repo).",

Same clause is worth adding to the Git bullet in docs/connectors/index.mdx:60. Upstream does validate paths and reject --prefixed branch names, and grants/activations default OFF, so this is a disclosure point rather than a security finding.

5. The deferred GitHub-connector problems have no issue to point at

The description says the deprecation and the GITHUB_TOKEN / GITHUB_PERSONAL_ACCESS_TOKEN mismatch "belong in their own issue" — agreed, but pinning to a deprecated final release makes that issue the only thing keeping it visible. Link it here once filed. (npm confirms 2025.4.8 carries a deprecated field: "Package no longer supported.")

Strengths

  • The unpinned/pinned parametrized pairs are the right test shape — each rejection case (@latest, ^1.2.3, 1.2, >=, bare name) documents a specific way a pin rots, and the unknown-launcher branch fails loudly with instructions rather than silently passing a launcher it can't parse.
  • test_catalog_is_not_empty closes the vacuous-pass hole that a parametrized-over-a-collection test usually leaves open.
  • The docs section is genuinely operable: exact commands to find the new version, launch it, diff the tool names, and the note that existing installs keep their saved command until reconfigured. That last paragraph is the part most pinning PRs forget.
  • Catching the tavily-search → tavily_search rename and fixing every doc hit in the same PR is exactly the bundled-doc discipline CLAUDE.md asks for — I grepped, and no stale hyphenated names remain.

@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Sep 25, 2026
Merged via the queue into amd:main with commit fcd3ea3 Sep 25, 2026
32 of 33 checks passed
kovtcharov-amd added a commit to kovtcharov/gaia that referenced this pull request Sep 26, 2026
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]>
kovtcharov-amd added a commit to kovtcharov/gaia that referenced this pull request Nov 4, 2026
## 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation changes tests Test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(connectors): catalog MCP servers are fetched unpinned (@latest)

2 participants