New: the MailCraft MCP server is live โ€” connect your AI agent in one line. Connect your agent โ†’
AI agents

OpenCode

OpenCode is an open-source AI coding agent for the terminal. With MailCraft connected, it can send and manage email as part of an agentic session.

Prerequisites

  • OpenCode installed
  • A MailCraft API key with the scopes you want the agent to have โ€” create one under Settings โ†’ API keys.

Setup

  1. 1

    Set your API key

    Keep the key out of the config file by exporting it from your shell profile (~/.zshrc, ~/.bashrc, โ€ฆ):

    terminal
    export MAILCRAFT_API_KEY="sk_live_your_api_key"
  2. 2

    Add the server

    In opencode.json at your project root, or ~/.config/opencode/opencode.json for every project:

    opencode.json
    {
      "$schema": "https://opencode.ai/config.json",
      "mcp": {
        "mailcraft": {
          "type": "remote",
          "url": "https://mcp.mailcraft.host",
          "headers": {
            "Authorization": "Bearer {env:MAILCRAFT_API_KEY}"
          },
          "enabled": true
        }
      }
    }
  3. 3

    Restart OpenCode

    Close and reopen OpenCode to load the configuration.

  4. 4

    Verify the connection

    Ask:

    opencode
    List all my MailCraft domains

Example prompts

Once connected, try asking OpenCode:

  • Send a test of the "Welcome" template to me
  • Which automations are active right now?
  • Validate every email address in fixtures/users.json

See every tool the agent can use in the MCP server reference.