Polynomial World

AI & LLMs

How to Connect WordPress to an AI Agent with MCP

Polynomial World 9 min read

You can let an AI agent such as Claude draft and update WordPress posts through MCP, the Model Context Protocol. The setup has three parts: WordPress’s MCP Adapter on the site, a plugin that registers content abilities, and a client that connects with an Application Password. This guide follows a setup we run on one of our own sites, with placeholder names throughout.

Key facts (as of October 2026)

How do the pieces fit together?

There are four layers, and it helps to know which one does what before you install anything.

LayerWhat it does
Abilities API (WordPress core)A registry where plugins declare “units of functionality,” such as “create a post”
MCP AdapterTurns registered abilities into MCP tools and serves them at a REST endpoint
Abilities pluginRegisters the content abilities you actually want, such as posts, pages, and media
MCP clientClaude Desktop, Claude Code, or another agent that calls those tools

The Abilities API describes itself as “a standardized way to register and discover distinct units of functionality within a WordPress site” (Abilities API). The MCP Adapter is “the official WordPress package for MCP integration.” It bridges the Abilities API with the MCP specification (WordPress/mcp-adapter).

The adapter doesn’t create content features by itself. It only exposes what other plugins register. That turned out to be the most confusing part of our setup, so it gets its own section below.

What do you need?

  • WordPress 6.9 or later, served over HTTPS.
  • Administrator access to install plugins.
  • Node.js on the computer where your AI client runs, because the connection uses npx.
  • An MCP client. This guide uses Claude Desktop and Claude Code.

Step 1: Install the MCP Adapter

The MCP Adapter lives in the WordPress/mcp-adapter repository. The README covers installing it as a plugin or through Composer. Follow the method that fits your site.

Once it’s active, the adapter serves a default MCP server at:

https://your-site.com/wp-json/mcp/mcp-adapter-default-server

That server offers three tools: mcp-adapter/discover-abilities, mcp-adapter/get-ability-info, and mcp-adapter/execute-ability. Your agent uses the first to list what’s available, the second to read an ability’s inputs, and the third to run it.

Step 2: Add a plugin that registers abilities

Here is the lesson we learned the hard way. Right after installing the adapter, we asked the agent to list abilities. The only ones it found came from an image optimization plugin, Imagify, which already registered its own. There was nothing for posts or pages.

The reason is in the adapter’s design. Abilities stay private unless their registration sets meta.public or meta.mcp.public to true. The README calls this an “opt-in model” (WordPress/mcp-adapter). Only plugins that register public abilities show up.

To get content tools, we installed Enable Abilities for MCP from wordpress.org. According to its plugin page, it registers content management abilities, including:

  • Creating, updating, and deleting posts and pages
  • Uploading media from a URL and setting featured images
  • Creating and editing menus
  • SEO metadata for Rank Math, SEOPress, and Yoast SEO

The plugin lists WordPress 6.9 or later, PHP 8.0 or later, and the MCP Adapter (installed separately) as requirements. It adds a dashboard at Settings > WP Abilities with a toggle for each ability. Turn off anything you don’t plan to use. Fewer tools means fewer ways for an agent to make a mistake.

Step 3: Create a dedicated Editor user

Don’t connect the agent with your own administrator account. Create a separate user just for the agent.

  1. In the dashboard, go to Users and add a new user.
  2. Give it a clear name, such as ai-agent, and an email address you control.
  3. Set the role to Editor.

Why Editor? WordPress describes an Editor as “somebody who can publish and manage posts including the posts of other users” (Roles and Capabilities). Editors can publish posts and pages, upload files, and manage categories. They don’t have manage_options, activate_plugins, or edit_theme_options.

The abilities plugin respects this. Its page says “write abilities respect WordPress capabilities,” and gives the example that creating a post requires publish_posts (Enable Abilities for MCP).

In practice, our agent got “Permission denied” when it tried abilities that read site settings, list plugins, or edit menus. That is the behavior you want. The agent can write content, but it can’t change how the site works.

If you do want the agent to manage menus, you’d need a role with edit_theme_options. Think about that trade-off before granting it.

Step 4: Create an Application Password

Application Passwords arrived in WordPress 5.6. They are meant “to be used programmatically for applications, and not by humans for interactive sessions.” They are long, random, and can be revoked one at a time (Application Passwords integration guide).

  1. Log in as an administrator and open the agent user’s profile (Users > All Users, then Edit).
  2. Scroll to Application Passwords.
  3. Enter a name like Claude Desktop and click Add New Application Password.
  4. Copy the password now. WordPress shows it only once.

The password is displayed in groups separated by spaces. The guide notes that the spaces can be left out when you use it. Application Passwords require HTTPS by default.

Step 5: Build the Authorization header

The connection uses HTTP Basic authentication. The header value is the word Basic, a space, and the Base64 encoding of username:application-password.

