Auto-reindex servers when their tools change - #93
Merged
Conversation
The search index only detected staleness from removed servers or a changed embedding model — it never noticed when a still-configured server added, renamed, or changed a tool. Add per-server drift detection (a key-sorted signature over tool name + description + input_schema, requiring no index schema change) and incrementally re-index only the drifted servers. `mcpx` (the default list) and `mcpx index --status` already fetch every server's live tools, so they now detect drift and refresh the affected servers in the background, telling the user which servers changed. Servers that fail to connect are never pruned, and no index is built where none exists. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
evantahler
added a commit
that referenced
this pull request
Jun 4, 2026
* Fix flaky embedding tests by retrying transient HF model downloads The `generateEmbedding` tests download the real embedding model (Xenova/bge-small-en-v1.5) from Hugging Face at test time. CI has no model cache, so every run re-downloads — and HF periodically rate-limits with a 429, which failed the post-merge run for #93 even though that PR's own CI was green (the flake just didn't hit that run). The merge gate was never broken; the tests were non-deterministic. - semantic.ts: retry the model load with exponential backoff on transient errors (429 / 5xx / "load file"), keeping the existing wasm→cpu device fallback. Benefits real users hitting the same 429 on first index, not just CI. - ci.yml: cache ~/.cache/mcpx/transformers (keyed on model repo+revision) so the model downloads once and is reused, and pre-warm the cache before the test suite so a cold cache populates outside the tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Key the model cache by src/constants.ts hash with a restore-keys fallback Hashing the cache dir itself is circular (the key is computed before restore, when the dir is empty on a hosted runner). Instead key on src/constants.ts — the source of truth for the model repo/revision — so a model change re-keys the cache, and add a `transformers-` restore-keys prefix so we still restore a warm cache (and avoid re-downloading from HF) even right after a model change. The goal is rate-limit avoidance, not pinning exact contents. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The search index previously only went stale when a server was removed or the embedding model changed — it never noticed when a still-configured server added, renamed, or changed a tool. This adds per-server drift detection (
getDriftedServersinsrc/search/staleness.ts, a key-sorted signature over tool name + description + input_schema, needing no index schema change) and an incrementalreindexServersthat re-embeds only the drifted servers via the newmaybeReindexDrifthelper.mcpx(the default list) andmcpx index --statusalready fetch every server's live tools, so they now detect drift and refresh just the affected servers in the background, reporting which servers changed. Servers that fail to connect are never pruned, and no index is built where none exists. Adds unit tests for the drift cases, updates the README and both skill docs, and bumps the patch version to 0.21.10.