## Install Lightsage MCP in OpenCode

OpenCode can connect to remote MCP servers from `opencode.json` or `opencode.jsonc`. Use this guide to connect OpenCode to the hosted Lightsage MCP endpoint.

### 1. Get your Lightsage API key

Open the [Lightsage dashboard](https://app.lightsage.com/settings/api), copy your API key, and store it as `LIGHTSAGE_API_KEY`:

```shell
export LIGHTSAGE_API_KEY="ls_cli_your_api_key"
```

Do not put your API key in shared project config, screenshots, issue reports, or public repositories.

### 2. Add Lightsage MCP to OpenCode

Add Lightsage MCP to `opencode.json` or `opencode.jsonc`:

```jsonc
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "lightsage": {
      "type": "remote",
      "url": "https://mcp.lightsage.com/mcp",
      "enabled": true,
      "oauth": false,
      "headers": {
        "X-Lightsage-Api-Key": "{env:LIGHTSAGE_API_KEY}"
      }
    }
  }
}
```

### 3. Verify OpenCode can use Lightsage

Run OpenCode and ask it to use the `lightsage` MCP server. Use `opencode mcp list` if you need to inspect connection state. Then run a read-only prompt:

```text
Use the Lightsage MCP server to check my Lightsage auth status.
```

See the [OpenCode MCP docs](https://opencode.ai/docs/mcp-servers/) for local and remote server options.
