# Connect VS Code and GitHub Copilot Chat to Repowise

Wire VS Code's Copilot Chat agent mode to the local or hosted Repowise MCP server, see which files change, verify and remove it.

Copilot Chat in VS Code agent mode calls Repowise through MCP. The
[Repowise VS Code extension](https://docs.repowise.dev/getting-started/vscode) registers the
server for you and adds editor signals on top; this page covers the MCP
wiring on its own.

## Install

**Local, with your agent.** Paste this into Copilot Chat in agent mode:

```text
Read https://docs.repowise.dev/setup.md and set up Repowise in this repository.
```

**Local, by hand.** `repowise init` writes the VS Code files by default. To
wire it later:

```bash
repowise agents add --target=vscode
```

Or install the Repowise extension (search **Repowise**, publisher
`repowise-dev`), which registers the server with VS Code directly, and run
**Repowise: Configure MCP for this Workspace** to write `.vscode/mcp.json`.

**Hosted.** Run in the repository, then sign in when VS Code asks:

```bash
repowise agents add --target=vscode --hosted
```

The **Install** button on [Settings > Coding agents (MCP)](https://www.repowise.dev/settings?tab=editor)
does the same without the CLI.

## What gets written where

| File | Scope | What repowise writes |
|---|---|---|
| `.vscode/mcp.json` | project | `servers.repowise` (VS Code uses `servers`, not `mcpServers`) |
| `.vscode/extensions.json` | project | A recommendation for the Repowise extension |
| `.github/copilot-instructions.md` | project | The managed Repowise block, which Copilot Chat reads on every request. Copilot CLI shares it |

The hosted entry is `"type": "http"` in `.vscode/mcp.json`, named
`repowise-hosted` when a local `repowise` exists.

## Restart

No restart. Open `.vscode/mcp.json` and click **Start** above `repowise`, or
run **MCP: List Servers** from the Command Palette and start it there. For a
hosted entry, click **Start** and allow Repowise in the browser.

## Verify

```bash
repowise agents
```

You should see `vscode` with status `configured`. In Copilot Chat, switch
to agent mode, open the tools picker and check that the Repowise tools are
listed, then ask "What are the hotspot files in this repo?".

## Uninstall

```bash
repowise agents remove --target=vscode
```

This removes the `repowise` server and the managed block, keeping your other
servers. When Copilot CLI still uses the shared instructions block, the
command asks before stripping it.

## Troubleshooting

| Symptom | Fix |
|---|---|
| `.vscode/mcp.json left unchanged` | VS Code allows comments there and repowise does not rewrite a file it cannot parse as strict JSON. Run `repowise agents print-config vscode` and paste the entry under `servers`. |
| The server is listed but stopped | Click **Start** above it in `.vscode/mcp.json`, or run **MCP: List Servers**. |
| Copilot lists only five Repowise tools | VS Code gets the core profile by default. See [Tool profiles](https://docs.repowise.dev/agents/tool-profiles). |
| `"repowise" entry names a remote server` | Rename the hosted entry to `repowise-hosted` and re-run `repowise agents add --target=vscode`. |

## Next
- [VS Code extension](https://docs.repowise.dev/getting-started/vscode) for health signals, CodeLens and change risk in the editor.
- [Copilot CLI](https://docs.repowise.dev/agents/copilot-cli) for the terminal agent.
- [Tool profiles](https://docs.repowise.dev/agents/tool-profiles) to list all ten tools.
