ASHISH KANAJARIYA0%Preparing your experience
Skip to content

WordPress Abilities API and MCP Adapter: How to Connect AI Agents to Your Site

White humanoid robot representing AI agents working with WordPress

AI assistants have become part of everyday WordPress work. We use them to draft content, debug code and plan site structures. Until recently, though, connecting an AI agent directly to a WordPress site meant building a custom integration for every tool. The WordPress Abilities API, together with the official MCP Adapter, changes that. It gives WordPress a standard, permission-aware way to describe what a site can do, so any compatible AI client can discover and use those features safely.

In this guide I explain what the Abilities API is, how the Model Context Protocol (MCP) fits in, how to register your own abilities with real code, and how to connect an AI client to your site step by step. I also share the security practices I follow on every site where an AI agent gets access. Whether you are a site owner, a freelancer or a plugin developer, this is one of the most important developments in the WordPress ecosystem right now.

What Is the WordPress Abilities API?

The Abilities API arrived in WordPress 6.9 as part of the AI Building Blocks for WordPress initiative. An ability is a self-contained unit of functionality with a clear name, a human-readable description, defined inputs and outputs, a permission check and the logic that runs when it is executed.

Think of an ability as a well-labelled button that software can press. “Get the number of published posts.” “Update the SEO title of a post.” “List orders from the last seven days.” Each of these can be registered once, in one central registry, and then used from PHP, from the REST API, and from AI tools through the MCP Adapter.

Before the Abilities API, this kind of functionality lived in many different places: custom AJAX handlers, plugin-specific REST routes, admin screens and WP-CLI commands. All of these still work and remain useful. The difference is that abilities are discoverable. A client can ask the site “What can you do?” and receive a structured list with descriptions and JSON schemas, which is exactly what an AI agent needs to choose the right action.

Why a standard registry matters

  • Consistency: every ability follows the same shape, so tools do not need to learn each plugin individually.
  • Validation: inputs and outputs are described with JSON Schema, so bad requests are rejected before any code runs.
  • Permissions: each ability carries its own permission callback that uses normal WordPress capabilities.
  • Reuse: the same ability can power an admin button, a REST call, a WP-CLI workflow and an AI agent.

Core Concepts: Abilities, Categories and Schemas

The Abilities API is built around a small set of concepts. Once you understand them, the code becomes easy to read.

1. Ability names

Every ability has a namespaced name in the form namespace/ability-name, for example my-plugin/get-post-count. The namespace is usually your plugin or theme slug, which keeps names unique across the ecosystem.

2. Categories

Each ability must belong to a category, such as “content management” or “site information”. Categories are registered first, on the wp_abilities_api_categories_init hook. They make large lists of abilities easier to browse and filter, both for people and for AI clients.

3. Input and output schemas

Schemas describe what an ability accepts and what it returns. A well-written schema is the single most helpful thing you can give an AI agent, because the agent reads the property names, types and descriptions to decide how to call your ability correctly.

4. Permission and execute callbacks

The permission_callback decides whether the current user may run the ability, typically with current_user_can(). The execute_callback does the actual work and returns data that matches the output schema.

5. Hooks you should know

  • wp_abilities_api_categories_init: register ability categories here.
  • wp_abilities_api_init: register abilities here. Registering outside this hook triggers a “doing it wrong” notice and fails.
  • wp_before_execute_ability and wp_after_execute_ability: run code before or after any ability executes, which is perfect for logging.
Laptop screen showing PHP code for registering a WordPress ability
Abilities are registered in plain PHP. Photo by Arnold Francisca on Unsplash.

How to Register Your First Ability (Code Example)

Here is a complete, working example that registers a category and a read-only ability that returns the number of published items for a post type. You can place it in a small custom plugin or a site-specific functionality plugin.

<?php
/**
 * Plugin Name: My Site Abilities
 */

add_action( 'wp_abilities_api_categories_init', function () {
    wp_register_ability_category( 'site-content', array(
        'label'       => __( 'Site Content', 'my-site' ),
        'description' => __( 'Abilities that read or manage site content.', 'my-site' ),
    ) );
} );

add_action( 'wp_abilities_api_init', function () {
    wp_register_ability( 'my-site/get-post-count', array(
        'label'        => __( 'Get Post Count', 'my-site' ),
        'description'  => __( 'Returns the number of published items for a post type.', 'my-site' ),
        'category'     => 'site-content',
        'input_schema' => array(
            'type'       => 'object',
            'properties' => array(
                'post_type' => array(
                    'type'        => 'string',
                    'description' => 'Post type slug, for example post or page.',
                    'default'     => 'post',
                ),
            ),
        ),
        'output_schema' => array(
            'type'       => 'object',
            'properties' => array(
                'count' => array( 'type' => 'integer' ),
            ),
        ),
        'execute_callback' => function ( $input ) {
            $type  = sanitize_key( $input['post_type'] ?? 'post' );
            $count = wp_count_posts( $type );
            return array( 'count' => (int) ( $count->publish ?? 0 ) );
        },
        'permission_callback' => function () {
            return current_user_can( 'edit_posts' );
        },
        'meta' => array(
            'annotations'  => array( 'readonly' => true ),
            'show_in_rest' => true,
            'mcp'          => array( 'public' => true ),
        ),
    ) );
} );

