This guide will help you quickly set up the WordPress MCP Adapter to expose your WordPress abilities as MCP (Model Context Protocol) tools, resources, and prompts.
The MCP Adapter transforms WordPress abilities into AI-accessible interfaces, allowing AI agents to interact with your WordPress functionality through standardized protocols.
- PHP 7.4 or higher
- WordPress 6.9 or higher (Abilities API is built into core — no separate plugin)
MCP Adapter is a WordPress plugin. Install and activate it:
wp plugin install https://github.com/WordPress/mcp-adapter/releases/latest/download/mcp-adapter.zip --activateOr download the latest release from GitHub and install it like any other plugin. See the Installation Guide for more options.
Create a WordPress ability that will be exposed via MCP:
// Register a simple ability to get site information
add_action( 'wp_abilities_api_init', function() {
wp_register_ability( 'my-plugin/get-site-info', [
'label' => 'Get Site Information',
'description' => 'Retrieves basic information about the current WordPress site',
'category' => 'site',
'input_schema' => [
'type' => 'object',
'properties' => [
'include_stats' => [
'type' => 'boolean',
'description' => 'Whether to include post/page statistics',
'default' => false
]
]
],
'execute_callback' => function( $input ) {
$result = [
'site_name' => get_bloginfo( 'name' ),
'site_url' => get_site_url(),
'description' => get_bloginfo( 'description' )
];
if ( $input['include_stats'] ?? false ) {
$result['stats'] = [
'post_count' => wp_count_posts( 'post' )->publish,
'page_count' => wp_count_posts( 'page' )->publish
];
}
return $result;
},
'permission_callback' => function() {
return current_user_can( 'read' );
}
]);
});The adapter creates a default server automatically, but you can create custom servers:
add_action( 'mcp_adapter_init', function( $adapter ) {
$adapter->create_server(
'my-first-server', // Unique server ID
'my-plugin', // REST API namespace
'mcp', // REST API route
'My First MCP Server', // Human-readable name
'A simple MCP server for demonstration', // Description
'1.0.0', // Version
array( \WP\MCP\Transport\HttpTransport::class ), // Transport methods
\WP\MCP\Infrastructure\ErrorHandling\ErrorLogMcpErrorHandler::class, // Error handler
null, // Observability handler (null = default)
array( 'my-plugin/get-site-info' ) // Abilities to expose as tools
);
});Test your MCP server:
Using WP-CLI (STDIO transport):
# List available tools
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | wp mcp-adapter serve --user=admin --server=mcp-adapter-default-server
# Execute the site info tool
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"my-plugin-get-site-info","arguments":{"include_stats":true}}}' | wp mcp-adapter serve --user=admin --server=mcp-adapter-default-serverUsing HTTP REST API:
# Test basic connectivity
curl "https://yoursite.com/wp-json/"
# Test MCP endpoint (requires authentication)
curl -X POST "https://yoursite.com/wp-json/mcp/mcp-adapter-default-server" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'- Installation Guide - Detailed installation options
- Creating Abilities - Build tools, resources, and prompts
- Architecture Overview - Understand system design
- Error Handling - Custom logging and monitoring
- Transport Permissions - Authentication and authorization
- CLI Usage - Command-line MCP server management
See the Common Issues guide.