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

# OpenCode

> Connect TryPost to OpenCode for AI-powered social media management from the terminal

[OpenCode](https://opencode.ai) is an open-source AI coding assistant that runs in your terminal. You can connect it to TryPost's MCP server to manage your social media scheduling with natural language.

## Prerequisites

* OpenCode installed
* A TryPost Cloud account with an active trial or subscription ([start a 7-day free trial](/knowledge-base/plans-and-billing))

## Setup

<Steps>
  <Step title="Open the configuration file">
    Edit `opencode.json` in your project root (or `~/.config/opencode/opencode.json` for global config):

    ```json theme={null}
    {
      "mcp": {
        "trypost": {
          "type": "remote",
          "url": "https://app.trypost.it/mcp/trypost",
          "enabled": true
        }
      }
    }
    ```

    No `Authorization` header — OpenCode discovers OAuth from the URL.
  </Step>

  <Step title="Sign in via mcp login">
    Run the OAuth flow explicitly so OpenCode caches the token:

    ```bash theme={null}
    opencode mcp login trypost
    ```

    OpenCode opens your browser to TryPost; approve the request and return to the terminal.
  </Step>

  <Step title="Verify the connection">
    Inside OpenCode, ask:

    ```
    List all my TryPost social accounts
    ```

    If anything looks off, `opencode mcp debug trypost` prints the current token state.
  </Step>
</Steps>

<Tip>
  OpenCode also supports `opencode mcp logout trypost` to revoke the cached token if you need to switch accounts.
</Tip>

<Accordion title="Bearer token fallback">
  For CI or non-interactive setups, skip `mcp login` and use a Personal Access Token in the config:

  ```json theme={null}
  {
    "mcp": {
      "trypost": {
        "type": "remote",
        "url": "https://app.trypost.it/mcp/trypost",
        "headers": {
          "Authorization": "Bearer YOUR_API_KEY"
        },
        "enabled": true
      }
    }
  }
  ```

  Create the key from **Settings > API Keys** on the [TryPost dashboard](https://app.trypost.it).
</Accordion>

## Example prompts

```
Create a post for tomorrow at 9am
```

```
Show me all my signatures
```

```
Create a label called "Newsletter" with color #8b5cf6
```
