> ## 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.

# VS Code + GitHub Copilot

> Connect CodeAlive with GitHub Copilot in VS Code using native MCP support

## Overview

GitHub Copilot now has native MCP (Model Context Protocol) support in VS Code! Connect CodeAlive to enhance Copilot with deep understanding of your entire codebase.

> [!TIP]
>
> **Quick install:** Run `npx @codealive/installer` to automatically configure CodeAlive for VS Code.
> See the [Installation Guide](https://docs.codealive.ai/installation.md) for details.

## Prerequisites

* VS Code version 1.102 or higher
* GitHub Copilot Business or Enterprise subscription (MCP access controlled by organization administrators)
* CodeAlive account with API key ([Sign up here](https://app.codealive.ai))
* Indexed repositories in your CodeAlive dashboard

> [!WARNING]
>
> MCP is disabled by default in Copilot. Your organization administrator must enable it via policy settings.

## Setup

**1. Add CodeAlive MCP Server**

GitHub Copilot supports multiple MCP transports (stdio, HTTP Stream, SSE):

1. Open Command Palette (Cmd/Ctrl+Shift+P)
2. Run: **"GitHub Copilot: Add MCP Server"**
3. Choose **"HTTP Stream"** server type (recommended)
4. Enter configuration:

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

> [!WARNING]
>
> Replace `YOUR_API_KEY_HERE` with your actual CodeAlive API key

**2. Verify Integration**

Test in GitHub Copilot Chat:

* Open Copilot Chat (Cmd/Ctrl+I)
* Ask: "What repositories are available in CodeAlive?"
* Try: "Search for authentication code in my codebase"

## Using CodeAlive with Copilot

### In Copilot Chat

The MCP integration automatically provides context:

```
You: Explain how the user authentication works in this project

Copilot: [Uses CodeAlive to search for auth code]
         [Provides explanation with actual code references]
```

### Enhanced Features

With CodeAlive connected, Copilot can:

* Search across your entire codebase
* Understand project architecture
* Find similar implementations
* Generate code matching your patterns

## Alternative: Local MCP Server

Run CodeAlive MCP locally with Docker:

```bash theme={null}
docker run -d \
  -p 8000:8000 \
  -e CODEALIVE_API_KEY=YOUR_API_KEY \
  --name codealive-mcp \
  ghcr.io/codealive-ai/codealive-mcp:main
```

Then configure MCP to use local server:

```json theme={null}
{
  "servers": {
    "codealive": {
      "type": "http",
      "url": "http://localhost:8000/api",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}
```

## Configuration Options

### Workspace Settings

Add to `.vscode/settings.json`:

```json theme={null}
{
  "github.copilot.enable": {
    "*": true
  },
  "mcp.servers": {
    "codealive": {
      "type": "http",
      "url": "https://mcp.codealive.ai/api",
      "headers": {
        "Authorization": "Bearer ${env:CODEALIVE_API_KEY}"
      }
    }
  }
}
```

### Team Setup

For teams, use environment variables:

1. Add to `.vscode/settings.json`:

```json theme={null}
{
  "mcp.servers.codealive.headers.Authorization": "Bearer ${env:CODEALIVE_API_KEY}"
}
```

2. Each team member sets:

```bash theme={null}
export CODEALIVE_API_KEY="their_api_key"
```

## Troubleshooting

> [accordion] MCP not available in Copilot
>
> **Common causes:**
>
> * MCP is disabled by organization policy (default)
> * Using Individual plan (requires Business/Enterprise)
> * VS Code version \< 1.102
>
> **Solutions:**
>
> 1. Contact your GitHub organization administrator to enable MCP
> 2. Upgrade to Copilot Business or Enterprise
> 3. Update VS Code to version 1.102+
> 4. Update GitHub Copilot extensions to latest versions

> [accordion] CodeAlive not providing context
>
> **Solutions:**
>
> 1. Verify MCP server is configured
> 2. Check API key is valid
> 3. Run "MCP: List Servers" to verify CodeAlive is listed
> 4. Try removing and re-adding the server

> [accordion] Authentication errors
>
> **Solutions:**
>
> 1. Regenerate API key in CodeAlive dashboard
> 2. Ensure "Bearer " prefix is included
> 3. Check for typos in configuration
> 4. Test API key with curl

> [!TIP]
>
> For more solutions, see the [Troubleshooting Guide](https://docs.codealive.ai/troubleshooting.md).

## Best Practices

> [card] Keep Context Fresh
>
> Regularly sync repositories in CodeAlive dashboard

> [card] Use Specific Queries
>
> Be specific when asking Copilot to search

> [card] Leverage Context
>
> Let CodeAlive provide context for large codebases

> [card] Team Consistency
>
> Share workspace settings for team alignment

## Related Resources

* [GitHub Copilot Docs](https://docs.github.com/copilot)
* [MCP Overview](https://docs.codealive.ai/integrations/mcp.md)
* [CodeAlive Dashboard](https://app.codealive.ai)
* [Self-Hosting Guide](https://docs.codealive.ai/integrations/mcp/self-hosting.md)

## Instruct Your Agent

Connecting CodeAlive makes its tools available, but the agent may still default to its built-in search. For reliable results, add a short instruction in the agent's native format telling it to prefer `semantic_search` and `grep_search` when exploring indexed code. See [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.