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

# OpenCode

> Connect OpenCode, the terminal-native AI coding assistant, to Control Plane to operate your infrastructure without leaving your shell.

## Prerequisites

> [card] OpenCode
>
> Install [OpenCode](https://opencode.ai)

> [card] Control Plane account
>
> Sign up at [console.cpln.io](https://console.cpln.io) if you don't have an account yet

## Add the MCP server

**1. Run the add wizard**

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

Answer the prompts:

| Prompt | Value |
| - | - |
| Location | **Global** |
| MCP server name | `controlplane` |
| MCP server type | **Remote** |
| MCP server URL | `https://mcp.cpln.io/mcp` |
| Does this server require OAuth authentication? | **Yes** |
| Do you have a pre-registered client ID? | **No** |

> [!NOTE]
>
> Connecting to the bare URL uses the default **`core`** toolset profile — a focused set that already covers the whole build-and-operate workflow (it can read and delete any resource kind generically), which is the right fit for this client. Append `?toolsets=mk8s` to add BYOK Kubernetes tools, or `?toolsets=full` for everything. See [toolset profiles](https://docs.controlplane.com/ai/mcp.md#toolset-profiles).

OpenCode writes the entry to `~/.config/opencode/opencode.jsonc`.

**2. Authenticate**

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

Your browser opens:

1. Sign in to Control Plane (Google, GitHub, Microsoft, or SAML).
2. Select the orgs you want OpenCode to access.
3. Click **Authorize**.

Your browser shows a success page — close the tab and return to the terminal. OpenCode prints **Authentication successful!**.

**3. Use it**

Launch OpenCode and ask "list GVCs in org `<your-org>`" (using one of the orgs you authorized) to confirm.

## Example conversation

**1. Set Context**

```text theme={null}
Use org "my-org" and gvc "my-gvc" for context.
```

**2. Deploy a Workload**

```text theme={null}
Create a publicly accessible workload called "my-api" using nginx:latest on port 80.
```

**3. Get the Endpoint**

```text theme={null}
Monitor the readiness of my-api and give me the public endpoint once it's ready.
```

## Troubleshooting

> [accordion] Need to change which orgs are authorized
>
> Re-run `opencode mcp auth controlplane`. Sign in again and adjust your org selections on the consent screen.

## Next steps

> [card] [Usage Examples](https://docs.controlplane.com/ai/examples.md)
>
> Practical prompts for common Control Plane workflows

> [card] [Template Catalog](https://docs.controlplane.com/template-catalog/overview.md)
>
> 30+ production-ready templates your AI can deploy on request