A few details are worth highlighting. The description is written for a reader who has never seen your code, because an AI agent will read it to decide when to use the ability. The input property has its own description and a sensible default. The permission callback uses a real capability rather than returning true. Finally, the meta array marks the ability as read-only, exposes it in the REST API and makes it public for MCP clients.

Running an ability from PHP

Abilities are not only for AI. You can retrieve and execute one directly in PHP, which is handy for testing:

$ability = wp_get_ability( 'my-site/get-post-count' );
if ( $ability ) {
    $result = $ability->execute( array( 'post_type' => 'page' ) );
}

The REST API endpoints

When show_in_rest is enabled, WordPress exposes abilities under the wp-abilities/v1 namespace. You can list categories, list abilities, fetch a single ability with its schemas, and run it through the /run endpoint. Authenticated requests respect the same permission callback, so a user without the right capability simply receives an error.

What Is MCP and Why Does WordPress Use It?

The Model Context Protocol is an open standard that defines how AI applications connect to external tools and data. Instead of every AI client building its own integration for every service, a service exposes tools, resources and prompts in a common format, and any MCP-compatible client can use them.

This is a natural fit for WordPress. The project already values open standards and interoperability, and MCP lets a single WordPress site work with many AI clients without favouring any one of them.

What Is the WordPress MCP Adapter?

The MCP Adapter is the official bridge between the Abilities API and MCP. It is available as a plugin in the WordPress.org directory and as a Composer package for developers who want to bundle it. Importantly, the adapter does not provide any AI features by itself. It is the server and transport layer: it takes the abilities registered on your site and makes them available to MCP clients, handling protocol negotiation, permissions and errors.

Key points to understand:

  • Abilities are private by default. An ability only appears to MCP clients when its metadata marks it as public. This is a thoughtful, secure default.
  • A default server is included. It offers three meta-tools that let an agent discover abilities, read an ability’s details, and execute an ability.
  • Multiple transports are supported. HTTP for remote connections and STDIO through WP-CLI for local workflows.
  • WordPress 6.9 or newer is required, because the Abilities API is part of core from that version.
AI assistant chat interface answering a question on a screen
An MCP client can discover and call your site’s public abilities. Photo by Mohamed Nohassi on Unsplash.

How the Pieces Fit Together

It helps to picture the flow from the AI client down to your database:

  1. You ask your AI client to do something, such as “list my five most recent drafts”.
  2. The client connects to your site’s MCP endpoint and asks which abilities are available.
  3. The MCP Adapter returns the public abilities with their descriptions and schemas.
  4. The client picks the right ability and sends a request with valid input.
  5. WordPress validates the input, checks permissions for the authenticated user, runs the execute callback and returns the result.

Every step uses familiar WordPress building blocks: users, capabilities, hooks and the REST infrastructure. Nothing bypasses the normal rules of your site.

Step-by-Step: Connecting an AI Agent to Your Site

Step 1: Update WordPress and PHP

Make sure the site runs WordPress 6.9 or newer. Current releases in the 7.x series are ideal. While you are at it, check your PHP version too. My guide to the best PHP version for WordPress explains which versions are supported and how to upgrade safely.

Step 2: Install the MCP Adapter

Go to Plugins > Add New, search for “MCP Adapter”, then install and activate it. Developers who manage dependencies with Composer can require the wordpress/mcp-adapter package instead.

Step 3: See which abilities already exist

Many popular plugins have started registering abilities. For example, recent versions of Yoast SEO register abilities to read and update a post’s SEO data, and other SEO, commerce and builder plugins are adding their own. Visit /wp-json/wp-abilities/v1/abilities while logged in as an administrator to see the list for your site.

Step 4: Create a dedicated user for the agent

Rather than connecting with your own administrator account, create a separate user with the lowest role that can do the job. An agent that only writes drafts needs the Author or Editor role, not Administrator. This keeps every action traceable and limits the impact of mistakes.

Step 5: Generate an Application Password

Open that user’s profile, scroll to Application Passwords, give it a recognisable name such as “AI agent – laptop”, and generate it. Application Passwords can be revoked individually at any time, which makes them a good fit for agent access. Read the REST API authentication documentation for details.

Step 6: Configure your MCP client

