---
title: Claude Code to WordPress: The Easy 5 Minute Setup (Best Way)
url: https://handymcp.com/connect-claude-code-to-wordpress/
description: Connect Claude Code to WordPress in 5 minutes with one command and a free MCP server. Token or OAuth setup, safe habits, prompts and fixes for common errors.
---

[Home](https://handymcp.com/)[Blog](https://handymcp.com/blog/)[Guides](https://handymcp.com/category/guides/)

# Connect Claude Code to WordPress in 5 Minutes

By HandyMCP October 11, 2026 Updated Oct 2026 12 min read

![Connect Claude Code to WordPress in 5 Minutes](https://handymcp.com/wp-content/uploads/2026/10/connect-claude-code-to-wordpress-featured-1024x538.webp)

On this page

1. What you get when you connect Claude Code to WordPress
2. Why use Claude Code with WordPress
3. What you need
4. Step 1: Install HandyMCP and copy the URL
5. Step 2: Choose token or OAuth
6. Step 3: Add the server to Claude Code
7. Step 4: Check the connection
8. Prompts to try
9. A real workflow: theme work with live data
10. Claude Code and staging sites
11. Token tips that save headaches
12. What Claude Code cannot do with the free plugin
13. Good prompts for developers
14. How this compares with WP-CLI
15. Keeping secrets out of the conversation
16. Free vs Pro for Claude Code users
17. Safety habits for terminal sessions
18. Common mistakes
19. Troubleshooting
20. Frequently asked questions

Claude Code is great at working through a codebase from the terminal. When that codebase is a WordPress theme or plugin, though, half the picture lives on the site itself: the pages, the blocks in use, the settings and the products. Without a connection, Claude Code is guessing about all of that.

This guide shows you how to connect Claude Code to WordPress with MCP in about five minutes. It covers token and OAuth setups, user and project scope, useful prompts, safety habits and fixes for the errors people hit most.

**Quick answer:**  Install HandyMCP on your site, create an access token under HandyMCP > Connection, then run `claude mcp add --transport http wordpress YOUR_URL --header "Authorization: Bearer YOUR_TOKEN"`. Start Claude Code and type `/mcp` to confirm it is connected. If you prefer OAuth, leave out the header and authenticate from `/mcp` instead.

## What you get when you connect Claude Code to WordPress

MCP (Model Context Protocol) is an open standard that lets AI apps call outside tools. HandyMCP is a WordPress plugin that turns your site into an MCP server. Once Claude Code is connected, it can call tools like list posts, update page, read an Elementor layout, edit a product or purge the cache.

HandyMCP runs on your own site. There is no relay, no vendor account and no usage fee or limits. Claude Code connects to your site directly. For background, read [what MCP is in WordPress](/what-is-mcp-wordpress/).

## Why use Claude Code with WordPress

- **Code and content together.**  Build a block pattern in your theme, then ask Claude Code to add it to a draft page.
- **Real data while you debug.**  It can read the actual page, post meta or product data instead of assuming.
- **Docs and release notes.**  Turn a markdown file in your repo into a draft post.
- **Site checks.**  Ask which plugins are active, which theme is running or what a page is built with.

## What you need

- WordPress 6.2 or newer, PHP 7.4 or newer, and HTTPS.
- An administrator account on the site.
- Claude Code installed and signed in.
- The free HandyMCP plugin. See [install steps](/docs/#install).

## Step 1: Install HandyMCP and copy the URL

Activate the plugin in **Plugins > Add New** . Then open **HandyMCP > Connection**  and copy the server URL:

```
https://your-site.com/wp-json/handymcp/v1/mcp
```

![HandyMCP connection screen with the MCP server URL and access tokens for Claude Code](https://handymcp.com/wp-content/uploads/2026/10/handymcp-connect-claude-chatgpt-to-wordpress-mcp-server.webp)
Copy the server URL and create a token on the Connection screen.

## Step 2: Choose token or OAuth

| Method | How it works | Best for |
| --- | --- | --- |
| Personal access token | Created on the Connection screen, sent as a Bearer header. Stored hashed, shown once, can be paused or revoked. | One developer, scripts, quick setup |
| OAuth 2.1 with PKCE | You sign in on your own site in the browser and pick scopes. | Teams where each person signs in as themselves |

### Create a token

1. On the Connection screen open **Access tokens** .
2. Create a token named something like “Claude Code on my laptop”.
3. Choose its permissions. Start narrow.
4. Copy it now. You will not see it again.

## Step 3: Add the server to Claude Code

### With a token

```
claude mcp add --transport http wordpress https://your-site.com/wp-json/handymcp/v1/mcp \
  --header "Authorization: Bearer YOUR_TOKEN"
```

### With OAuth

```
claude mcp add --transport http wordpress https://your-site.com/wp-json/handymcp/v1/mcp
```

Then start Claude Code, type `/mcp`, pick the wordpress server and choose to authenticate. Your site’s consent page opens in the browser. Sign in, pick scopes (read only, edit content, manage the store, manage the site) and approve.

### Pick a scope

- **Default (local):**  available in the current project on your machine.
- **`--scope user`:**  available in every project on your machine.
- **`--scope project`:**  written to a `.mcp.json` file in the repo, so your team gets it too.

Never commit a `.mcp.json` that contains a real token. For shared project config, use OAuth so each teammate signs in.

### Connect several sites

Give each server its own name:

```
claude mcp add --transport http shop-staging https://staging.your-shop.com/wp-json/handymcp/v1/mcp \
  --header "Authorization: Bearer STAGING_TOKEN"

claude mcp add --transport http shop-live https://your-shop.com/wp-json/handymcp/v1/mcp \
  --header "Authorization: Bearer LIVE_TOKEN"
```

## Step 4: Check the connection

Start Claude Code and type `/mcp`. The wordpress server should show as connected with a list of tools. You can also run the connection check on HandyMCP’s Connection screen. Claude Code’s commands and flags can change between versions, so check `claude mcp --help` if something looks different.

## Prompts to try

Start read only:

- “Which theme and plugins are active on my WordPress site?”
- “List the ten most recent posts with their categories and status.”
- “Read the Elementor layout of the home page and tell me which widgets it uses.”

Then combine code and content:

- “Create a draft post from docs/release-notes.md. Do not publish it.”
- “Compare the block styles in this theme with what is used on the live home page.”
- “Find pages with no meta description and write one for each. Show me the list first.”
- “After that change, purge the site cache.”

More examples on the [prompts page](/prompts/) and in [Claude prompts for WordPress](/claude-prompts-for-wordpress/).

## A real workflow: theme work with live data

Here is how a typical session looks once the connection works. Say you are building a new testimonials block for your theme.

1. **Look at what is there.**  “Read the home page and list every block and pattern it uses.” Claude reads the live page, so it knows which patterns are actually in use instead of guessing from the theme folder.
2. **Write the code.**  Claude works in your repo as usual: block.json, the render template and the styles.
3. **Try it on a draft.**  “Create a draft copy of the home page and swap the old testimonials section for the new block.” The live page is not touched.
4. **Fill it with real content.**  “Use the five most recent reviews from the Testimonials category.” Claude pulls them from the site.
5. **Review and publish.**  You check the draft in the browser, and publish when you are happy.

The same pattern works for WooCommerce templates, Elementor widgets and plugin settings screens: code in the repo, real data from the site, and drafts in between.

## Claude Code and staging sites

If you have a staging copy, connect it as its own server, as shown above with `shop-staging` and `shop-live`. A few tips make this work smoothly:

- **Name servers by environment,**  never just “wordpress”, once you have more than one.
- **Use a read-only token for live**  while you develop, and a full token for staging.
- **Tell Claude which one to use**  at the start of a session: “Work on shop-staging only.”
- **Check the Activity log on both sites**  after a long session, to confirm nothing went to the wrong place.

Many hosts block outside requests to staging sites with a password or IP rule. If Claude cannot reach staging, allow the HandyMCP paths there too, or use your host’s staging access settings.

![Create an access token for Claude Code with scopes and an expiry date](https://handymcp.com/wp-content/uploads/2026/10/create-a-handymcp-access-token-v103.webp)
Give each token a clear name, the smallest scopes it needs and an expiry date.

## Token tips that save headaches

- **One token per machine.**  If a laptop is lost, revoke just that one.
- **Set an expiry**  for tokens you only need for a project.
- **Keep tokens out of shell history**  by putting them in an environment variable and referring to it in the command.
- **Pause instead of deleting**  when you want to stop access for a while. You can resume later without changing your config.

The official [Claude Code MCP documentation](https://docs.anthropic.com/en/docs/claude-code/mcp) explains every option of the `claude mcp` command if you want to go further, for example importing servers from Claude Desktop or listing what is configured.

## What Claude Code cannot do with the free plugin

None of these limits apply to reading. Every plan can read pages, posts, products, menus, settings and builder layouts, which is what most debugging sessions need. Writing is where the free and Pro plans differ, and where the safety checks matter most.

It helps to know the limits before you plan a session. With the free plugin, Claude Code cannot edit PHP, CSS or JavaScript files on the server, install or update plugins, or change themes. It also cannot run SQL or arbitrary PHP, on free or Pro, by design.

For most theme work that is fine, because you edit files in your repo and deploy them your usual way. If you want Claude Code to edit files on a live or staging server directly, Pro adds file editing with a syntax check, a backup and an automatic revert if the site breaks.

## Good prompts for developers

Terminal sessions go best when the request is specific about where to work and what to leave alone. These patterns work well:

- **Name the environment.**  “On shop-staging, list every page that uses the old hero pattern.”
- **Ask for a plan first.**  “Before changing anything, tell me which pages and products you will touch.”
- **Limit the blast radius.**  “Only change posts in the Release Notes category.”
- **Ask for a summary at the end.**  “List every change you made with a link to each page.”

The assistant can also chain site work with repo work in one request, for example: “Read the product attributes on the live store, then update the attribute filter in our theme to match.” Reading first and changing second keeps mistakes small.

If a request touches many pages, ask for the list before any change and approve it in chat. It takes a few seconds and means you always know exactly what is about to happen on the site.

## How this compares with WP-CLI

If you already use WP-CLI, you may wonder why you would add MCP at all. They do different jobs and work well together.

| - | WP-CLI | MCP with HandyMCP |
| --- | --- | --- |
| Needs | SSH access to the server | Only an HTTPS URL and a token |
| Best at | Bulk admin tasks, scripts, database work | Content, page builders, store data, safe edits |
| Page builders | Raw meta only | Real Elementor and Gutenberg editing |
| Undo | None built in | Every change saved first, one-click undo |
| Permissions | Full server access | Scoped to a WordPress role and chosen tools |

Many hosts do not offer SSH on cheaper plans, and agencies often do not have it for client sites. An HTTPS connection with a scoped token works everywhere WordPress does.

## Keeping secrets out of the conversation

HandyMCP never returns passwords, API keys, payment gateway keys or salts, even to an administrator. Customer emails and phone numbers in orders and form entries are masked unless you ask for them on purpose. That means a long terminal session, or a transcript you share with a colleague, does not leak secrets from the site.

Site content is also treated as data, not instructions. If a post or a product description contains text that looks like a command, the assistant is told to ignore it, which protects you from content someone else wrote.

## Free vs Pro for Claude Code users

Free covers posts, pages, menus, media, Gutenberg, Elementor editing, SEO fields, categories and tags, WooCommerce basics, form editing, Activity log, undo for the last 20 changes, site info and cache purge.

Pro adds the tools developers reach for in a terminal session:

- File editing with a PHP syntax check, backup, live test and automatic revert.
- Plugin and theme installs and updates with zip backup, health checks and automatic restore on error.
- Search and replace, redirects, SEO audits, custom fields and other page builders.
- Full undo history.

See [pricing](/#pricing).

## Safety habits for terminal sessions

Claude Code can work for a long time and make many changes. A few habits keep that safe:

- **Use staging**  when Claude Code edits code and site content in the same session.
- **Give the token the smallest permissions**  that do the job. Use read only mode under **HandyMCP > Abilities**  for audits.
- **Ask for drafts.**  HandyMCP turns “redesign” or “new version” into a draft copy. Published pages are only replaced when clearly asked.
- **Read confirmations.**  Destructive tools need explicit confirmation, and bulk WooCommerce changes over 10 products ask first.
- **Check Activity**  after long sessions.

![HandyMCP activity log showing Claude Code requests to a WordPress site](https://handymcp.com/wp-content/uploads/2026/10/handymcp-ai-activity-log-wordpress.webp)
The Activity log shows every request, the app, the tool and the page touched.

HandyMCP also refuses to overwrite newer edits, never returns API keys or payment gateway keys, has no raw SQL or arbitrary PHP tool, and treats site content as data, not instructions. If something goes wrong, see [how to undo AI changes](/undo-ai-changes-wordpress/).

## Common mistakes

- Using the site homepage URL instead of the full `/wp-json/handymcp/v1/mcp` URL.
- Forgetting the word `Bearer` and the space before the token.
- Committing a project `.mcp.json` with a token in it.
- Connecting live when you meant staging. Name servers clearly.
- Leaving old tokens active. Revoke them on the Connection screen.

## Troubleshooting

### /mcp shows the server as failed

Check the URL, the token and that the site is reachable over HTTPS. A firewall or security plugin blocking the REST API is the most common cause. Allow `/wp-json/handymcp/`.

### Unauthorised errors

The token is wrong, paused or revoked, or the header is malformed. Remove the server with `claude mcp remove wordpress`, create a new token and add it again.

### OAuth window does not open or fails

Caching or security plugins can interfere with the consent page. Exclude it from caching and try again from `/mcp`.

### Connected but some tools are missing

Those tool groups may be switched off under Abilities, outside the approved scope or not allowed by your WordPress role.

See the [troubleshooting docs](/docs/troubleshooting/) and [WordPress MCP connection fixes](/wordpress-mcp-not-connecting-fixes/).

## Frequently asked questions

### Does Claude Code support remote MCP servers?

Yes. Claude Code connects to MCP servers over HTTP, with a header token or OAuth.

### Where does Claude Code store the server settings?

Local and user scope settings live in your Claude Code config. Project scope uses a `.mcp.json` file in the repository.

### Can I use the same site with Claude Code and the Claude app?

Yes. Each connection shows up separately on the Connection screen, so you can pause or revoke one without touching the other.

### Can Claude Code edit my theme files on the server?

With HandyMCP Pro, yes. Edits are syntax checked, backed up, tested on the live site and reverted automatically if anything breaks.

### Is a token or OAuth more secure?

Both are safe when scoped well. OAuth is better for teams because each person signs in as themselves. Tokens are simple for one developer and easy to revoke.

### Can I use it with a local WordPress site?

Yes, as long as the terminal can reach the site. Local sites from tools like LocalWP or DDEV usually run on a local address, which works with a token. OAuth needs a browser that can open the site’s login page, which also works locally.

### What happens if the token leaks?

Revoke it on the Connection screen and it stops working at once. Then check the Activity log to see what, if anything, was done with it, and undo those changes from Undo history.

### Can I limit the assistant to read only for a whole session?

Yes. Create a token with only the read scope, or switch the connection to read only mode under Abilities. Every write tool is then refused, whatever you ask for.

### Does it cost anything?

The free version of HandyMCP has no usage fees or limits. Pro is a paid plan for extra tools.

More setups: [Claude app](/connect-claude-to-wordpress-mcp/), [ChatGPT](/connect-chatgpt-to-wordpress-mcp/) and [Cursor](/connect-cursor-to-wordpress-mcp/). Or [install HandyMCP free](/docs/#install) and start now.

Share this article

Written by the HandyMCP team

We build HandyMCP, the WordPress MCP server that lets Claude, ChatGPT and other AI apps manage your site with permissions and one-click undo.

 [Read the setup guide](https://handymcp.com/docs/)

On this page

12 min read

1. What you get when you connect Claude Code to WordPress
2. Why use Claude Code with WordPress
3. What you need
4. Step 1: Install HandyMCP and copy the URL
5. Step 2: Choose token or OAuth
6. Step 3: Add the server to Claude Code
7. Step 4: Check the connection
8. Prompts to try
9. A real workflow: theme work with live data
10. Claude Code and staging sites
11. Token tips that save headaches
12. What Claude Code cannot do with the free plugin
13. Good prompts for developers
14. How this compares with WP-CLI
15. Keeping secrets out of the conversation
16. Free vs Pro for Claude Code users
17. Safety habits for terminal sessions
18. Common mistakes
19. Troubleshooting
20. Frequently asked questions

Let AI do this for you

Connect Claude or ChatGPT to WordPress and just ask. Every change is logged and site edits can be undone.

 [Get HandyMCP Pro](https://handymcp.com/#pricing)

Keep reading

## More from the *blog.*

[All articles](https://handymcp.com/blog/)

Guides Nov 5, 2026

### [WordPress MCP Adapter vs Plugins vs Hosted Relays: Which to Use](https://handymcp.com/wordpress-mcp-adapter-vs-plugins-vs-relays/)

There are three ways to connect AI apps to WordPress over MCP: the official MCP Adapter,…

Guides Nov 3, 2026

### [How Agencies Can Use AI Across Client WordPress Sites](https://handymcp.com/ai-for-wordpress-agencies/)

How WordPress agencies can use Claude and ChatGPT across many client sites: one AI connection, client…

Guides Oct 31, 2026

### [How to Find and Remove Malware in WordPress with AI](https://handymcp.com/find-remove-malware-wordpress-with-ai/)

Use Claude or ChatGPT with an MCP server to scan WordPress files and the database for…


<!-- Page uncached by LiteSpeed Cache 7.9.4 on 2026-11-27 03:14:34 -->