# Connect GitHub Copilot in VS Code

**What this is:** add Bill & Ben to Copilot Chat in Visual Studio Code.
**Who it is for:** developers using VS Code with GitHub Copilot.

## Who can use it
Anyone with VS Code and Copilot. On Copilot Business and Enterprise your organisation controls MCP servers with a policy called **MCP servers in Copilot**. It is **off by default**. On Copilot Free and Pro that policy does not apply. Your account also needs the Bill & Ben permission `gateway.connect` ([permissions](../platform/permissions.md)).

## What an admin must do
- On Copilot Business or Enterprise, a GitHub admin turns on **MCP servers in Copilot**. For an enterprise it is under AI controls, then MCP. For one organisation it is under Settings, Copilot, Policies, Features.
- Give developers the Bill & Ben permissions.

## Steps (guided)
1. Open the Command Palette and run **MCP: Add Server**.
2. Choose **HTTP**.
3. Enter the address `https://ai.<brand>/mcp` and the name `bb`.
4. Choose where to save it: this workspace or your user profile.
5. VS Code asks you to sign in. A browser opens. Sign in with your company account and choose **Allow**.
6. Open Copilot Chat, switch to **Agent** mode, open the tools list and check the Bill & Ben tools are there.

## Steps (by hand)
Create `.vscode/mcp.json` in your project, or open your user file with **MCP: Open User Configuration**:

```json
{
  "servers": {
    "bb": {
      "type": "http",
      "url": "https://ai.<brand>/mcp"
    }
  }
}
```
Then choose **Start** above the entry.

### With a personal access token
Create a token (see the [overview](../connect-your-ai.md#personal-access-token)). Do not write it into the file. Let VS Code ask for it:

```json
{
  "inputs": [
    { "id": "access-token", "type": "promptString", "description": "Bill & Ben token", "password": true }
  ],
  "servers": {
    "bb": {
      "type": "http",
      "url": "https://ai.<brand>/mcp",
      "headers": { "Authorization": "Bearer ${input:access-token}" }
    }
  }
}
```

## What you can do
All the tools on the [overview](../connect-your-ai.md#what-you-can-do-once-connected). Copilot asks before it runs a tool the first time.

## If it goes wrong

| You see | What to do |
|---|---|
| The server does not appear or is blocked | Your organisation's **MCP servers in Copilot** policy is off. Ask a GitHub admin. |
| Sign-in does not start | Run **MCP: List Servers**, choose `bb`, then **Show Output** and read the last lines. |
| Browser sign-in fails with a return-address error | Bill & Ben accepts the desktop and the vscode.dev return addresses. Ask your Bill and Ben contact, or use a personal token. |
| Sign-in page says **Not on your organisation's list** | Your admin must add you. |
| "your organisation has not given you gateway access" | Ask for `gateway.connect`. |

## Disconnect
1. Run **MCP: List Servers**, choose `bb` and stop or remove it. Delete its entry from `mcp.json` too.
2. Run **Authentication: Remove Dynamic Authentication Providers** and pick Bill & Ben.
3. In the Accounts menu choose **Manage Trusted MCP Servers** and remove it. **MCP: Reset Trust** resets all.

To cut access at once, ask your admin to remove your `gateway.connect` permission, and revoke any personal token on the tokens page.
