> ## 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](/installation) for details.
</Tip>

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

## Setup

<Steps>
  <Step title="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</Warning>
  </Step>

  <Step title="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"
  </Step>
</Steps>

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

<AccordionGroup>
  <Accordion title="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>

  <Accordion title="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>

  <Accordion title="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
  </Accordion>
</AccordionGroup>

<Tip>
  For more solutions, see the [Troubleshooting Guide](/troubleshooting).
</Tip>

## Best Practices

<CardGroup cols={2}>
  <Card title="Keep Context Fresh" icon="sync">
    Regularly sync repositories in CodeAlive dashboard
  </Card>

  <Card title="Use Specific Queries" icon="magnifying-glass">
    Be specific when asking Copilot to search
  </Card>

  <Card title="Leverage Context" icon="brain">
    Let CodeAlive provide context for large codebases
  </Card>

  <Card title="Team Consistency" icon="users">
    Share workspace settings for team alignment
  </Card>
</CardGroup>

## Related Resources

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

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