> ## Documentation Index
> Fetch the complete documentation index at: https://developers.lighton.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenCode

> Use the LightOn MCP server directly from OpenCode.

## Prerequisites

* [OpenCode](https://opencode.ai) installed
* A LightOn API key from the [LightOn Console](https://console.lighton.ai)

## Configuration

OpenCode configures MCP servers via a JSON file. Add the following to `~/.config/opencode/opencode.jsonc`:

```json theme={null}
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "lighton": {
      "type": "remote",
      "url": "https://api.lighton.ai/mcp",
      "enabled": true,
      "oauth": false,
      "headers": {
        "Authorization": "Bearer {env:LIGHTON_API_KEY}"
      }
    }
  }
}
```

<Note>
  `{env:LIGHTON_API_KEY}` is OpenCode's syntax for reading an environment variable at runtime. The key is never stored in the config file. Make sure `LIGHTON_API_KEY` is set in your shell environment, you can grab your key from the [LightOn Console](https://console.lighton.ai). To scope the server to a single project instead, place the same snippet in `opencode.jsonc` at the root of your project.
</Note>

## Verification

1. List all configured MCP servers:

   ```bash theme={null}
   opencode mcp list
   ```

2. Confirm `lighton` appears and shows as authenticated.

3. Test the connection with a prompt like:

   ```
   Search my LightOn workspaces for documents about [topic]
   ```

You're all set. From any OpenCode session you can now ask it to search or ingest documents in your LightOn workspaces directly.

## References

* [OpenCode docs: MCP Servers](https://opencode.ai/docs/mcp-servers/)
