Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The bundled `config.json` configures two MCP servers:
| Server | Type | Notes |
|---|---|---|
| `chrome-devtools` | local (`npx`) | Browser automation via Chromium |
| `jetbrains` | remote (SSE) | JetBrains IDE integration, host configured via `JETBRAINS_IDE_HOST` |
| `jetbrains` | remote (SSE) | JetBrains IDE integration via `host.docker.internal:${JETBRAINS_MCP_PORT}` (default `64343`) |

## Usage

Expand All @@ -64,8 +64,9 @@ services:
- opencode-state:/home/skpr/.local/state/opencode
environment:
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY}
JETBRAINS_IDE_HOST: ${JETBRAINS_IDE_HOST:-host.docker.internal}
network_mode: "${OPENCODE_NETWORK_MODE:-}"
JETBRAINS_MCP_PORT: ${JETBRAINS_MCP_PORT:-64343}
extra_hosts:
- "host.docker.internal:host-gateway"
stdin_open: true
tty: true
restart: unless-stopped
Expand All @@ -75,12 +76,20 @@ volumes:
opencode-state:
```

> **macOS (Docker Desktop):** `host.docker.internal` is provided automatically — no extra config needed.
> **JetBrains MCP:** The JetBrains MCP server only binds to `127.0.0.1`. Use `socat` on the host
> to re-expose it so the container can reach it via `host.docker.internal`.
>
> **Linux:** PHPStorm binds to `127.0.0.1` only. Set the following in your `.env` file or shell:
> ```
> OPENCODE_NETWORK_MODE=host
> JETBRAINS_IDE_HOST=127.0.0.1
> ```bash
> # Install
> brew install socat # macOS
> # or
> apt install socat # Linux
>
> # Run on the host before starting the container.
> # socat listens on 64343 (JETBRAINS_MCP_PORT) and forwards to JetBrains MCP on 64342.
> # 64342 is taken by JetBrains itself so socat must use a different port.
> # If 64343 is already in use, pick any free port and set JETBRAINS_MCP_PORT in your .env.
> socat TCP-LISTEN:64343,fork,reuseaddr TCP:127.0.0.1:64342
> ```

Start the container in the background. It will restart automatically after a reboot:
Expand Down Expand Up @@ -111,4 +120,5 @@ Pass your API key via a `.env` file (ensure it is in `.gitignore`) — do not ba

```
ANTHROPIC_API_KEY=sk-ant-...
JETBRAINS_MCP_PORT=64343
```
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"jetbrains": {
"type": "remote",
"url": "http://{env:JETBRAINS_IDE_HOST}:64342/sse",
"url": "http://host.docker.internal:{env:JETBRAINS_MCP_PORT}/sse",
"enabled": true
}
}
Expand Down
19 changes: 10 additions & 9 deletions docker-compose.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ services:
# Pass your Anthropic API key at runtime. Never hard-code it here.
# Add ANTHROPIC_API_KEY to a .env file (gitignored) or export it in your shell.
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY}
# JetBrains MCP server host.
# macOS (Docker Desktop): host.docker.internal resolves to the host automatically.
# Linux: PHPStorm binds to 127.0.0.1 only, so use network_mode: host (below)
# and set this to 127.0.0.1.
JETBRAINS_IDE_HOST: ${JETBRAINS_IDE_HOST:-host.docker.internal}
# Linux: PHPStorm only listens on 127.0.0.1, so set JETBRAINS_IDE_HOST=127.0.0.1
# and OPENCODE_NETWORK_MODE=host in your .env file or shell.
# network_mode: host is Linux-only and not required on macOS (Docker Desktop).
network_mode: "${OPENCODE_NETWORK_MODE:-}"
# Port socat is listening on (forwarding to the JetBrains MCP server on the host).
# 64342 is taken by JetBrains itself, so socat must use a different port (default: 64343).
# Override if 64343 is already in use on your machine.
JETBRAINS_MCP_PORT: ${JETBRAINS_MCP_PORT:-64343}
# Expose host.docker.internal on Linux (Docker Desktop provides this automatically on macOS).
# JetBrains MCP only binds to 127.0.0.1; socat on the host forwards 64343 -> 127.0.0.1:64342 — see README.
# Alternatively, if opencode shares a Compose project with your app (e.g. alongside nginx), you can use
# network_mode: "service:nginx" to share its network namespace — remove extra_hosts if you do this.
extra_hosts:
- "host.docker.internal:host-gateway"
stdin_open: true
tty: true
# Restart automatically so the container survives reboots.
Expand Down