Skip to main content

Overview

Connect Operator to OpenCode so its CLI assistant can call a dedicated, adaptive search agent when it needs documentation, migration guides, or real-world examples for your stack. Instead of bouncing between terminals and browsers, you can keep the entire debugging and research loop inside OpenCode. This page explains how to register Operator as an MCP server using the OpenCode CLI or configuration files and how to verify that Copilot-style flows inside OpenCode can see and use Operator.

Configure Operator via the OpenCode CLI

Use the OpenCode CLI to add Operator as an MCP server:
opencode mcp add operator
Follow the prompts to configure the server details. Point OpenCode at the hosted Operator MCP HTTP endpoint https://mcp.operator.io/mcp and configure it to send your OPERATOR_API_KEY as an Authorization: Bearer ... header. Set OPERATOR_API_KEY in your environment before launching OpenCode:
export OPERATOR_API_KEY="sk_your_api_key_here"
You can create and manage your key at operator.io.

Configure Operator via opencode.json

You can also declare Operator directly in your OpenCode configuration file, for example in ~/.config/opencode/opencode.json:
{
  "mcp": {
    "operator": {
      "type": "remote",
      "url": "https://mcp.operator.io/mcp",
      "enabled": true,
      "headers": {
        "Authorization": "Bearer ${OPERATOR_API_KEY}"
      }
    }
  }
}
For remote deployments, point OpenCode to the hosted Operator MCP endpoint instead:
{
  "mcp": {
    "operator": {
      "type": "remote",
      "url": "https://mcp.operator.io/mcp",
      "headers": {
        "Authorization": "Bearer ${OPERATOR_API_KEY}"
      },
      "enabled": true
    }
  }
}
If you prefer SSE, change the url to https://mcp.operator.io/sse. You can also send the API key using an x-api-key header instead of Authorization:
{
  "mcp": {
    "operator": {
      "type": "remote",
      "url": "https://mcp.operator.io/mcp",
      "headers": {
        "x-api-key": "${OPERATOR_API_KEY}"
      },
      "enabled": true
    }
  }
}
Once Operator is wired in, you can ask the OpenCode assistant to “use Operator to find docs for this error” or “search Operator for an example of this library in a real-world project” and keep the conversation inside your terminal.