mcp-config: sync shared opencode skills from the repo
Models and MCP servers are discovered from the LiteLLM gateway at sync time
(/v1/models, and the aggregate /mcp/ endpoint). Skills have no gateway side to
query: LiteLLM's /v1/skills is a passthrough to Anthropic's Skills API, which
lists skills on an Anthropic account rather than serving skill files, and
/public/skill_hub is a marketplace catalog. So the repo is the source of truth
and the tree is fetched whole, from the repo tarball.
Deploy to ~/.config/mcp-sync/skills rather than ~/.config/opencode/skills so
the atomic replace can never delete a skill the user wrote by hand; opencode
picks the tree up via skills.paths, which expands {env:HOME} — verified — so
the shared config stays identical for every user.
Same throttle and non-fatal discipline as the config sync: a fetch that yields
no skills/ leaves the last-good tree in place instead of emptying it.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+19
-6
@@ -25,12 +25,20 @@ sync — the laptops pull from Gitea's `main`.)
|
||||
`/v1/models` with the user's key to **auto-discover models** (opencode
|
||||
can't list models from a custom provider itself, so the map is
|
||||
materialized client-side; if discovery fails the previous map is carried
|
||||
over), deploys the result to `~/.config/opencode/opencode.gateway.json`,
|
||||
and exports `LITELLM_KEY` (from `~/.config/mcp-sync/key`) plus
|
||||
`OPENCODE_CONFIG` (pointing at the deployed file — opencode does NOT
|
||||
auto-load extra files in its config dir, so without this export the file
|
||||
is ignored). Silent + non-fatal: a Gitea hiccup never breaks the shell,
|
||||
last-good config stays in place.
|
||||
over), deploys the repo's **skills** (see below), deploys the config to
|
||||
`~/.config/opencode/opencode.gateway.json`, and exports `LITELLM_KEY`
|
||||
(from `~/.config/mcp-sync/key`) plus `OPENCODE_CONFIG` (pointing at the
|
||||
deployed file — opencode does NOT auto-load extra files in its config dir,
|
||||
so without this export the file is ignored). Silent + non-fatal: a Gitea
|
||||
hiccup never breaks the shell, last-good config stays in place.
|
||||
- `../skills/` — the shared skill folders, deployed to
|
||||
`~/.config/mcp-sync/skills` and wired in through `skills.paths` in the
|
||||
config above. Skills are plain files, so — unlike models and MCP servers —
|
||||
there is nothing on the gateway to discover and **the repo is the source of
|
||||
truth**; the tree is fetched whole from the repo tarball. They deploy to
|
||||
mcp-sync's own directory rather than `~/.config/opencode/skills` so the
|
||||
atomic replace can never delete a skill the user wrote by hand. See
|
||||
`skills/README.md`.
|
||||
- `install.sh` — one-time bootstrap (curl-pipe). Fetches `sync.sh`, stores the
|
||||
user's key (0600), and adds the rc hook.
|
||||
|
||||
@@ -62,6 +70,11 @@ in `sync.sh`. Users pick them up within the sync TTL (or immediately on a
|
||||
new shell). `opencode.gateway.json` here only needs editing for structural
|
||||
changes (a new provider, endpoint URLs).
|
||||
|
||||
## Adding a skill (admin)
|
||||
|
||||
Skills have no gateway side. Add a folder under `skills/` and push to `main` —
|
||||
see `skills/README.md`. Verify with `opencode debug skill`.
|
||||
|
||||
For **per-user / per-target** tools (cluster access, etc.) do NOT add them
|
||||
here — those run client-side with the user's own credentials. See
|
||||
`charts/inference/MCP-GATEWAY.md`.
|
||||
|
||||
Reference in New Issue
Block a user