feat: ship OpenCode capture plugin in deploy/opencode/

This commit is contained in:
Apunkt 2026-05-22 10:03:09 +02:00
parent 47c4c760be
commit 8116a5643f
No known key found for this signature in database
2 changed files with 163 additions and 2 deletions

View file

@ -60,7 +60,7 @@ I built this for myself. It worked. I've been running it daily for months, and n
- macOS (Apple Silicon tested) or Linux
- Python 3.11 or 3.12
- Node.js 18+
- [Claude Code](https://docs.claude.com/en/docs/claude-code/overview) as the MCP host
- [Claude Code](https://docs.claude.com/en/docs/claude-code/overview) or [OpenCode](https://opencode.ai) as the MCP host
- ~500 MB free disk
### Install
@ -133,6 +133,40 @@ Use the absolute path. `~` and `$HOME` won't expand here.
For Claude Desktop (untested), edit `~/Library/Application Support/Claude/claude_desktop_config.json`.
### Install the OpenCode plugin
This is the OpenCode equivalent of the Claude Code Stop hook. It listens for idle sessions and writes a deferred-capture JSONL file for the daemon to drain.
```bash
mkdir -p ~/.config/opencode/plugins
cp deploy/opencode/iai-mcp-capture.js ~/.config/opencode/plugins/
```
Make sure `@opencode-ai/plugin` is installed:
```bash
cd ~/.config/opencode
npm install @opencode-ai/plugin
```
### Connect OpenCode
Add the MCP server to `~/.config/opencode/config.json`:
```json
{
"mcp": {
"iai-mcp": {
"type": "local",
"command": ["node", "/absolute/path/to/iai-mcp/mcp-wrapper/dist/index.js"],
"enabled": true
}
}
}
```
Use the absolute path to `mcp-wrapper/dist/index.js`. The plugin file (`iai-mcp-capture.js`) must already be in `~/.config/opencode/plugins/`.
### Verify
```bash
@ -140,7 +174,7 @@ iai-mcp doctor
iai-mcp daemon status
```
Restart Claude Code. Start a session, do some work, exit. Then:
Restart your MCP host (Claude Code or OpenCode). Start a session, do some work, exit. Then:
```bash
tail ~/.iai-mcp/logs/capture-$(date -u +%Y-%m-%d).log
@ -328,6 +362,8 @@ Limitations worth knowing about:
Claude Code is the primary host, validated in daily use.
OpenCode is supported via the `iai-mcp-capture.js` plugin (see Install the OpenCode plugin above) and MCP server config in `~/.config/opencode/config.json`.
Claude Desktop should work (uses `claude_desktop_config.json` instead of `~/.claude.json`) but hasn't been tested end to end.
Other MCP-over-stdio hosts speak the same protocol and should work in principle. Not tested.