> ## Documentation index
> Fetch the complete documentation index at: https://contextrepo.com/docs/llms.txt
> Use it to find every page before exploring further.

# VS Code Setup

> Connect Context Repo to VS Code and access your prompts, documents, and collections directly from GitHub Copilot Chat. Setup takes about two minutes.

Connect Context Repo to VS Code and access your prompts, documents, and collections directly from GitHub Copilot Chat. Setup takes about two minutes.

> **Before you start:** You'll need a [Context Repo](https://contextrepo.com) account with an API key, [VS Code](https://code.visualstudio.com/) installed, and the [GitHub Copilot](https://marketplace.visualstudio.com/items?itemName=GitHub.copilot) extension enabled. VS Code 1.99 or later has built-in MCP support.

### Get your API key

Go to **Dashboard > Settings > API Keys** and click **New API Key**. Select the `prompts.read` and `documents.read` permissions, then copy the generated key. You'll need it in the next step.

### Add the server config

Open (or create) the MCP configuration file at `.vscode/mcp.json` in your workspace. You can also use the global user config by running **MCP: Open User Configuration** from the Command Palette (`Ctrl+Shift+P` / `Cmd+Shift+P`).

Add the Context Repo MCP Server:

```json title=".vscode/mcp.json"
{
  "servers": {
    "context-repo": {
      "command": "npx",
      "args": ["-y", "context-repo-mcp"],
      "env": {
        "CONTEXTREPO_API_KEY": "gm_your_api_key_here"
      }
    }
  }
}
```

Replace `gm_your_api_key_here` with the API key you copied in the previous step.

> **Note:** If you already have other MCP servers configured, add the `"context-repo"` entry inside the existing `"servers"` object.

### Verify the connection

VS Code should detect the new server automatically. If it doesn't, run **MCP: List Servers** from the Command Palette to check its status. Open a GitHub Copilot Chat and ask:

```
List my prompts
```

You should see your Context Repo prompts listed in the response. If you haven't created any prompts yet, the assistant will tell you the list is empty — that still means it's working.

## What you can do

With Context Repo connected, you can ask your AI assistant to:

- **List and search** your prompts, documents, and collections
- **Create new content** directly from the conversation
- **Use prompt templates** with variables filled in contextually
- **Search your knowledge base** using semantic or keyword queries
- **Explore documents** chunk by chunk with Deep Search
- **Manage versions** — view history and restore previous versions

See the [MCP Tools Reference](https://contextrepo.com/docs/mcp/tools-reference) for all 29 available tools.

## Troubleshooting

### Server not starting

Make sure you have Node.js 18 or later installed. Run `node --version` in your terminal to check. The `npx` command needs a working Node.js installation to download and run the MCP server package.

```bash
node --version
# Should print v18.x.x or higher
```

### Tools don't appear in Copilot Chat

Run **MCP: List Servers** from the Command Palette. Context Repo should appear in the list. If the server shows an error status, check the output panel (**MCP** channel) for details. You may need to click **Start** to initialize the server.

### Authentication errors

Double-check that your API key is correct and hasn't been revoked. You can generate a new key from **Dashboard > Settings > API Keys**. Make sure there are no extra spaces or line breaks in the `CONTEXTREPO_API_KEY` value.

### Using the global config instead of workspace

If you'd rather configure Context Repo for all your projects, run **MCP: Open User Configuration** from the Command Palette and add the same server config there. The global config applies across all workspaces.

- [Cursor Setup](https://contextrepo.com/docs/mcp/setup-guides/cursor): Set up Context Repo with Cursor.
- [MCP Tools Reference](https://contextrepo.com/docs/mcp/tools-reference): See the current tools available through the hosted MCP Server.
- [MCP Server Overview](https://contextrepo.com/docs/mcp): Learn about the Model Context Protocol and how it connects your workspace to AI assistants.
