---
url: https://chartbuddy.io/hub/docs/connect-mcp/opencode.md
---
> Docs index: [llms.txt](https://chartbuddy.io/hub/docs/llms.txt)


# Connect OpenCode

Wire **[OpenCode](https://opencode.ai)** to Chartbuddy Hub over local stdio MCP.

## Setup via Chartbuddy Hub

1. Install Chartbuddy Hub and launch it once (approve OS security prompts).
2. Open **AI connections** in Hub (title-bar cable icon).

3) Connect **OpenCode**. Hub writes the server into your global OpenCode config.

4. Restart OpenCode so tools load.

## Setup manually

Edit your **global** OpenCode config (`opencode.json` or `opencode.jsonc` – prefer global so the absolute Chartbuddy path is not committed to a repo):

* macOS / Linux: `~/.config/opencode/`
* Windows: `%USERPROFILE%\.config\opencode\`

Add a `Chartbuddy-Hub` entry under `mcp.servers`:

::: code-group

```json [Windows]
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "servers": {
      "Chartbuddy-Hub": {
        "type": "local",
        "command": [
          "C:\\Users\\YOUR_USER\\AppData\\Local\\Programs\\Chartbuddy\\chartbuddy.exe",
          "--mcp"
        ]
      }
    }
  }
}
```

```json [macOS]
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "servers": {
      "Chartbuddy-Hub": {
        "type": "local",
        "command": [
          "/Applications/Chartbuddy.app/Contents/MacOS/chartbuddy",
          "--mcp"
        ]
      }
    }
  }
}
```

:::

Keep **Chartbuddy Hub** running. Restart OpenCode so tools load.

## Verify

::: code-group

```powershell [Windows]
& "$env:LOCALAPPDATA\Programs\Chartbuddy\chartbuddy.exe" --mcp-status
```

```bash [macOS]
/Applications/Chartbuddy.app/Contents/MacOS/chartbuddy --mcp-status
```

:::

Exit `0` = Chartbuddy Hub bridge up.
