---
title: Connect Claude Code to your WordPress sites
description: Connect Claude Code to the AI MCP service with a single command, then run your first WordPress ability.
url: https://developers.wpengine.com/docs/ai/api/mcp/how-to/configure-claude-code/
image: https://developers.wpengine.com/og/docs/ai/api/mcp/how-to/configure-claude-code.png
---

# Connect Claude Code to your WordPress sites

In this guide, you use the Model Context Protocol (MCP) to connect Claude Code to your WordPress sites through the WP Engine AI MCP server. The guide covers everything from signing in to running your first ability. To configure *Claude Desktop*, see [Connect Claude Desktop](https://developers.wpengine.com/docs/ai/api/mcp/how-to/configure-claude-desktop/).

## Prerequisites

- **Claude Code** installed ([install guide](https://docs.claude.com/en/docs/claude-code/setup))
- **A WP Engine account** with at least one WordPress site connected to it (a [site connection](https://developers.wpengine.com/docs/ai/api/site-and-account-connections/#site-connection))
- **AI turned on for that account.** An account owner accepts the WP Engine AI terms and turns on AI in the WP Engine User Portal

## 1. Add the MCP server

Terminal window

```bash
claude mcp add --transport http --scope user wpengine \
  https://api.ai.wpengine.com/v1/mcp
```

This command registers the server and sets the HTTP transport. Don’t add an `Authorization` header. You authenticate with OAuth in the next step.

`--scope user` makes the server available in every directory. Without it, Claude Code registers the server only for the directory you ran the command in.

## 2. Sign in

1. Start a Claude Code session.
2. Run `/mcp`.
3. Select `wpengine`, then select **Authenticate**.
4. Sign in with your WP Engine account in the browser window that opens.

Claude Code stores the sign-in and renews it for you. If Claude Code asks you to sign in again, repeat these steps.

## 3. Confirm Claude Code can see your sites

Ask:

Terminal window

```bash
claude "Use the wpengine MCP server to list my WordPress sites"
```

Claude Code calls `list_accounts` to find your account, then calls `list_account_sites`. It returns your active registered sites, similar to this:

```text
You have 3 WordPress sites connected:
1. example.com (example-prod) - Active
2. staging.example.com (example-staging) - Active
3. dev.example.com (example-dev) - Active
```

> **See tool calls inline**
>
> Claude Code shows MCP tool calls inline in the conversation, including their requests and responses.

If no tools appear at all, see [Fix a client that shows no tools](https://developers.wpengine.com/docs/ai/api/mcp/troubleshooting/#fix-a-client-that-shows-no-tools).

## 4. Connect your WordPress account

With your current setup, you can list sites and search a knowledge base. **You can’t run an ability yet.** Running an ability needs a second, separate connection between you and each site.

Most people don’t expect this. Registering a site with WP Engine gives nobody permission to act on it, including the administrator who registered it. [The two connections](https://developers.wpengine.com/docs/ai/api/site-and-account-connections/) explains why.

Complete these steps once per site:

1. Ask Claude Code: “What’s the WordPress connection status for my sites?”

2. For each site that isn’t connected, Claude Code gives you a link. Open the link while you’re logged in to that site’s WordPress admin. If no link comes back, build it yourself:

   `{site_url}/wp-admin/admin.php?page=power-overview&action=trigger_wp_connection`

   Opening this link is the only way to start the connection. WordPress has no option to start it manually.

3. Review the permissions, then confirm with **Connect WordPress user**. You land back in wp-admin, now connected. See [The consent screen](https://developers.wpengine.com/docs/ai/api/site-and-account-connections/#connect-your-wordpress-account).

## 5. Run your first ability

Ask:

Terminal window

```bash
claude "Create a draft post on example.com titled 'Today in the news with WP Engine' using the wpengine MCP server"
```

Claude Code then does the following:

1. Finds the site’s **Create Post** ability (`wp-engine-ai/create-posts`) with `search_abilities`
2. Runs it with `run_site_ability`
3. Returns the new post ID and a link to the draft

![Screenshot: Claude creating a WordPress post via MCP](https://developers.wpengine.com/_astro/claude-creating-a-post.CsvBnQHQ_Z2lCU27.webp)

---

[Troubleshooting](https://developers.wpengine.com/docs/ai/api/mcp/troubleshooting/)Fixes by symptom, including a server your client can't see, the 'not personally connected' error, and what each error code means.

[Authentication](https://developers.wpengine.com/docs/ai/api/authentication/)How MCP clients authenticate with OAuth.

[Site and WordPress account connections](https://developers.wpengine.com/docs/ai/api/site-and-account-connections/)Why you still can't write to a registered site.

## Was this helpful?

Thanks for the feedback!

```json
{"@context":"https://schema.org","@graph":[{"@type":"WebSite","@id":"https://developers.wpengine.com/#website","name":"WP Engine Product Documentation","url":"https://developers.wpengine.com/","description":"Resources for developing, deploying, and scaling on WP Engine.","inLanguage":"en-US","keywords":["API documentation","product documentation","headless WordPress","managed WordPress hosting"],"publisher":{"@id":"https://wpengine.com/#organization"}}]}
```