Most MCP clients let you add a server by URL or by command. For a remote site you point the client at the adapter’s HTTP endpoint and provide the credentials. For local development you can use the STDIO transport through WP-CLI with the wp mcp-adapter serve command. The adapter’s README lists the exact endpoint and configuration examples for common clients, and it is worth following it closely because client settings evolve quickly.

Step 7: Start with read-only tasks

Test with safe questions first: “How many published posts do I have?” or “List pages without a meta description.” Once you trust the setup, gradually allow abilities that create or update content, ideally starting on a staging site.

Practical Use Cases for AI Agents on WordPress

Here are use cases I find genuinely valuable for site owners and agencies:

  • Content audits: find outdated posts, missing featured images, thin pages or broken internal links across hundreds of URLs.
  • SEO housekeeping: review titles and meta descriptions, then update them through an SEO plugin’s own abilities so its validation runs. It pairs well with the ideas in my post on AEO in WordPress.
  • Store reporting: ask for a weekly summary of orders, refunds or low-stock products in plain language.
  • Editorial workflows: create structured drafts, assign categories and prepare posts for human review.
  • Agency maintenance: check versions, plugin status and site health across many client sites from one conversation.

If you already use AI in your workflow, my article on ways I use ChatGPT to build WordPress websites faster shows how these tools fit into day-to-day site building.

Security Best Practices for AI Access

Giving software the ability to act on your site deserves the same care as giving a new team member access. The good news is that the Abilities API was designed with this in mind. These are the practices I recommend:

  1. Least privilege: give the agent’s user only the role it needs, and expose only the abilities you actually use.
  2. Meaningful permission callbacks: as a developer, never return true unconditionally. Check a specific capability, and for post-level actions use current_user_can( 'edit_post', $id ).
  3. Accurate annotations: mark read-only abilities as read-only and destructive ones as destructive. Clients use these hints to ask for confirmation before risky actions.
  4. Logging: hook into wp_after_execute_ability to record which ability ran, for which user and when.
  5. Staging first: test new abilities and new agent workflows on a staging copy. My post on WordPress Playground and local development shows a quick way to spin one up.
  6. Regular reviews: revoke Application Passwords you no longer use and keep plugins updated. My WordPress security checklist covers the wider basics.

Tips for Plugin Developers

If you build plugins, registering abilities is a great way to make your product work naturally with AI tools. A few lessons from writing them:

  • Write descriptions for strangers. Say what the ability does, when to use it and what it returns, in one or two clear sentences.
  • Keep abilities focused. “Update a post’s SEO title” is easier for an agent to use correctly than a giant “update settings” ability with fifty optional fields.
  • Return useful output. Include IDs, URLs and status values so the agent can confirm the result and chain the next step.
  • Reuse your existing logic. Call the same functions your admin screens use, so validation, hooks and caching behave identically.
  • Version thoughtfully. Treat ability names and schemas like a public API. Add new fields rather than renaming existing ones.

Plugin authors who publish on WordPress.org should also be aware that new releases now pass through an automated review. My overview of the WordPress.org plugin security review explains what that means for your release process.

What Comes Next for AI in WordPress?

The Abilities API is a foundation, and the ecosystem is building on it quickly. According to the official roadmap for WordPress 7.2, work on Abilities and the MCP Adapter continues in dedicated AI and MCP Adapter plugins, which lets these features evolve faster than the core release cycle. You can read more about the upcoming release in my WordPress 7.2 features overview.

Expect more plugins to register abilities, better client support, and richer patterns for approvals and auditing. For developers, now is the ideal time to learn the API, because the abilities you register today will work with tomorrow’s AI clients without extra integration work.

Frequently Asked Questions

Do I need to code to use the Abilities API?

No. Site owners can install the MCP Adapter and use abilities that core and plugins already register. Coding is only needed when you want to add your own custom abilities.

Is the Abilities API only for AI?

Not at all. Abilities can be executed from PHP, through the REST API and from automation tools. AI clients are simply one of the most exciting consumers.

Will an AI agent be able to do anything on my site?

No. An agent can only use abilities that are public and that its WordPress user has permission to run. You stay in control of both lists.

Which WordPress version do I need?

WordPress 6.9 or later. The Abilities API ships in core from 6.9, and the current MCP Adapter requires it.

Where can I learn more?

Start with the Abilities API developer note for WordPress 6.9, the Abilities API handbook and the MCP Adapter repository.

Conclusion

The WordPress Abilities API gives the platform a shared language for describing what a site can do, and the MCP Adapter lets AI agents speak that language safely. For site owners, it means AI help that respects your roles and permissions. For developers, it means one clean way to expose features to every compatible client.

My advice is simple: start small. Install the adapter on a staging site, connect a client with a limited user, and try a few read-only tasks. Then register one useful ability of your own. Within an afternoon you will see why so many people in the WordPress community are excited about this foundation for the next chapter of the web.

Leave a Reply

Your email address will not be published. Required fields are marked *