On macOS or Linux:

printf '%s' 'ai-agent:abcdEFGH1234ijklMNOP6789' | base64

In PowerShell:

[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes('ai-agent:abcdEFGH1234ijklMNOP6789'))

Replace the example values with your own. The output is a long string. Treat it exactly like a password, because anyone can decode it back to your username and Application Password.

Step 6: Connect your MCP client with mcp-remote

Claude Desktop and Claude Code can start local MCP servers with npx. The mcp-remote package acts as a local bridge to a remote MCP endpoint and can send a custom header with the --header flag.

Claude Desktop

Open Settings > Developer in Claude Desktop and click Edit Config. The file is claude_desktop_config.json, stored at ~/Library/Application Support/Claude/ on macOS and %APPDATA%\Claude\ on Windows (MCP docs: Connect to local MCP servers).

Add a server entry:

{
  "mcpServers": {
    "wordpress": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://your-site.com/wp-json/mcp/mcp-adapter-default-server",
        "--header",
        "Authorization:${AUTH_HEADER}"
      ],
      "env": {
        "AUTH_HEADER": "Basic <your-base64-string>"
      }
    }
  }
}

Note the header argument has no space after the colon, and the value with its space sits in env. The mcp-remote README recommends this pattern because Claude Desktop on Windows, Cursor, and Codex CLI have a bug where “spaces inside args aren’t escaped” (mcp-remote README).

Save the file, quit Claude Desktop completely, and reopen it. The MCP docs say the app must restart to load a new configuration.

Claude Code

Claude Code reads project servers from a .mcp.json file at the project root, using the same mcpServers format (Claude Code docs: MCP). It also expands ${VAR} from your environment, which lets you keep the credential out of the file:

{
  "mcpServers": {
    "wordpress": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://your-site.com/wp-json/mcp/mcp-adapter-default-server",
        "--header",
        "Authorization:${WP_AUTH_HEADER}"
      ]
    }
  }
}

Set WP_AUTH_HEADER to Basic <your-base64-string> in your shell before starting Claude Code. The Claude Code docs note that .mcp.json is meant to be checked into version control and shared, and that private credentials belong in local scope or environment variables instead. Claude Code also asks you to approve project servers before it uses them.

Test the connection

Ask the agent to list the available WordPress abilities. It should call discover-abilities and return a list. Then ask for something harmless, such as creating a draft post titled “MCP test.” Check that the draft appears in Posts, then delete it.

The plugin page also mentions a built-in OAuth 2.1 option for claude.ai custom connectors. We haven’t used it, so this guide covers only the Application Password route.

What can go wrong?

”Permission denied” on some abilities

This usually means the role is doing its job. Settings, plugin lists, and menus need capabilities that Editors don’t have. Decide whether the agent really needs them before you upgrade the role.

The agent sees almost no abilities

The adapter only lists public abilities that plugins register. If the list is short, check that your abilities plugin is active and that the toggles in its dashboard are on.

HTML disappears from some fields

On our site, post content kept its HTML when the agent saved it. Category descriptions did not. Their HTML was stripped on save, leaving plain text. We haven’t confirmed the cause, and it may depend on your setup and other plugins. If you rely on formatted term descriptions, check them in the dashboard after the agent saves.

You can’t choose a page’s URL slug

In the version we used, the page creation ability had no slug parameter, so WordPress built the slug from the title. If the URL matters, give the agent the exact title you want in the slug, or fix the slug by hand afterward. Check the ability’s inputs with get-ability-info, since plugins change over time.

The Base64 string leaked

If you paste the header into a chat, a ticket, or a shared file, assume it’s compromised. Base64 is encoding, not encryption. Revoke that Application Password from the user’s profile, create a new one, and update your config. Never paste the credential into a conversation with the agent itself, because chat logs are stored.

Claude Desktop on Windows can’t start the server

Check the space issue described above first. Then look at the logs in %APPDATA%\Claude\logs. The MCP docs say mcp.log covers connection failures, and mcp-server-SERVERNAME.log holds each server’s error output (MCP docs).

Checklist

  • WordPress 6.9 or later, on HTTPS
  • MCP Adapter installed and active
  • An abilities plugin installed, with unneeded abilities switched off
  • A dedicated user with the Editor role
  • An Application Password created for that user and copied once
  • Credential kept in env or an environment variable, not in a shared file or chat
  • Connection tested with a throwaway draft post
  • A plan to revoke and rotate the Application Password if it leaks

Once it works, start small. Let the agent create drafts, and keep publishing as a human step until you trust the output.

Related articles

AI & LLMs

How to Connect Claude to Google Ads with MCP

Set up Google's official Google Ads MCP server in Claude Desktop: Cloud project, API access level, credentials, config file, and safe, read-only use.

9 min read