# opencode subagents MCP server

> Delegates Claude Code subagent tasks like refactoring and bug fixes to cheaper opencode models while maintaining native tool parity.

- Repository: https://github.com/sebstaq/opencode-subagent-mcp
- Page: https://hostedmcp.org/servers/sebstaq/opencode-subagent-mcp
- Transport: stdio
- Stars: 2
- License: MIT
- Latest version: 0.1.4

## Install

### Claude Code

```sh
claude mcp add opencode-subagent-mcp -- npx -y opencode-subagent-mcp
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "opencode-subagent-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "opencode-subagent-mcp"
      ]
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "opencode-subagent-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "opencode-subagent-mcp"
      ]
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"opencode-subagent-mcp","type":"stdio","command":"npx","args":["-y","opencode-subagent-mcp"]}'
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "opencode-subagent-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "opencode-subagent-mcp"
      ]
    }
  }
}
```

### Codex

```sh
codex mcp add opencode-subagent-mcp -- npx -y opencode-subagent-mcp
```

### Codex config.toml (`~/.codex/config.toml`)

```toml
[mcp_servers.opencode-subagent-mcp]
command = "npx"
args = ["-y", "opencode-subagent-mcp"]
```

### Gemini CLI

```sh
gemini mcp add -s user opencode-subagent-mcp npx -- -y opencode-subagent-mcp
```

### Gemini settings.json (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "opencode-subagent-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "opencode-subagent-mcp"
      ]
    }
  }
}
```

## Tools (5)

- `agent`: Launch a subagent that runs on an opencode model (default opencode-go/deepseek-v4.1-flash) in the current project. Mirrors the built-in Agent tool: give a self-contained task prompt; the agent starts with no conversation context and returns only its final report. subagent_type accepts Claude agent definitions from .claude/agents/ (their prompt, tools, permissionMode and maxTurns apply) or opencode agents (general, explore, plan, build). isolation 'worktree' runs it in a temporary git worktree off the default branch, removed if unchanged. The call blocks until the agent finishes (it is backgrounded automatically after a while); set run_in_background to return at once and collect the result with wait.
- `send_message`: Send a follow-up message to a finished opencode subagent by agent_id. It resumes with its full previous history (and its worktree, if one was kept) and returns its new final report. Also works for agent_ids from before a restart of the MCP server or Claude Code session, and for agents that were interrupted by such a restart.
- `wait`: Wait for a background opencode subagent and return its result. agent_ids from before a restart of the MCP server still work.
- `stop`: Abort a running opencode subagent. Returns what it produced so far. agent_ids from before a restart of the MCP server still work.
- `list`: List this session's opencode subagents and the available agent types. It shows agents started or used since this MCP server started; agents from before a restart are not listed but their agent_id still works with wait, send_message and stop. (read-only)

## FAQ

### Does this proxy my main Claude Code session?

No, your main Claude Code session is not proxied or routed anywhere; the server only runs the subagents you delegate to it.

### How are my credentials handled?

The server does not read, store, or send your credentials; it uses the environment and provider logins you have already configured for the opencode CLI.

### Can I resume a finished agent?

Yes, you can continue a finished agent with its full history using the send_message tool.

### Does it support git worktrees for isolation?

Yes, when isolation is set to worktree, it creates git worktrees under the project's .claude/worktrees/ directory.
