feat(opencode): add mcpctl config opencode + /mcpctl TUI switcher with bottom project indicator
Some checks failed
CI/CD / lint (pull_request) Successful in 1m7s
CI/CD / test (pull_request) Successful in 1m22s
CI/CD / typecheck (pull_request) Successful in 2m49s
CI/CD / smoke (pull_request) Failing after 1m54s
CI/CD / build (pull_request) Successful in 2m16s
CI/CD / publish (pull_request) Has been skipped

This commit is contained in:
Michal
2026-08-08 21:23:12 +01:00
parent 2513da33c3
commit 0a02616c7f
16 changed files with 1146 additions and 22 deletions

View File

@@ -195,6 +195,48 @@ Inside pi:
See [docs/pi-extension.md](docs/pi-extension.md) for full details.
### Connect opencode
[opencode](https://opencode.ai) consumes MCP natively and loads Agent Skills
`SKILL.md` trees, but — unlike Claude — it has no `.mcp.json` convention. This
addon wires a project's MCP stdio bridge into opencode's global config and adds
a small TUI plugin so you can switch mcpctl projects from inside opencode:
```bash
mcpctl config opencode --project monitoring
```
This:
1. Registers the project's MCP **stdio bridge** in
`~/.config/opencode/opencode.json` as
`mcp.servers.monitoring = { "type": "local", "command": ["mcpctl","mcp","-p","monitoring"] }`
(merging with any existing servers/settings), and unmounts the previously
active mcpctl project so exactly one is live. Hand-configured servers are
never touched.
2. Installs a `/mcpctl` TUI plugin into
`~/.config/opencode/plugin/mcpctl-switch.tsx` and registers it in
opencode.json's `plugin` array (a `.tsx` plugin isn't auto-discovered —
opencode globs `.ts`/`.js` only). Skip with `--skip-plugin`.
3. Persists the active project to `~/.mcpctl/opencode-state.json`.
4. Writes a `.mcpctl-project` marker (unless running from `$HOME`; skip with
`--skip-marker`).
5. Syncs the project's skills into `~/.config/opencode/skills/<name>/`, the
tree opencode reads for Agent Skills.
The plugin shows the **current project in the bottom status bar** (next to
where opencode prints the model and token counter) and gives you a
**`/mcpctl`** slash command — a filterable project picker that switches and lets
opencode's config watcher reload MCP. Re-sync skills later with:
```bash
mcpctl skills sync --agent opencode --project monitoring
```
A custom config dir is fine: `mcpctl config opencode --project monitoring --config-dir ~/.config/opencode-custom`.
See `docs/opencode-extension.md` for details.
## Declarative Configuration
Everything can be defined in YAML and applied with `mcpctl apply`: