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

# SourceCraft

> Connect CodeAlive with SourceCraft Code Assistant and SourceCraft CLI

## Overview

SourceCraft provides two different AI clients with separate MCP configuration formats:

* **SourceCraft Code Assistant for VS Code** uses `mcpServers` and Streamable HTTP.
* **SourceCraft CLI** launches a bundled OpenCode agent with `src code` and uses OpenCode's `mcp` configuration.

Follow the section for the client you use. Configuring one does not configure the other.

## Prerequisites

* A CodeAlive account and [API key](https://app.codealive.ai/settings/api-keys)
* At least one indexed repository or workspace in CodeAlive
* SourceCraft Code Assistant for VS Code or SourceCraft CLI with OpenCode installed

## SourceCraft Code Assistant for VS Code

> [!WARNING]
>
> According to the current [SourceCraft documentation](https://sourcecraft.dev/portal/docs/en/code-assistant/operations/agent/mcp/using-mcp-in-ca) (verified Jul 2026), external MCP server configuration is supported only in the Visual Studio Code extension. The JetBrains plugin is available, but does not currently expose external MCP configuration.

**1. Open the MCP configuration**

In the Code Assistant chat panel, open **MCP servers** and enable **Enable MCP Servers**.

Select **Edit Global MCP** to open the global `mcp_settings.json` file.

**2. Add CodeAlive**

Add the CodeAlive server under `mcpServers`:

```json theme={null}
{
  "mcpServers": {
    "codealive": {
      "type": "streamable-http",
      "url": "https://mcp.codealive.ai/api",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY_HERE"
      },
      "disabled": false
    }
  }
}
```

Replace `YOUR_API_KEY_HERE` with your CodeAlive API key.

**3. Verify the connection**

Save the file, return to the MCP servers panel, and restart the `codealive` server. Expand the server entry to confirm that its tools were detected.

> [!WARNING]
>
> SourceCraft also supports a project-level `.codeassistant/mcp.json` file. Do not commit an API key to version control; prefer the global configuration when using a literal key.

## SourceCraft CLI with OpenCode

SourceCraft CLI installs an isolated OpenCode binary, but retains OpenCode's standard project configuration, plugins, rules, and tools. The setup below was verified with a project-level `opencode.json` used by `src code`.

**1. Set the API key environment variable**

Make your CodeAlive API key available to OpenCode in the terminal where you will run SourceCraft CLI.

> [tab] macOS and Linux
>
> ```bash theme={null}
> export CODEALIVE_API_KEY="YOUR_API_KEY_HERE"
> ```

> [tab] Windows PowerShell
>
> ```powershell theme={null}
> $env:CODEALIVE_API_KEY="YOUR_API_KEY_HERE"
> ```

**2. Add the OpenCode configuration**

Create or update `opencode.json` at the repository root:

```json theme={null}
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "codealive": {
      "type": "remote",
      "url": "https://mcp.codealive.ai/api",
      "enabled": true,
      "headers": {
        "Authorization": "Bearer {env:CODEALIVE_API_KEY}"
      }
    }
  }
}
```

OpenCode replaces `{env:CODEALIVE_API_KEY}` at runtime, so the API key does not need to be stored in the project file.

**3. Verify and launch**

From the repository root, verify that OpenCode can connect to CodeAlive, then start the agent:

```bash theme={null}
src code -- mcp list
src code
```

> [!NOTE]
>
> The two SourceCraft clients use different MCP schemas. Do not copy the VS Code `mcpServers` configuration into `opencode.json`, or the OpenCode `mcp` configuration into `mcp_settings.json`.

## Try It

Ask SourceCraft Code Assistant or SourceCraft CLI:

* "Show me all available repositories"
* "Find the authentication flow in the indexed repository"
* "Explain what calls this service and fetch the relevant implementations"

## Troubleshooting

> [accordion] CodeAlive is missing from the SourceCraft Code Assistant server list
>
> 1. Confirm that **Enable MCP Servers** is enabled
> 2. Check that the configuration is inside the top-level `mcpServers` object
> 3. Validate the JSON syntax and restart the `codealive` server
> 4. Confirm that you are using the VS Code extension; according to the SourceCraft documentation verified in Jul 2026, the JetBrains plugin does not expose external MCP configuration

> [accordion] SourceCraft CLI does not detect CodeAlive
>
> 1. Run the commands from the directory containing `opencode.json`
> 2. Confirm that the configuration uses `mcp`, not `mcpServers`
> 3. Confirm that `type` is `"remote"`
> 4. Run `src code -- mcp list` to inspect the connection status

> [accordion] Authentication fails
>
> 1. Confirm that the API key is active in the [CodeAlive dashboard](https://app.codealive.ai/settings/api-keys)
> 2. For VS Code, include the `Bearer ` prefix in the `Authorization` header
> 3. For SourceCraft CLI, confirm that `CODEALIVE_API_KEY` is set in the same terminal session used to run `src code`

## Related Resources

* [SourceCraft MCP configuration](https://sourcecraft.dev/portal/docs/en/code-assistant/operations/agent/mcp/using-mcp-in-ca)
* [SourceCraft CLI quickstart](https://sourcecraft.dev/portal/docs/en/sourcecraft/operations/cli-quickstart)
* [OpenCode MCP documentation](https://opencode.ai/docs/mcp-servers/)
* [MCP Overview](https://docs.codealive.ai/integrations/mcp.md)
* [Instructing Coding Agents](https://docs.codealive.ai/guides/instructing-agents.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.