Repository navigation
fix(connectors): saved MCP connectors pick up catalog updates - #6629
Conversation
Catalog fixes (a version pin, a new command, a renamed env var) never reached connectors saved before them. Each catalog connector's command, args and env are now rebuilt from the catalog when mcp_servers.json loads, keeping the user's own settings, and a renamed env key reads the secret from the keyring slot it was saved under. Closes amd#4358
|
Verdict: Approve with suggestions Connectors people already set up now pick up catalog fixes when GAIA loads them, so a version-pin bump or a renamed variable reaches them without reconnecting. GitHub connections saved before the token rename work again, and the file on disk is never rewritten. The logic is careful: it only treats a change as a rename when exactly one key changed, it never follows a reference into another connector's secrets, and it leaves hand-added servers and project-local files alone. The tests cover each of those cases. One thing to consider before merging: if someone hand-edited a catalog connector's entry, say to add an extra environment variable or an argument, that edit is now silently replaced on every load. Keeping extra plain-text variables the catalog doesn't define would stop that from catching anyone out. Real-world evidenceN/A: this job produced no evidence bundle. The PR description has its own before/after runs:
Nothing was re-run here because the runner has no test environment, so this verdict rests on a static review plus the author's evidence. 🔍 Technical detailsIssues 🟢 Hand-edited extras on a catalog entry are dropped ( If you'd rather the catalog own Checks I ran outside the diff
Strengths
|
A value someone added by hand, such as GITHUB_HOST for GitHub Enterprise, was dropped on every load. Plain env values the catalog doesn't define are now kept; the catalog's own keys are still rebuilt. Refs amd#4358
Pins down how a saved catalog connector behaves when the catalog drops it, switches its command, or shares an id prefix with another connector, and that malformed saved entries don't break the load. Notes in the dependency docs that hand edits to a catalog connector's command or args are replaced.
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 #4359 work again: their saved token is passed under the name the server reads.
Why
~/.gaia/mcp_servers.jsonkept the command, version pin and env names from when the user connected, so catalog fixes like #4356's pins never reached existing users until they rangaia connectors configureagain. After #4359 renamed the GitHub token variable, older GitHub connections send it asGITHUB_TOKEN, which the server ignores, so every call goes out anonymous. The connector's Test also reported the token as missing.Linked issue
Closes #4358
Changes
command,argsandenvare rebuilt from the current catalog when the globalmcp_servers.jsonloads. The user's own fields (disabled,timeout) are kept. Hand-added servers and a project-localmcp_servers.jsonare used as written.get_credentialfind it there too, so the user isn't asked to reconfigure.🔍 Technical details
configure/disconnect/set_enabledstay 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.configureordisconnectalready deletes the old slot (fix(connectors): pass the GitHub token under the name the server reads #4359).gaia.connections:<id>:namespace.get_credentialandtestreadmcp_servers.jsononly when the new slot is empty, so a normal lookup (including Tavily web search) doesn't change.keyringisn't installed (base install).configurecan't run without it, so no entry in the file came from the catalog.cpp/src/mcp_registry.cpp) reads the file on its own. It already refuses connector entries with$keyringenv (feat(cpp): resolve $keyring credential references so connector-configured MCP servers work from C++ #2819), so it only matters there for the no-secret connectors (memory, git).Test plan
python -m pytest tests/unit/connectors/test_catalog_rederive.py -q: 11 passed. The old-pin and renamed-token tests fail without theconfig.pychange, and the Test /get_credentialtests fail without the handler change.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 skippedutil/lint.py) on the changed files,util/check_added_lines.py,util/check_test_lane_coverage.py, andutil/check_module_skips.py --workflow test_unit.yml --job unit-tests: all pass. I didn't finish a fullutil/lint.py --allorpytest tests/unit/run on Windows. Both are left to CI.Evidence
Agent exposed in the Agent UI: N/A, no UI change.
MCP tools / servers: a saved
mcp-memoryentry pinned to a version that doesn't exist, with the user's"timeout": 60, thengaia mcp tools mcp-memory:The file on disk is byte-for-byte unchanged after the run.
CLI: a GitHub connection saved before fix(connectors): pass the GitHub token under the name the server reads #4359 (
GITHUB_TOKENenv, token in the old keyring slot), thengaia connectors test mcp-github:HTTP API / REST: N/A, no route changed. The connector Test route calls the same handler method as the CLI above.
Checklist
Closes #N/Fixes #N/Refs #N).python util/lint.py --all,pytest tests/unit/). The lint tools ran on the changed files and the tests ontests/unit/mcpandtests/unit/connectors; see the Test plan.