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

# opencode

> Add Spiral to opencode as a remote MCP server: one command, sign in, no API key.

**1. Add the server**

```bash theme={null}
opencode mcp add spiral --global --url https://api.spiral.ai/mcp
```

Leave out `--global` to add Spiral to the current project only. No header and no client ID or secret: opencode
registers itself with Spiral.

**2. Sign in**

```bash theme={null}
opencode mcp auth spiral
```

Your browser opens. Sign in to Spiral, pick the organization and click **Authorize**, then return to the terminal.
No API key. Inside opencode, `/mcps` starts the same sign-in.

**3. Check it**

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

Spiral shows as **connected**.

**4. Try a starter prompt**

```text theme={null}
Find a text-to-image tool, tell me what one image costs, then generate a lighthouse at dawn.
```

> [accordion] With an API key instead
>
> Create a key in the [console](https://spiral.ai/start) under **API keys**, keep it in `SPIRAL_API_KEY`, and
> put this in `opencode.json`:
>
> ```json theme={null}
> {
>   "$schema": "https://opencode.ai/config.json",
>   "mcp": {
>     "spiral": {
>       "type": "remote",
>       "url": "https://api.spiral.ai/mcp",
>       "headers": { "Authorization": "Bearer {env:SPIRAL_API_KEY}" },
>       "enabled": true
>     }
>   }
> }
> ```

> [accordion] Or use the Spiral CLI
>
> ```bash theme={null}
> npx -y spiral-cli@latest init --browser --agent agents
> ```
>
> This installs `spiral`, signs you in through the browser and adds Spiral's skill for opencode (`~/.agents/skills`),
> so the agent can also run `spiral` commands in the terminal. It needs Node.js 22.12 or later.

If something does not work, see [Troubleshooting](/docs/mcp-server.md#troubleshooting).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.