An MCP adapter that bridges the Abilities API to the Model Context Protocol, enabling MCP clients to discover and invoke WordPress plugin, theme, and core abilities programmatically.
1,691
stars
143
commits
PHP
primary language
Sep 11, 2026
updated
Part of the AI Building Blocks for WordPress initiative
The official WordPress package for MCP integration that exposes WordPress abilities as Model Context Protocol (MCP) tools, resources, and prompts for AI agents.
This adapter bridges WordPress's Abilities API with the MCP specification, providing a standardized way for AI agents to interact with WordPress functionality. It includes HTTP and STDIO transport support, comprehensive error handling, and an extensible architecture for custom integrations.
McpTransportInterface to create specialized communication protocolsMcpErrorHandlerInterface for custom logging, monitoring, or notification
systemsMcpObservabilityHandlerInterface for integration with monitoring
systemsFor a full breakdown of the component structure, see the Architecture Overview.
^0.1.0): Typed DTOs for MCP protocol typesMCP Adapter is distributed as a WordPress plugin. Install and activate it like any other plugin. The release ships with everything it needs, so there is no autoloader to wire up and no build step to run.
Requires WordPress 6.9 or newer; the Abilities API is part of core, so there is no separate plugin to install.
Download the latest stable mcp-adapter.zip from the GitHub Releases page, then upload it from Plugins → Add Plugin → Upload Plugin and activate it.
wp plugin install https://github.com/WordPress/mcp-adapter/releases/latest/download/mcp-adapter.zip --activate
// .wp-env.json
{
"$schema": "https://schemas.wp.org/trunk/wp-env.json",
"plugins": [
"https://github.com/WordPress/mcp-adapter/releases/latest/download/mcp-adapter.zip"
]
}
The WP\MCP classes are provided by the MCP Adapter plugin, so declare it as a plugin dependency using the Requires Plugins field in your plugin header:
<?php
/**
* Plugin Name: My Plugin
* Description: Adds MCP tools for my feature.
* Requires Plugins: mcp-adapter
*/
Check availability and initialize on plugins_loaded so all plugins are available before the adapter starts:
add_action( 'plugins_loaded', function() {
if ( ! class_exists( 'WP\MCP\Core\McpAdapter' ) ) {
// MCP Adapter is not active — show an admin notice or return early.
return;
}
\WP\MCP\Core\McpAdapter::instance();
} );
The MCP Adapter automatically creates a default server that exposes registered WordPress abilities through a layered architecture. This provides immediate MCP functionality without requiring manual server configuration.
How it works:
wp_register_ability() with meta.public set to true are discoverable and executable on the default server via its built-in adapter toolsmeta.mcp.public explicitly to override the high-level setting for MCP only; false opts a public ability out, while true exposes an otherwise private ability to MCPmcp-adapter/discover-abilities, mcp-adapter/get-ability-info, and mcp-adapter/execute-ability rather than being auto-registered individually in tools/listmeta.mcp.public flag/wp-json/mcp/mcp-adapter-default-serverwp mcp-adapter serve --server=mcp-adapter-default-server// Simply register a WordPress ability
add_action( 'wp_abilities_api_init', function() {
wp_register_ability( 'my-plugin/get-posts', [
'label' => 'Get Posts',
'description' => 'Retrieve WordPress posts with optional filtering',
'category' => 'site',
'input_schema' => [
'type' => 'object',
'properties' => [
'numberposts' => [
'type' => 'integer',
'description' => 'Number of posts to retrieve',
'default' => 5,
'minimum' => 1,
'maximum' => 100
],
'post_status' => [
'type' => 'string',
'description' => 'Post status to filter by',
'enum' => ['publish', 'draft', 'private'],
'default' => 'publish'
]
]
],
'output_schema' => [
'type' => 'array',
'items' => [
'type' => 'object',
'properties' => [
'ID' => ['type' => 'integer'],
'post_title' => ['type' => 'string'],
'post_content' => ['type' => 'string'],
'post_date' => ['type' => 'string'],
'post_author' => ['type' => 'string']
]
]
],
'execute_callback' => function( $input ) {
$args = [
'numberposts' => $input['numberposts'] ?? 5,
'post_status' => $input['post_status'] ?? 'publish'
];
return get_posts( $args );
},
'permission_callback' => function() {
return current_user_can( 'read' );
},
'meta' => [
'public' => true, // Expose to clients, including the default MCP server
],
]);
});
// With the meta.public flag, the ability is exposed through the default MCP server.
// In the default server configuration, discover it via `discover-abilities`
// and invoke it via `mcp-adapter/execute-ability` rather than expecting
// it to appear as its own entry in `tools/list`.
// To opt out of MCP while remaining public to other clients, explicitly set
// meta.mcp.public to false.
// To expose only through MCP, omit `meta.public` and set `meta.mcp.public` to true.
// Without either public flag, abilities are only accessible through custom MCP
// servers that explicitly list them.
// Note: how far `meta.public` reaches depends on the WordPress version. WordPress
// core starts applying `meta.public` to the REST API (`meta.show_in_rest`) in 7.1. On
// WordPress 6.9 and 7.0, this adapter honors `meta.public` for MCP, but REST API
// access still requires setting `meta.show_in_rest` to true.
For detailed information about creating WordPress abilities, see the Abilities API developer documentation.
The MCP Adapter supports multiple connection methods. Here are examples for connecting with MCP clients:
For local development and testing, you can interact directly with MCP servers using WP-CLI commands:
# List all available MCP servers
wp mcp-adapter list
# Test the discover abilities tool to see all available WordPress abilities
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"mcp-adapter-discover-abilities","arguments":{}}}' | wp mcp-adapter serve --user=admin --server=mcp-adapter-default-server
# Test listing available tools
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | wp mcp-adapter serve --user=admin --server=mcp-adapter-default-server
Configure MCP clients (Claude Desktop, Claude Code, VS Code, Cursor, etc.) to connect to your WordPress MCP servers.
{
"mcpServers": {
"wordpress-default": {
"command": "wp",
"args": [
"--path=/path/to/your/wordpress/site",
"mcp-adapter",
"serve",
"--server=mcp-adapter-default-server",
"--user=admin"
]
},
"wordpress-custom": {
"command": "wp",
"args": [
"--path=/path/to/your/wordpress/site",
"mcp-adapter",
"serve",
"--server=your-custom-server-id",
"--user=admin"
]
}
}
}
The @automattic/mcp-wordpress-remote proxy runs locally and translates STDIO-based MCP communication from AI clients into HTTP REST API calls that WordPress understands. Authentication uses WordPress Application Passwords.
{
"mcpServers": {
"wordpress-http-default": {
"command": "npx",
"args": [
"-y",
"@automattic/mcp-wordpress-remote@latest"
],
"env": {
"WP_API_URL": "http://your-site.test/wp-json/mcp/mcp-adapter-default-server",
"LOG_FILE": "/path/to/logs/mcp-adapter.log",
"WP_API_USERNAME": "your-username",
"WP_API_PASSWORD": "your-application-password"
}
},
"wordpress-http-custom": {
"command": "npx",
"args": [
"-y",
"@automattic/mcp-wordpress-remote@latest"
],
"env": {
"WP_API_URL": "http://your-site.test/wp-json/your-namespace/your-route",
"LOG_FILE": "/path/to/logs/mcp-adapter.log",
"WP_API_USERNAME": "your-username",
"WP_API_PASSWORD": "your-application-password"
}
}
}
}
For advanced use cases, you can create custom MCP servers with specific configurations:
add_action( 'mcp_adapter_init', function( $adapter ) {
$adapter->create_server(
'my-server-id', // Unique server identifier
'my-namespace', // REST API namespace
'mcp', // REST API route
'My MCP Server', // Server name
'Description of my server', // Server description
'v1.0.0', // Server version
array( // Transport methods
\WP\MCP\Transport\HttpTransport::class,
),
\WP\MCP\Infrastructure\ErrorHandling\ErrorLogMcpErrorHandler::class, // Error handler
\WP\MCP\Infrastructure\Observability\NullMcpObservabilityHandler::class, // Observability handler
array( 'my-plugin/my-ability' ), // Abilities to expose as tools
array(), // Resources (optional)
array() // Prompts (optional)
);
} );
The MCP Adapter includes production-ready HTTP transports. For specialized requirements like custom authentication, message queues, or enterprise integrations, you can create custom transport protocols.
See the Custom Transports Guide for detailed implementation instructions.
The MCP Adapter supports custom authentication logic through transport permission callbacks. Instead of the default is_user_logged_in() check, you can implement custom authentication for your MCP servers.
See the Transport Permissions Guide for detailed authentication patterns.
The MCP Adapter includes a default WordPress-compatible error handler, but you can implement custom error handling to integrate with existing logging systems, monitoring tools, or meet specific requirements.
See the Error Handling Guide for detailed implementation instructions.
The MCP Adapter includes built-in observability for tracking metrics and events. You can implement custom observability handlers to integrate with monitoring systems, analytics platforms, or performance tracking tools.
See the Observability Guide for detailed metrics tracking and custom handler implementation.
PHP
100.0%
An MCP adapter that bridges the Abilities API to the Model Context Protocol, enabling MCP clients to discover and invoke WordPress plugin, theme, and core abilities programmatically.
1,691
stars
143
commits
PHP
primary language
Sep 11, 2026
updated
Part of the AI Building Blocks for WordPress initiative
The official WordPress package for MCP integration that exposes WordPress abilities as Model Context Protocol (MCP) tools, resources, and prompts for AI agents.
This adapter bridges WordPress's Abilities API with the MCP specification, providing a standardized way for AI agents to interact with WordPress functionality. It includes HTTP and STDIO transport support, comprehensive error handling, and an extensible architecture for custom integrations.
McpTransportInterface to create specialized communication protocolsMcpErrorHandlerInterface for custom logging, monitoring, or notification
systemsMcpObservabilityHandlerInterface for integration with monitoring
systemsFor a full breakdown of the component structure, see the Architecture Overview.
^0.1.0): Typed DTOs for MCP protocol typesMCP Adapter is distributed as a WordPress plugin. Install and activate it like any other plugin. The release ships with everything it needs, so there is no autoloader to wire up and no build step to run.
Requires WordPress 6.9 or newer; the Abilities API is part of core, so there is no separate plugin to install.
Download the latest stable mcp-adapter.zip from the GitHub Releases page, then upload it from Plugins → Add Plugin → Upload Plugin and activate it.
wp plugin install https://github.com/WordPress/mcp-adapter/releases/latest/download/mcp-adapter.zip --activate
// .wp-env.json
{
"$schema": "https://schemas.wp.org/trunk/wp-env.json",
"plugins": [
"https://github.com/WordPress/mcp-adapter/releases/latest/download/mcp-adapter.zip"
]
}
The WP\MCP classes are provided by the MCP Adapter plugin, so declare it as a plugin dependency using the Requires Plugins field in your plugin header:
<?php
/**
* Plugin Name: My Plugin
* Description: Adds MCP tools for my feature.
* Requires Plugins: mcp-adapter
*/
Check availability and initialize on plugins_loaded so all plugins are available before the adapter starts:
add_action( 'plugins_loaded', function() {
if ( ! class_exists( 'WP\MCP\Core\McpAdapter' ) ) {
// MCP Adapter is not active — show an admin notice or return early.
return;
}
\WP\MCP\Core\McpAdapter::instance();
} );
The MCP Adapter automatically creates a default server that exposes registered WordPress abilities through a layered architecture. This provides immediate MCP functionality without requiring manual server configuration.
How it works:
wp_register_ability() with meta.public set to true are discoverable and executable on the default server via its built-in adapter toolsmeta.mcp.public explicitly to override the high-level setting for MCP only; false opts a public ability out, while true exposes an otherwise private ability to MCPmcp-adapter/discover-abilities, mcp-adapter/get-ability-info, and mcp-adapter/execute-ability rather than being auto-registered individually in tools/listmeta.mcp.public flag/wp-json/mcp/mcp-adapter-default-serverwp mcp-adapter serve --server=mcp-adapter-default-server// Simply register a WordPress ability
add_action( 'wp_abilities_api_init', function() {
wp_register_ability( 'my-plugin/get-posts', [
'label' => 'Get Posts',
'description' => 'Retrieve WordPress posts with optional filtering',
'category' => 'site',
'input_schema' => [
'type' => 'object',
'properties' => [
'numberposts' => [
'type' => 'integer',
'description' => 'Number of posts to retrieve',
'default' => 5,
'minimum' => 1,
'maximum' => 100
],
'post_status' => [
'type' => 'string',
'description' => 'Post status to filter by',
'enum' => ['publish', 'draft', 'private'],
'default' => 'publish'
]
]
],
'output_schema' => [
'type' => 'array',
'items' => [
'type' => 'object',
'properties' => [
'ID' => ['type' => 'integer'],
'post_title' => ['type' => 'string'],
'post_content' => ['type' => 'string'],
'post_date' => ['type' => 'string'],
'post_author' => ['type' => 'string']
]
]
],
'execute_callback' => function( $input ) {
$args = [
'numberposts' => $input['numberposts'] ?? 5,
'post_status' => $input['post_status'] ?? 'publish'
];
return get_posts( $args );
},
'permission_callback' => function() {
return current_user_can( 'read' );
},
'meta' => [
'public' => true, // Expose to clients, including the default MCP server
],
]);
});
// With the meta.public flag, the ability is exposed through the default MCP server.
// In the default server configuration, discover it via `discover-abilities`
// and invoke it via `mcp-adapter/execute-ability` rather than expecting
// it to appear as its own entry in `tools/list`.
// To opt out of MCP while remaining public to other clients, explicitly set
// meta.mcp.public to false.
// To expose only through MCP, omit `meta.public` and set `meta.mcp.public` to true.
// Without either public flag, abilities are only accessible through custom MCP
// servers that explicitly list them.
// Note: how far `meta.public` reaches depends on the WordPress version. WordPress
// core starts applying `meta.public` to the REST API (`meta.show_in_rest`) in 7.1. On
// WordPress 6.9 and 7.0, this adapter honors `meta.public` for MCP, but REST API
// access still requires setting `meta.show_in_rest` to true.
For detailed information about creating WordPress abilities, see the Abilities API developer documentation.
The MCP Adapter supports multiple connection methods. Here are examples for connecting with MCP clients:
For local development and testing, you can interact directly with MCP servers using WP-CLI commands:
# List all available MCP servers
wp mcp-adapter list
# Test the discover abilities tool to see all available WordPress abilities
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"mcp-adapter-discover-abilities","arguments":{}}}' | wp mcp-adapter serve --user=admin --server=mcp-adapter-default-server
# Test listing available tools
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | wp mcp-adapter serve --user=admin --server=mcp-adapter-default-server
Configure MCP clients (Claude Desktop, Claude Code, VS Code, Cursor, etc.) to connect to your WordPress MCP servers.
{
"mcpServers": {
"wordpress-default": {
"command": "wp",
"args": [
"--path=/path/to/your/wordpress/site",
"mcp-adapter",
"serve",
"--server=mcp-adapter-default-server",
"--user=admin"
]
},
"wordpress-custom": {
"command": "wp",
"args": [
"--path=/path/to/your/wordpress/site",
"mcp-adapter",
"serve",
"--server=your-custom-server-id",
"--user=admin"
]
}
}
}
The @automattic/mcp-wordpress-remote proxy runs locally and translates STDIO-based MCP communication from AI clients into HTTP REST API calls that WordPress understands. Authentication uses WordPress Application Passwords.
{
"mcpServers": {
"wordpress-http-default": {
"command": "npx",
"args": [
"-y",
"@automattic/mcp-wordpress-remote@latest"
],
"env": {
"WP_API_URL": "http://your-site.test/wp-json/mcp/mcp-adapter-default-server",
"LOG_FILE": "/path/to/logs/mcp-adapter.log",
"WP_API_USERNAME": "your-username",
"WP_API_PASSWORD": "your-application-password"
}
},
"wordpress-http-custom": {
"command": "npx",
"args": [
"-y",
"@automattic/mcp-wordpress-remote@latest"
],
"env": {
"WP_API_URL": "http://your-site.test/wp-json/your-namespace/your-route",
"LOG_FILE": "/path/to/logs/mcp-adapter.log",
"WP_API_USERNAME": "your-username",
"WP_API_PASSWORD": "your-application-password"
}
}
}
}
For advanced use cases, you can create custom MCP servers with specific configurations:
add_action( 'mcp_adapter_init', function( $adapter ) {
$adapter->create_server(
'my-server-id', // Unique server identifier
'my-namespace', // REST API namespace
'mcp', // REST API route
'My MCP Server', // Server name
'Description of my server', // Server description
'v1.0.0', // Server version
array( // Transport methods
\WP\MCP\Transport\HttpTransport::class,
),
\WP\MCP\Infrastructure\ErrorHandling\ErrorLogMcpErrorHandler::class, // Error handler
\WP\MCP\Infrastructure\Observability\NullMcpObservabilityHandler::class, // Observability handler
array( 'my-plugin/my-ability' ), // Abilities to expose as tools
array(), // Resources (optional)
array() // Prompts (optional)
);
} );
The MCP Adapter includes production-ready HTTP transports. For specialized requirements like custom authentication, message queues, or enterprise integrations, you can create custom transport protocols.
See the Custom Transports Guide for detailed implementation instructions.
The MCP Adapter supports custom authentication logic through transport permission callbacks. Instead of the default is_user_logged_in() check, you can implement custom authentication for your MCP servers.
See the Transport Permissions Guide for detailed authentication patterns.
The MCP Adapter includes a default WordPress-compatible error handler, but you can implement custom error handling to integrate with existing logging systems, monitoring tools, or meet specific requirements.
See the Error Handling Guide for detailed implementation instructions.
The MCP Adapter includes built-in observability for tracking metrics and events. You can implement custom observability handlers to integrate with monitoring systems, analytics platforms, or performance tracking tools.
See the Observability Guide for detailed metrics tracking and custom handler implementation.
PHP
100.0%