# OpenCode

Connect OpenCode to Silan with one click, start OpenCode again, and allow it once.

OpenCode reaches your devices through `silan mcp`, Silan's MCP server, written into OpenCode's config by the Silan app, beside the servers you already have. Status: **supported**. It is proven with a real OpenCode on a Mac with no phone attached: OpenCode connected to Silan, asked, and called `list_devices` after **Allow**. OpenCode acting on a phone from start to end is still owed, as it is for every connected app.

## Setup

1. Open **Connections** in Silan's sidebar, or setup's **Your AI tools**. Press **Connect an app**, then **Connect** on the OpenCode row.
2. Silan asks **Do you test your own app with OpenCode?** **Just my devices** gives the `core` set of 16 tools. **Test my app** gives the `testing` set of 27, with installs, recordings and test pushes.
3. Silan writes one entry, `mcp.servers.silan`, into `~/.config/opencode/opencode.json`, the way OpenCode's own `opencode mcp add --global` writes a server:

   ```json
   {
     "mcp": {
       "servers": {
         "silan": {
           "type": "local",
           "command": ["/Applications/Silan.app/Contents/Helpers/silan", "mcp"],
           "environment": {}
         }
       }
     }
   }
   ```

   **Test my app** adds `"--profile", "testing"` to the `command` list. Silan adds `mcp` and `servers` when the file does not have them, and refuses a file where either is there but is not an object. Everything else, such as `$schema` and `theme`, stays byte for byte. The first change keeps a copy at `~/.config/opencode/opencode.json.silan-backup`. No key is written.
4. Start OpenCode again. In the terminal, quit OpenCode and type `opencode`. In the OpenCode app, press Command Q and open it again. An OpenCode that was open before Connect does not see Silan.
5. Type `Use Silan to list my devices`. On its first tool call Silan shows **OpenCode wants to use your devices**, with who signed it. Press **Allow**, **Allow this time** or **Don't allow**.

Silan knows both the terminal's `opencode` and the server the OpenCode app starts, so either way OpenCode is named by its signature, not by what it says it is.

## Try it

A first prompt:

```text
Use Silan to list my devices, then open Settings on the first one and read me the device name.
```

You should see OpenCode call `list_devices`, and Silan's Allow sheet the first time. After **Allow**, the OpenCode row on **Connections** reads **Can use every device · used just now**. To check from OpenCode's own command line:

```sh
opencode mcp list
```

It lists `silan` as connected once OpenCode has read the config.

## Limits

- OpenCode acting on a phone from start to end is not yet proved on a real device. The proof ran with no phone.
- The testing set shows 27 tools over Connect: the five scenario tools are not served over XPC.
- OpenCode adds MCP servers after it starts. A check made right after start may not list Silan yet. Ask again a moment later.
- Silan must be open on this Mac to ask you. With Silan closed, the call ends at once with **Open Silan on this Mac to allow OpenCode**.
- **Disconnect** on the row takes `silan` out of `mcp.servers` and leaves the rest of the file as it was.
- A risky step answers `APPROVAL_REQUIRED` until you say yes in Silan. See [Safety](/safety/).

:::note[Proof]
Proved on this Mac with no phone, 31 Oct 2026, by a Silan worker, with a real signed OpenCode: Connect (**Test my app**) added `mcp.servers.silan` to a config that already had `$schema` and `theme` and kept both, with the backup copy beside it. `opencode mcp list --server` said `silan connected` after 2 s. `opencode run` asked Silan, the worker pressed **Allow**, and OpenCode's `list_devices` answered `{"devices":[]}`. Disconnect asked, removed the row, and the file still read without error. Run `20261031-140512-62730`, pictures `connect-*.png`, `opencode-ask-dark.png`, `manage-opencode-dark.png`. Source: verify-silan feature map, connections.
:::