Skip to main content

Overview

Connect CodeAlive with OpenCode — an open-source AI coding assistant that runs in your terminal. OpenCode uses its own JSON configuration format with a type: remote transport for HTTP connections.
Quick install: Run npx @codealive/installer to automatically configure CodeAlive for OpenCode. See the Installation Guide for details.

Prerequisites

Setup

1

Locate Config File

OpenCode reads configuration from opencode.json in your project root or home directory.
2

Add CodeAlive Server

Add this to your opencode.json:
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "codealive": {
      "type": "remote",
      "url": "https://mcp.codealive.ai/api",
      "enabled": true,
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY_HERE"
      }
    }
  }
}
Replace YOUR_API_KEY_HERE with your actual CodeAlive API key.
OpenCode uses type: "remote" for HTTP-based MCP servers, which is different from most other clients that use type: "http" or type: "streamable-http".
3

Restart OpenCode

Restart OpenCode to load the new MCP configuration.
4

Verify Integration

Try these commands with OpenCode:
  • “Show me all available repositories”
  • “Find authentication code in my codebase”
  • “Explain how the payment flow works”

Docker Alternative

If you prefer running the MCP server locally:
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "codealive": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run", "--rm", "-i",
        "-e", "CODEALIVE_API_KEY=YOUR_API_KEY_HERE",
        "ghcr.io/codealive-ai/codealive-mcp:v0.3.0"
      ],
      "enabled": true
    }
  }
}

Usage

Once connected, OpenCode can:
  • Search your codebase semantically across all indexed repositories
  • Answer architecture questions with full project context
  • Find patterns and implementations across multiple services
"Find all error handling patterns in the payment service"
"Explain how the user registration flow works"
"Search for database migration code across services"

Troubleshooting

  1. Verify the config file is named opencode.json
  2. Check that type is set to "remote" (not "http")
  3. Ensure "enabled": true is set
  4. Restart OpenCode
  1. Verify your API key is correct
  2. Ensure the Authorization header includes Bearer prefix
  3. Try regenerating your API key in the dashboard
  1. Check your network connection
  2. Try the Docker STDIO option for local access
  3. Verify the URL is https://mcp.codealive.ai/api
For more solutions, see the Troubleshooting Guide.