---
title: "OpenCode"
description: "Connect OpenCode with OAuth — add the remote URL, approve in the browser."
url: https://www.unitpost.com/guides/mcp/opencode
section: MCP
updated: 2026-08-28
---
# OpenCode

## Connection settings

- **Server URL**: https://mcp.unitpost.com/mcp
- **Transport**: Streamable HTTP
- **Auth (recommended)**: OAuth 2.1 — add the URL, approve in the browser (scopes match API capabilities; tokens refresh automatically)
- **Auth (legacy)**: Authorization: Bearer pk_live_YOUR_KEY (workspace API key from Settings → API keys; for clients that can only paste a key)
- **Tools**: one per API operation (email_send, email_campaigns_send, …)

## OpenCode

> Connect OpenCode with OAuth — add the remote URL, approve in the browser.

OpenCode auto-detects OAuth on 401 (DCR). Add a remote server and run `opencode mcp auth unitpost`.

### 1. Add the remote server

Put this in `~/.config/opencode/opencode.jsonc` (or project `opencode.json`). No key to copy. Your client opens Unitpost in the browser — pick a workspace, approve the scopes, and you're connected. Tokens refresh automatically.

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

### 2. Authenticate

Restart OpenCode, then run `opencode mcp auth unitpost` (or wait for the first tool call). Complete the browser approval.

### 3. Verify

Run `opencode mcp list`. unitpost should show connected.

### 4. Send a test

Ask the agent to send a test email from a verified domain and confirm it in Unitpost Activity.

## Related

- [Grok](https://www.unitpost.com/guides/mcp/grok): Point Grok at the Unitpost MCP URL. Marketplace listing is a separate catalog PR.
- [Generic / custom client](https://www.unitpost.com/guides/mcp/custom): Connect any MCP-compatible client or your own agent to Unitpost.
- [Headless / API key](https://www.unitpost.com/guides/mcp/headless): No browser on this machine? CI, SSH, containers, or paste-a-key-only clients — use a key.
