# Connect GitHub Copilot CLI to Repowise

Wire GitHub Copilot CLI to the local Repowise MCP server, see which files change, verify the connection and remove it.

GitHub Copilot CLI (`copilot`) reads one MCP config per machine and the same
`.github/copilot-instructions.md` that Copilot Chat in VS Code reads.

## Install

**Local, with your agent.** Paste this into a Copilot CLI session:

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

**Local, by hand.** `repowise init` wires Copilot CLI when the `copilot`
binary is on `PATH`. To wire it later:

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

**Hosted.** `repowise agents add --hosted` does not write a Copilot CLI
entry. Add the hosted server by hand with the URL and an API key from
[API keys](https://docs.repowise.dev/hosted/connecting-ide#advanced-api-keys).

## What gets written where

| File | Scope | What repowise writes |
|---|---|---|
| `~/.copilot/mcp-config.json` | user | `mcpServers.repowise`: `{"type": "stdio", "command", "args", "tools": ["*"]}` |
| `.github/copilot-instructions.md` | project | The managed Repowise block, shared with the `vscode` target |

`$COPILOT_HOME` replaces `~/.copilot` when it is set. Copilot CLI has no
project MCP file, so the user entry names no repository: the server answers
for the repository you start `copilot` in.

## Restart

Start a new `copilot` session in the repository. A running session does not
reload the MCP config.

## Verify

```bash
repowise agents
```

You should see `copilot` with status `configured`. In a session, run `/mcp`
to see `repowise` among the configured servers, then ask "What are the
hotspot files in this repo?" and check that Copilot calls a Repowise tool.

## Uninstall

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

This removes the `repowise` entry from `mcp-config.json` and keeps every
other server. The shared instructions block stays while the `vscode` target
still uses it.

## Troubleshooting

| Symptom | Fix |
|---|---|
| `mcp-config.json left unchanged` | The file is not valid JSON. Run `repowise agents print-config copilot --scope=user` and paste the entry under `mcpServers`. |
| `"repowise" entry names a remote server` | Run `repowise agents remove --target=copilot` first if you want the local server instead. |
| The agent answers "not indexed" | Start `copilot` from inside the indexed repository, or run `repowise init` there first. |
| Only five Repowise tools are listed | Copilot CLI gets the core profile by default. See [Tool profiles](https://docs.repowise.dev/agents/tool-profiles). |

## Next
- [VS Code and Copilot](https://docs.repowise.dev/agents/vscode-copilot) for Copilot Chat in the editor.
- [Tool profiles](https://docs.repowise.dev/agents/tool-profiles) to list all ten tools.
- [repowise agents](https://docs.repowise.dev/cli/agents) for every flag.
