Skip to content

Connect Claude Code to WordPress with MCP

Connect Claude Code to EMCP to inspect WordPress content and work with your enabled integrations from the terminal. The server runs on your WordPress installation; tool results return to Claude Code.

  • Install EMCP and confirm the WordPress and PHP requirements.
  • For remote connections, use your site’s complete server URL from EMCP Tools → Connection. OAuth requires HTTPS and an administrator to approve access.
  • Keep sensitive writes disabled while verifying the connection. Tool availability depends on your tier, installed integrations and WordPress permissions.

Claude Code is Anthropic’s terminal-based AI coding agent. It supports MCP servers via the .mcp.json file in your project root.

EMCP Tools → Connection builds the exact command or config for your site in four steps:

  1. Choose your AI client: pick Claude Code.
  2. Pick how it signs in: OAuth (recommended), Application password, or, on a local or development site, WP-CLI on this computer.
  3. Add EMCP to Claude Code: copy the command or config it shows (details for each method below), then click I’ve added it, continue.
  4. Test the connection: the screen waits for Claude Code’s first MCP call and shows “Claude Code is connected” with the first tool and its time. If nothing arrives within a few minutes it shows “No call yet” with tips and a Run a server test button. A setup lasts 30 minutes; after that, click Start again.

The wizard names the server after your site (for example emcp-your-site-com); the examples on this page use emcp-tools. Every part of the screen is described in Connection screen.

Add the server with a single command, no credentials to generate. This is the command the wizard shows under “Run this in your terminal” when you pick OAuth:

Terminal window
claude mcp add emcp-tools --transport http https://your-site.test/wp-json/mcp/emcp-tools-server

The first time Claude Code connects, your browser opens so you can approve the connection from your WordPress login. Approve once and you’re done, run claude mcp list to confirm it’s connected.

Requires an HTTPS site with OAuth sign-in on (EMCP Tools → Connection → Advanced settings, on by default on HTTPS). Only administrators can approve. Sign the app out or remove it any time under EMCP Tools → Connection → Connected apps.

The VS Code Claude Code extension shares this config and its OAuth token, so adding it here also connects it there.

Create or edit .mcp.json in the root of whichever project you want to expose EMCP Tools to:

{
"mcpServers": {
"emcp-tools": {
"type": "http",
"url": "https://your-site.test/wp-json/mcp/emcp-tools-server",
"headers": {
"Authorization": "Basic BASE64_ENCODED_CREDENTIALS"
}
}
}
}

Replace:

  • https://your-site.test → your WordPress site URL.

  • BASE64_ENCODED_CREDENTIALS → base64 of username:application-password. Generate one at Users → Profile → Application Passwords, then encode:

    Terminal window
    echo -n "admin:xxxx xxxx xxxx xxxx xxxx xxxx" | base64

After saving, restart Claude Code. Run claude mcp list to verify: emcp-tools should show as connected.

The EMCP Tools → Connection screen fills this in for you: choose Claude Code, then Application password, then click Create password in step 3 (the password is shown once and the configs below it already contain it), or open Use a password I already have. Step 3 then shows a claude mcp add --transport http … --header "Authorization: Basic …" terminal command plus two configs: a Node proxy (npx) and direct HTTP.

Section titled “stdio via WP-CLI (recommended for local dev)”

If your WordPress install is on the same machine as Claude Code and you have WP-CLI available, this is faster, no HTTP round-trip, no auth needed.

On a site whose environment type is local or development, the Connection wizard offers WP-CLI on this computer in step 2. Step 3 then shows a ready-made command:

Terminal window
claude mcp add emcp-your-site-com --env EMCP_SETUP=<setup token> -- wp mcp-adapter serve --server=emcp-tools-server --user=admin --path=/absolute/path/to/wordpress

EMCP_SETUP only lets step 4 recognise the first call; it stops working once the setup finishes, and leaving it in the config is harmless. The wp part comes from the WP-CLI command field under EMCP Tools → Connection → 3rd-party services, so set that first if WP-CLI is not on your PATH. The equivalent .mcp.json entry, without the setup token:

{
"mcpServers": {
"emcp-tools": {
"type": "stdio",
"command": "wp",
"args": [
"mcp-adapter",
"serve",
"--server=emcp-tools-server",
"--user=admin",
"--path=/absolute/path/to/wordpress"
]
}
}
}

The wp mcp-adapter serve command is provided by the WordPress MCP Adapter plugin’s WP-CLI bridge. Verify it exists:

Terminal window
wp mcp-adapter list --path=/absolute/path/to/wordpress

Should print emcp-tools-server as a registered server.

  • “No MCP servers configured.” Restart Claude Code after editing .mcp.json.
  • Step 4 of the wizard says “No call yet.” Restart Claude Code, check the URL is reachable from your computer, then click Run a server test: for an application password it runs a full MCP handshake, for OAuth it checks discovery. Some hosts strip the Authorization header, and the test shows that.
  • “Connection failed.” Test the URL directly with curl, see the requirements check.
  • “No tools available” but connection succeeded. See No tools appearing.
  • “Tool limit exceeded.” Claude Code has no hard cap, but if you’re hitting context-window pressure, flip on Compact tool mode to collapse the surface to 3 dispatcher tools.

List the WordPress pages I can access. Show their titles, IDs and publication status. Do not create, update or delete anything.

A successful connection should return records from your own site, not a proposed page list. If the tool is unavailable, check the Tools screen and the connected user’s permissions. If you use compact mode, ask the assistant to discover the page-listing tool first.

Once that works, choose an Elementor workflow or a WooCommerce workflow, check its requirements, and enable only the writes needed for the task. Use a draft or test item and inspect the result before publishing.

For a complete Elementor example, follow Build your first Elementor page: a concrete brief, one saved draft, desktop/mobile review and a targeted revision.