You decided to try to use WordPress with MCP and Claude Code. But where do you start? This was not a straightforward answer as I was initially expecting, so I decided to document this process to help myself in the future and others that are trying to achieve the same thing.

1. Requirements

  1. Claude Code (quick setup).
  2. WordPress 6.9 or higher.
  3. MCP Adapter plugin: not available in the official repository yet, you need to download the latest version from GitHub, install and activate it.

2. WordPress setup

You decided to use WordPress with MCP and Claude Code. But where do you start? The answer wasn’t as straightforward as I initially expected, so I decided to document the process to help my future self and others trying to do the same thing.

2.1 Enabling abilities

The Abilities API were added in WordPress 6.9 with 3 core Abilities to get information about the site, user and environment. By default they are not public and you need to enable the. You can create a plugin (e.g. /wp-content/mu-plugins/mcp-expose-core-abilities.php) with the following code from the WordPress Developer Blog post (written by Jonathan Bossenger):

<?php
/**
 * Plugin Name: Enable core abilities
 * Version: 1.0.0
 *
 * @package enable-core-abilities
 */

add_filter( 'wp_register_ability_args', 'myplugin_enable_core_abilities_mcp_access', 10, 2 );
/**
 * Enable MCP access for core abilities.
 *
 * @param array  $args        Ability registration arguments.
 * @param string $ability_name  Ability ID.
 * @return array Modified ability registration arguments.
 */
function myplugin_enable_core_abilities_mcp_access( array $args, string $ability_name ) {
    // Enable MCP access for the three current core abilities.
    $core_abilities = array(
        'core/get-site-info',
        'core/get-user-info',
        'core/get-environment-info',
    );
    if ( in_array( $ability_name, $core_abilities, true ) ) {
        $args['meta']['mcp']['public'] = true;
    }

    return $args;
}
PHP

2.1 Create an Application Password

Two of the core Abilities requires an user with the capability to manage_options, which usually requires a Administrator role. So, go to the edit user profile screen for an admin user, scroll down to the Application Passwords section, fill out New Application Password Name (e.g. Claude Code) and click on Add Application Password.

Save this password in a secure place, since you won’t be able to see it again.

2.3 How to test if everything is working as expected?

You may be asking: why should I do this? I had a hard time connecting Claude Code and WordPress and I wasn’t sure what the problem was. By checking this and making sure it’s working as expected, you will at least know that the problem isn’t with the WordPress setup. If I had done this, it would have saved me a couple of hours of debugging.

Run this command in your terminal to list all abilities (and get first a session ID required for that). Don’t forget to change the WORDPRESS_USERNAME with the value of your WordPress Username (not the Application Password Name) and APPLICATION_PASSWORD you created (each one appear twice in the command):

SESSION=$(curl -s -D - -u "USER:PASS" \
  -X POST SITE_URL/wp-json/mcp/mcp-adapter-default-server \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"curl","version":"1.0"}}}' \
  | grep -i "mcp-session-id" | awk '{print $2}' | tr -d '\r')

curl -u "USER:PASS" \
  -X POST SITE_URL/wp-json/mcp/mcp-adapter-default-server \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "Mcp-Session-Id: $SESSION" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}'
Bash

Yes I know, it’s a complicated command, but I couldn’t find a way to simplify it. The good news it that if you have WP-CLI, the command is much simpler (and you only need to change WORDPRESS_USERNAME):

echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | wp mcp-adapter serve --user="WORDPRESS_USERNAME" --server=mcp-adapter-default-server
Bash

For both commands, you should get something like this back that list all abilities (I’ve formatted the output with jq for this post):

