How to Use MCP with WordPress: Step-by-Step

Context This guide shows how to connect an MCP client to WordPress via the MCP Adapter and create content using MCP tools. Prerequisites Abilities Provider (Required) MCP Adapter…

Context

This guide shows how to connect an MCP client to WordPress via the MCP Adapter and create content using MCP tools.

Prerequisites

  • WordPress 6.9+
  • MCP Adapter installed and activated
  • MCP client (Cursor, Claude Desktop, VS Code, etc.)
  • Application Password for the WordPress admin user (HTTP transport)

Abilities Provider (Required)

MCP Adapter exposes only abilities that are explicitly registered and marked meta.mcp.public=true. That means you need a small abilities provider plugin that registers admin‑only tools such as create-post and update-post.

Important: This is not a production plugin. Treat it as reference code only. You can adapt it inside a theme or a temporary internal plugin, but you must review security, permissions, and data exposure before using it in any real environment.

The repository is intentionally minimal and acts as a reference implementation.

Code is poetry.

What exactly must be enabled

  • Abilities plugin active (admin‑only).
  • Abilities registered on wp_abilities_api_init.
  • Each ability includes meta.mcp.public = true.
  • Admin capability check (recommended: manage_options).

Abilities code example (minimal)

Auto
// Register on wp_abilities_api_init
wp_register_ability('your-plugin/create-post', [
  'label' => 'Create Post',
  'description' => 'Create a WordPress post',
  'input_schema' => [
    'type' => 'object',
    'properties' => [
      'title' => ['type' => 'string'],
      'content' => ['type' => 'string'],
      'status' => ['type' => 'string', 'default' => 'draft']
    ],
    'required' => ['title','content']
  ],
  'execute_callback' => function($input){
    return wp_insert_post([
      'post_title' => $input['title'],
      'post_content' => $input['content'],
      'post_status' => $input['status'] ?? 'draft'
    ]);
  },
  'permission_callback' => function(){
    return current_user_can('manage_options');
  },
  'meta' => [
    'mcp' => [
      'public' => true,
      'type' => 'tool'
    ]
  ]
]);

Steps

Step 1: Install and activate MCP Adapter

Command (WP-CLI):

Auto
cd "/path/to/wordpress"
wp plugin install mcp-adapter --activate

You can also activate via WP Admin → Plugins → Installed Plugins.

Step 2: Install and activate the Abilities Provider plugin

Install the plugin, then activate it in WP Admin. This is required for content actions to appear as MCP tools.

Step 3: Configure MCP client (HTTP)

Use the MCP WordPress remote proxy to connect over HTTP:

Auto
{
  "mcpServers": {
    "wordpress-local": {
      "command": "npx",
      "args": ["-y", "@automattic/mcp-wordpress-remote@latest"],
      "env": {
        "WP_API_URL": "http://your-site.local/wp-json/mcp/mcp-adapter-default-server",
        "WP_API_USERNAME": "admin",
        "WP_API_PASSWORD": "YOUR_APP_PASSWORD"
      }
    }
  }
}

Step 4: Verify MCP server in your editor

  • Open View → Command Palette → MCP: Open MCP Settings
  • Confirm the server is listed and has no errors
  • Reload the editor

Step 5: List tools and execute an ability

Command (MCP tools/list):

Auto
{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}

Command (Execute ability):

Auto
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"mcp-adapter-execute-ability","arguments":{"ability_name":"your-plugin/create-post","parameters":{"title":"Example","content":"Hello from MCP","status":"draft"}}}}

Commands

  • tools/list — list MCP tools
  • tools/call — execute a tool

API

  • Default endpoint: /wp-json/mcp/mcp-adapter-default-server
  • Transport: HTTP or STDIO

Logic

  1. MCP connects to WordPress
  2. MCP discovers tools (abilities)
  3. MCP executes tools to read/write content

Expected Result

  • MCP client can list tools
  • MCP can create or update posts through abilities

FAQ

Q: What should I watch out for?
Sometimes the agent output lands as one big Classic block. Convert it to blocks once, and the content renders correctly.

Q: Can an agent write in blocks?
Yes. Send Gutenberg block markup (<!-- wp:... -->) in the content so WordPress opens it as blocks instead of Classic.

Q: Do I need to write custom code?
Yes. The MCP Adapter only exposes abilities that are explicitly marked meta.mcp.public=true.

Q: Why does WP-CLI fail on Local?
Local uses a site-specific MySQL socket. If WP-CLI cannot connect, pass the socket via WP_CLI_DB_HOST.

Q: Is STDIO safe for production?
STDIO is intended for local development. Use HTTP with Application Passwords for production.

Summary

Install MCP Adapter, activate an abilities provider plugin, configure your MCP client, and use MCP tools to create or update content. Keep abilities admin‑only and expose only what you need.

References

Thanks to the Automattic team for making MCP Adapter possible.