↳ Notes

How to let AI write WordPress posts – safely, via MCP and the Abilities API

Maybe you’re tempted too – to let an AI assistant (I’ve been playing with Claude Code) prepare posts right inside WordPress – but you don’t want to hand it the whole REST API and an administrator account just for that. When I was setting this up on my own site hilgert.cz, I was looking for a way to let the AI reach only a handful of specific, supervised actions, rather than handing over the keys to the whole house. And it turns out it’s doable. Let’s walk through what you need, what to set up where and – above all – why it makes sense this way, and I’ll show you a path that skips writing code entirely.

What are we putting together?

The whole thing rests on three pieces, each with a single role:

  • Abilities API – a registry of the site’s “abilities”. Each ability is a named action, e.g. create-post, with clearly defined inputs and a permission check.
  • MCP Adapter – a plugin that exposes those abilities to the outside over the MCP protocol, so the AI client can reach them.
  • MCP client – here Claude Code, but any tool that speaks MCP will do.

For this you’ll need WordPress 6.9+, one Application Password and a moment to set things up. Let’s take it step by step.

Do you need to install anything? (Abilities API)

Good news: if you’re on WordPress 6.9 or newer, the Abilities API is built right into core and you don’t need to install anything. In short, it’s a registry of actions – instead of letting the AI loose on “arbitrary SQL”, you define precisely bounded abilities where you keep control over who can do what with them.

Where do I get the MCP Adapter?

The MCP Adapter is an official plugin, but watch out – you won’t find it in the plugin directory on WordPress.org, so you can’t just search for it in the admin. It lives on GitHub in the WordPress/mcp-adapter repository. The easiest way is to download the latest mcp-adapter.zip from the Releases section and upload it in the admin via Plugins → Add New → Upload Plugin – just like any other plugin from a ZIP. After activation it exposes the abilities as MCP tools at an address like https://yoursite.com/wp-json/mcp/mcp-adapter-default-server. That gives you the bridge between WordPress and MCP – it just has nothing to offer yet.

How to add actions without writing a line of code?

The adapter itself can’t perform any actions – it only exposes what’s registered through the Abilities API. So you need something that registers the abilities for working with posts. And here’s the good news: you may well get by without any code at all.

The Enable Abilities for MCP plugin from the official directory adds dozens of ready-made abilities right away – managing posts, pages, comments and media, but also things like WooCommerce or SEO (Yoast, Rank Math, SEOPress). In its admin you then use toggles to enable exactly what you want to expose to the AI and leave the rest off. For most people this is a perfectly good start.

If you want actions tailored exactly to your needs, you write your own mini-plugin and register the abilities via wp_register_ability() on the wp_abilities_api_init hook. That’s the path I eventually took, because I mainly wanted to keep a close eye on what each action is allowed to do – for every ability you set your own permission_callback, i.e. exactly who can do what with it.

I’ve published my whole mini-plugin (just a few abilities for working with posts) as a public gist on GitHub – feel free to take it as a starting point and trim or extend it as you need:

Important. Registered abilities are not visible to MCP automatically. For the AI to see them at all, they must carry the mcp.public = true flag in their metadata. It’s a whitelist, not a blacklist – whatever you don’t explicitly allow stays hidden. Personally, I sleep a good deal better that way.

How does the client log in to the site?

The MCP client logs in to the site via an Application Password, which is a standard part of WordPress. You generate it in Users → Your Profile → Application Passwords: enter a name (e.g. “MCP client”), WordPress creates a password and shows it to you only once – so copy it right away. A tip from practice: don’t use the admin account for this – rather create a separate user for the AI with a limited role. If something goes sideways, it won’t reach across the whole site.

How to connect the MCP client?

In Claude Code (and similar tools) MCP servers are configured in a .mcp.json file. We add the HTTP transport, the address from the previous step and Basic auth with our Application Password (the username and password encoded in Base64):

{
  "mcpServers": {
    "wordpress": {
      "type": "http",
      "url": "https://yoursite.com/wp-json/mcp/mcp-adapter-default-server",
      "headers": {
        "Authorization": "Basic BASE64_USER_COLON_PASSWORD"
      }
    }
  }
}

The string after Basic isn’t the password by itself – it’s the username and password joined by a colon and encoded in Base64, i.e. username:password. So if the user is called mcp-editor and their application password is abcd EFGH ijkl MNOP, you encode exactly this text – including the spaces in the password:

mcp-editor:abcd EFGH ijkl MNOP

That produces the Base64 form you put after Basic :

bWNwLWVkaXRvcjphYmNkIEVGR0ggaWprbCBNTk9Q

You can encode it in several ways – most safely locally, so the password never leaves your computer:

  • In the terminal (Linux/macOS): printf '%s' 'mcp-editor:abcd EFGH ijkl MNOP' | base64. Use printf (or echo -n) – otherwise an invisible line break gets appended and the login fails.
  • In the browser console (F12 → Console): btoa('mcp-editor:abcd EFGH ijkl MNOP').

Based on type: http and url the client finds the server and authenticates with the Authorization header. Important. Above all, make sure your .mcp.json with the password doesn’t leak anywhere – for example into a public git repository. Go ahead and add it to .gitignore right away.

One more prerequisite for that address: the form with /wp-json/ only works if you have pretty permalinks enabled. On the default plain permalinks the endpoint returns a 404, so reach for the form https://yoursite.com/?rest_route=/mcp/mcp-adapter-default-server.

And does it work?

Once connected, the client should see tools like discover-abilities, get-ability-info and execute-ability. Then you just type something like “list the latest posts”, “create a draft article about X” or “check my posts for grammar and typos” and it happens. Just be careful – anything the AI runs this way happens on the live site, so until you’re confident, better play on a local or staging environment. By the way – I created this very post in WordPress exactly like this, as a draft via MCP:)

Conclusion

The whole trick is that the AI doesn’t get broad access to the site, but only a narrow, supervised door – exactly the one it needs right now, and not one key more. And if ordinary post management is all you’re after, you may well get by without any code and make do with the Enable Abilities for MCP plugin. When you want something extra, tailored to you, you add your own ability. This little toy made me happy – and hopefully it’ll be useful to you too:)

Where to read more: a nice introduction to this whole new thing can be found on the WordPress Developer Blog, with the code and documentation in the WordPress/mcp-adapter repo.

↳ Note written by

Need to tweak your website?

I'm not a fan of dozens of plugins that slow a website down. Wherever I can, I solve it with clean code - without unnecessary extra weight.

Discuss a website edit