{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "tools": [
      {
        "name": "mcp-adapter-discover-abilities",
        "title": "Discover Abilities",
        "description": "Discover all available WordPress abilities in the system. Returns a list of all registered abilities with their basic information.",
        "inputSchema": {
          "type": "object"
        },
        "outputSchema": {
          "type": "object",
          "properties": {
            "abilities": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "label": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "label",
                  "description"
                ]
              }
            }
          },
          "required": [
            "abilities"
          ]
        },
        "annotations": {
          "title": "Discover Abilities",
          "readOnlyHint": true,
          "destructiveHint": false,
          "idempotentHint": true
        }
      },
      {
        "name": "mcp-adapter-get-ability-info",
        "title": "Get Ability Info",
        "description": "Get detailed information about a specific WordPress ability including its input/output schema, description, and usage examples.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "ability_name": {
              "type": "string",
              "description": "The full name of the ability to get information about"
            }
          },
          "required": [
            "ability_name"
          ]
        },
        "outputSchema": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string"
            },
            "label": {
              "type": "string"
            },
            "description": {
              "type": "string"
            },
            "input_schema": {
              "type": "object",
              "description": "JSON Schema for the ability input parameters"
            },
            "output_schema": {
              "type": "object",
              "description": "JSON Schema for the ability output structure"
            },
            "meta": {
              "type": "object",
              "description": "Additional metadata about the ability"
            }
          },
          "required": [
            "name",
            "label",
            "description",
            "input_schema"
          ]
        },
        "annotations": {
          "title": "Get Ability Info",
          "readOnlyHint": true,
          "destructiveHint": false,
          "idempotentHint": true
        }
      },
      {
        "name": "mcp-adapter-execute-ability",
        "title": "Execute Ability",
        "description": "Execute a WordPress ability with the provided parameters. This is the primary execution layer that can run any registered ability.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "ability_name": {
              "type": "string",
              "description": "The full name of the ability to execute"
            },
            "parameters": {
              "type": "object",
              "description": "Parameters to pass to the ability"
            }
          },
          "required": [
            "ability_name",
            "parameters"
          ]
        },
        "outputSchema": {
          "type": "object",
          "properties": {
            "success": {
              "type": "boolean"
            },
            "data": {
              "type": [
                "object",
                "array",
                "string",
                "number",
                "integer",
                "boolean",
                "null"
              ],
              "description": "The result data from the ability execution"
            },
            "error": {
              "type": "string",
              "description": "Error message if execution failed"
            }
          },
          "required": [
            "success"
          ]
        },
        "annotations": {
          "title": "Execute Ability",
          "readOnlyHint": false,
          "destructiveHint": true,
          "idempotentHint": false
        }
      }
    ]
  }
}
Bash
Expand

Great, now we know that the WordPress setup is working!

3. Claude Code setup

  1. Create a new folder to store the MCP settings (e.g. wp-mcp) and open it
  2. Create a new file called .mcp.json with the following content, replacing:
    • SITE_URL with your site URL with HTTP/HTTPS (e.g. https://www.danielkossmann.com)
    • WORDPRESS_USERNAME with the WordPress Username you created (this is NOT the Application Password Name)
    • APPLICATION_PASSWORD the Application Password created in Step 2.
{
  "mcpServers": {
    "wordpress-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "@automattic/mcp-wordpress-remote@latest"
      ],
      "env": {
        "WP_API_URL": "SITE_URL/wp-json/mcp/mcp-adapter-default-server",
        "WP_API_USERNAME": "WORDPRESS_USERNAME",
        "WP_API_PASSWORD": "APPLICATION_PASSWORD",
        "LOG_FILE": "/tmp/mcp-wordpress.log"
      }
    }
  }
}
Bash
  1. Open the terminal inside the folder you created in the first step and run claude
  2. Select to trust folder and MCP server
  3. Type /mcp and hit Enter.
  4. You should see in the list something like: wordpress-mcp-server · ✔ connected. Press Esc to go back to the main screen.
  5. Type something like what is the name of my site? and hit Enter
  6. Grant permissions to proceed using the MCP abilities
  7. Voilà, you should get the site title inside Claude Code!

Isn’t that exciting? The core Abilities are still pretty limited right now, but this guide was really just about the initial setup. In a future post, I’ll share how I’ve been using my own custom Abilities to get some real work done.

I did this on Ubuntu 25.10, and some details might vary depending on your system. This is just one of the many ways to set it up, so if you know of another good approach, please share it in the comments.



Comments

Leave a Reply

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