mcp-config: add mcp-sync to force a refresh, ignoring the TTL

The sync runs only at shell start and is throttled to MCP_SYNC_TTL (1h), so a
model added on the gateway can take up to an hour AND a new terminal before
opencode sees it. There was no way to say "fetch it now", so the recurring
symptom was "I added a model and it isn't showing up" -- with a healthy
gateway and a correctly-scoped key.

`mcp-sync` re-sources the hook with the throttle disabled and prints the
resulting model list, so it also answers "what does the client actually have?"
in one step.

README gains a section splitting the two failure modes: a model the gateway
returns but opencode lacks is a stale client; a model the gateway does not
return is a LiteLLM model_list / key-scoping problem.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-13 13:57:49 -04:00
co-authored by Claude Opus 4.8
parent 35befbe1e3
commit cd09df07f6
2 changed files with 56 additions and 1 deletions
+29 -1
View File
@@ -122,6 +122,30 @@ Models are different: they live on the gateway
Add a folder under `skills/` and push to `main` — see `skills/README.md`.
Verify with `opencode debug skill`.
## "I added a model on the gateway and opencode doesn't see it"
Almost always a stale local config, not a gateway or key problem. The sync runs
**only at shell start** and is throttled to `MCP_SYNC_TTL` (1h), so a new model
can take up to an hour *and* a new terminal to appear.
Pull it immediately:
```sh
mcp-sync # force a refresh now, ignoring the TTL; prints the model list
```
If the model still isn't listed, it isn't reaching your key — check the gateway,
not the client:
```sh
curl -fsS -H "Authorization: Bearer $LITELLM_KEY" \
https://llm.covert-gpt.com/v1/models | jq -r '.data[].id'
```
Whatever that prints is exactly what `sync.sh` will deploy. A model present here
but missing in opencode is a sync problem; a model missing here is a LiteLLM
`model_list` or key-scoping problem.
## Notes / caveats
- **Local-server precedence**: opencode merges with later-config-wins on key
@@ -130,4 +154,8 @@ Verify with `opencode debug skill`.
- **Key rotation**: re-run `install.sh` (or edit `~/.config/mcp-sync/key`).
- **Other clients**: this ships an opencode config. Claude Code / open-webui
would need their own equivalent file + a parallel sync entry; not done yet.
- **Throttle**: override with `MCP_SYNC_TTL=0` to force a pull every shell.
- **Throttle**: `mcp-sync` forces one refresh; `MCP_SYNC_TTL=0` in the
environment makes every new shell pull.
- **python3 is required** for model discovery. Without it `sync.sh` deploys the
base config verbatim, so the provider comes up with an EMPTY model list. It
warns when this happens; `bootstrap.sh` installs python3.