> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://support.promo.ly/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Connect OpenCode

These steps connect OpenCode to your Promoly account. Last tested on **October 2, 2026** with OpenCode 1.18.33.

Connected agents are in an invite-only beta. See [Connect an AI coding agent](https://support.promo.ly/en/article/connect-an-ai-coding-agent-1udge2h/) for what an agent can and can't do.

## Add the Promoly server

Add this to your OpenCode config, either `~/.config/opencode/opencode.json` for every project or `opencode.json` in one project:

```json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "promoly": {
      "type": "remote",
      "url": "https://api.promo.ly/mcp",
      "oauth": { "clientId": "promoly-opencode" }
    }
  }
}
```

If the file already has an `mcp` section, add the `promoly` entry inside it. Don't set a custom `redirectUri` or `callbackPort`. Promoly expects OpenCode's standard callback on port 19876.

## Sign in

```sh
opencode mcp auth promoly
```

Your browser opens Promoly. Sign in, choose the account, decide whether to allow drafts, and click **Allow access**. OpenCode shows **Done** when it's connected.

## Check the connection

Start OpenCode and paste:

```text
Use the promoly tools to show which Promoly account you're connected to, then list my five most recent campaigns.
```

## Sign out or remove it

```sh
opencode mcp logout promoly
```

Then delete the `promoly` entry from your config if you want to remove the server. Signing out on your computer doesn't end the connection on Promoly's side. To do that, disconnect it under **Profile** → **Manage connected apps** in the dashboard.

## If something goes wrong

- **Port 19876 is busy.** Another app is using it. Close that app and run `opencode mcp auth promoly` again.
- **OpenCode reports an authentication error after a disconnect or after 30 days.** Run `opencode mcp auth promoly` again.
- **You want to check what OpenCode sees.** `opencode mcp list` shows whether promoly is connected, and `opencode mcp debug promoly` shows the sign-in details.