# Connect Cursor

> Add your WordPress site to Cursor as an MCP server with the Add to Cursor button, a pasted message or mcp.json, so Cursor's agent can use its tools.

Cursor is a code editor with an AI agent. It suits you if you already edit your theme or plugins in Cursor: your site's tools become available to its agent.

## Before you start

Create a connection for Cursor. Open **PowerWP AI › Connections**, choose **Create connection**, pick **Cursor**, name it and choose what it may do. Choose **Create key and show steps**: the window shows the steps below with your address and key already in them. The key is shown once. Here it appears as `<your key>`.

## Option 1: one click

:::steps
1. In the setup window, click **Add to Cursor**.
2. Cursor opens and asks you to install your site's server. Confirm it.
3. Check the connection: Cursor lists your site among its MCP servers, with its tools.
:::

The button hands your key from the page straight to Cursor.

## Option 2: let Cursor connect itself

Copy the message under **Let Cursor connect itself** and paste it into a chat in Cursor. It adds your site under `mcpServers` in `~/.cursor/mcp.json` and tells you the next step. The message contains your key, so paste it only into your own account.

## Option 3: add it by hand

Open `mcp.json` in the `.cursor` folder of your user folder (`~/.cursor/mcp.json`). Create it if it isn't there. A new or empty file can hold exactly this:

```json
{
  "mcpServers": {
    "your-store": {
      "url": "https://your-store.com/wp-json/wpai/v1/mcp",
      "headers": { "X-WPAI-Token": "<your key>" }
    }
  }
}
```

If the file already lists other servers, paste only the `your-store` entry inside `mcpServers`, after the last entry, with a comma between the two. Save the file and check that Cursor lists your site.

> [!WARNING] Your key is saved in `~/.cursor/mcp.json` in your user folder. Don't copy that file into a shared project.

## Check it works

Ask the agent:

```
Give me an overview of my site.
```

It calls `site_overview` and answers with your WordPress version, theme and plugins.

## Troubleshooting

- **Nothing happens when you click Add to Cursor.** Your browser could not open Cursor. Use option 3.
- **Cursor does not show your site.** Quit Cursor completely and open it again. A missing comma or bracket in `mcp.json` also stops it: copy the whole file again if you are unsure.
- **401 "Authentication required".** The key was copied incompletely. Keys cannot be shown twice: revoke the connection and create a new one.
- **403 or 429.** 403 means your IP address is not on the connection's allow-list, or a firewall blocks `/wp-json/wpai/v1/`. 429 means too many requests: wait a few minutes.

## Related

:::cards
- [Choose how to connect](/docs/connect/) — All supported apps.
- [VS Code](/docs/connect/vs-code/) — Another editor with a one-click button.
- [Permissions and presets](/docs/concepts/permissions/) — Decide what Cursor may do.
:::

Source: https://powerwp.ai/docs/connect/cursor/
