---
title: "Connect OpenCode"
description: "Configure the Bauhow MCP server globally or per project in OpenCode."
---

OpenCode supports remote MCP servers and handles OAuth automatically. You do not need a fixed client ID or client secret.

## Configuration

Add the entry globally in `~/.config/opencode/opencode.json` or for one project in `opencode.json` at the project root:

```json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "bauhow": {
      "type": "remote",
      "url": "https://mcp.bauhow.com/mcp",
      "enabled": true
    }
  }
}
```

You can also find the URL under **Bauhow → Settings → Workspace → MCP server**. The MCP server must be enabled there for your workspace.

## Authorize

Start authentication in your terminal:

```bash
opencode mcp auth bauhow
```

OpenCode opens your browser. Sign in to Bauhow, choose the workspace on the **Allow access** page, and approve. OpenCode stores the credentials locally and refreshes them automatically.

Then check the status:

```bash
opencode mcp auth list
```

## Use it

```text
Use the "bauhow" MCP server. Show the status of every planning module in
project <PROJECT-ID>. Do not change any data.
```

OpenCode exposes MCP tools alongside its built-in coding tools. Name `bauhow` in the prompt when several servers provide similar tools.

## Troubleshooting

```bash
opencode mcp debug bauhow
```

This command checks connectivity, OAuth metadata, and stored authentication status. Run `opencode mcp logout bauhow` to remove local credentials and authorize the connection again, for example to choose a different workspace.

:::info
You can commit a project-level `opencode.json` for your team. It contains only the server URL, not credentials. Each person runs `opencode mcp auth bauhow` separately and chooses their workspace.
:::

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