# Connect Cursor to Repowise

Connect Cursor to Repowise with the Cursor plugin (hosted, OAuth) or the local MCP server, see which files change, verify and remove it.

Cursor reaches Repowise two ways: the Repowise plugin, which connects the
hosted server with a browser sign-in, or the local server that `repowise init`
wires into the project.

## Install

**The Cursor plugin (hosted).** Open **Cursor Settings > Plugins**, search
for **Repowise** and click **Install**, or run this in Cursor chat:

```text
/add-plugin repowise
```

Sign in with your repowise.dev account when Cursor asks. Auth is OAuth;
leave any client ID and secret blank. Public repositories already indexed on
repowise.dev work at once; index your own from the
[dashboard](https://repowise.dev/dashboard). The plugin adds the hosted
server (`https://api.repowise.dev/mcp`) and one skill,
`codebase-questions`, which picks the repository and the right tool for a
question.

**Local, with your agent.** Paste this into Cursor:

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

**Local, by hand.** `repowise init` wires Cursor when it is installed. To
wire it later:

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

**Hosted, per repository, without the plugin:**

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

## What gets written where

| File | Scope | What repowise writes |
|---|---|---|
| `.cursor/mcp.json` | project | `mcpServers.repowise` with `"type": "stdio"` and the absolute repo path as an argument |
| `.cursor/rules/repowise.mdc` | project | The managed Repowise rule, with `alwaysApply: true` so it loads in every conversation |
| `~/.cursor/hooks.json` | user | The `preToolUse` command-rewrite hook on `Shell`, and the `afterFileEdit` hook when [attribution capture](https://docs.repowise.dev/intelligence/ai-attribution) is on |

The local MCP entry is project scope only: one entry in `~/.cursor/mcp.json`
can name only one repository. The `type` field and the absolute path are both
required, so copying the repo's `.mcp.json` into `.cursor/mcp.json` by hand
breaks it. The hosted entry goes into `.cursor/mcp.json` beside the local
one, named `repowise-hosted` when a local `repowise` exists.

## Restart

Open **Cursor Settings > MCP** and check that `repowise` is listed and
enabled. For a hosted entry, click **Needs login** next to it and approve
Repowise in the browser. Reload the window if the server does not appear.

## Verify

```bash
repowise agents
```

You should see `cursor` with status `configured`. In Cursor's agent, ask
"What are the hotspot files in this repo?" and check that it calls a
Repowise tool. Cursor lists the five core tools by default; see
[Tool profiles](https://docs.repowise.dev/agents/tool-profiles) to list all ten.

## Uninstall

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

This removes the MCP entry, the rule file and the hooks, and leaves every
other server in `.cursor/mcp.json`. Remove the plugin from **Cursor Settings
> Plugins**.

## Troubleshooting

| Symptom | Fix |
|---|---|
| Every call answers "not indexed" | The entry lost its absolute path. Cursor starts MCP servers outside the workspace root. Run `repowise agents add --target=cursor` to rewrite it. |
| `.cursor/mcp.json left unchanged` | The file has comments or is not strict JSON, and repowise does not rewrite it. Run `repowise agents print-config cursor` and paste the entry. |
| `~/.cursor/hooks.json` is not valid JSON | `repowise doctor` reports it. Fix the file, then run `repowise agents add --target=cursor --scope=user`. |
| The plugin shows no repositories | Sign in with the repowise.dev account that indexed them, or index one from the dashboard. |

## Next
- [Connecting your IDE](https://docs.repowise.dev/hosted/connecting-ide) for the hosted URL and keys.
- [Tool profiles](https://docs.repowise.dev/agents/tool-profiles) to list more tools in Cursor.
- [repowise agents](https://docs.repowise.dev/cli/agents) for every flag.
