# Connect Kimi Code

> Add your site to Kimi Code, Moonshot's terminal coding agent, by pasting one message or editing its mcp.json file.

Kimi Code is Moonshot's coding agent for the terminal, with Kimi models. It reads your site from one settings file.

## Before you start

Create a connection for Kimi Code. Open **PowerWP AI › Connections**, choose **Create connection**, pick **Kimi Code**, 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>`. You need Kimi Code, signed in with a Kimi Code membership or set up with another model provider.

## Option 1: let Kimi Code connect itself

Copy the message under **Let Kimi Code connect itself** and paste it into a chat in Kimi Code. It adds your site under `mcpServers` in `~/.kimi-code/mcp.json` and tells you the next step. The message contains your key, so paste it only into your own account. Kimi Code may ask you to allow the change.

## Option 2: edit the settings file

The file is `mcp.json` in the `.kimi-code` folder of your user folder:

| System | Path |
|---|---|
| macOS and Linux | `~/.kimi-code/mcp.json` |
| Windows | `C:\Users\<you>\.kimi-code\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.

:::steps
1. Open `mcp.json` in the `.kimi-code` folder of your user folder.
2. Paste the JSON above and save the file.
3. Start `kimi` again. Sessions that are already open don't pick up the change.
4. Type `/mcp`. Your site shows as connected.
:::

You can also add your site from inside Kimi Code with `/mcp-config`.

## Check it works

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

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

## Troubleshooting

- **`/mcp` does not show your site.** Start a new session. A session that was already open keeps its old settings.
- **The file does not load.** A missing comma or bracket 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
- [Gemini CLI](/docs/connect/gemini-cli/) — Another terminal agent.
- [Choose how to connect](/docs/connect/) — All supported apps.
- [Permissions and presets](/docs/concepts/permissions/) — Decide what Kimi Code may do.
:::

Source: https://powerwp.ai/docs/connect/kimi-code/
