MCP Adapter is distributed as a WordPress plugin and should be installed and activated like any other plugin.
Download the latest release from GitHub and install it like any other WordPress plugin, or use WP-CLI:
wp plugin install https://github.com/WordPress/mcp-adapter/releases/latest/download/mcp-adapter.zip --activateThe plugin automatically initializes and creates a default MCP server at /wp-json/mcp/mcp-adapter-default-server.
To include MCP Adapter in a wp-env environment, add it to the plugins array in .wp-env.json:
Plugin authors and developers may wish to rely on MCP Adapter as a dependency and ensure it is installed and activated by users relying on their plugin. You can do that in one of the following ways.
Important
Using MCP Adapter as a plugin dependency requires the plugin to be listed on the WordPress.org plugin directory, and is not currently supported. See #178 to track progress on plugin submission.
The best way to ensure that MCP Adapter is installed and activated is to include it as one of your Requires Plugins in your plugin header. For example:
<?php
/**
* Plugin Name: My MCP Plugin
* Description: Demonstrates MCP Adapter integration
* Version: 1.0.0
* Requires Plugins: mcp-adapter
*/While not recommended, there are some situations where you may want to bundle a copy of MCP Adapter with your plugin. In that case, you can add it as a Composer dependency:
composer require wordpress/mcp-adapterIf you are bundling MCP Adapter with your plugin, we suggest using Jetpack Autoloader as your autoloader or a dependency prefixer like Strauss to avoid conflicts with the MCP Adapter plugin or other legacy plugins that may be bundling their own copy of MCP Adapter.
To ensure that the MCP Adapter plugin is active and available, you should check for the existence of the WP\MCP\Core\McpAdapter class before using any MCP Adapter functionality. For example:
// The `plugins_loaded` hook ensures that all plugins are loaded before we check for MCP Adapter.
add_action( 'plugins_loaded', static function() {
if ( ! class_exists( 'WP\MCP\Core\McpAdapter' ) ) {
// Show an admin notice if MCP Adapter is not active.
add_action( 'admin_notices', static function() {
wp_display_notice(
__( 'MCP Adapter plugin is required for this plugin to function. Please install and activate it.', 'my-plugin-textdomain' ),
'error'
);
} );
return;
}
// If you reach this point, MCP Adapter is active and you can safely use its classes and functions.
$adapter = \WP\MCP\Core\McpAdapter::instance();
} );You can also check for specific plugin version using the WP_MCP_VERSION constant. For example,
if ( ! defined( 'WP_MCP_VERSION' ) || version_compare( WP_MCP_VERSION, '1.0.0', '<' ) ) {
// Show an admin notice if MCP Adapter is not active or does not meet the version requirement.
add_action( 'admin_notices', static function() {
wp_display_notice(
__( 'MCP Adapter plugin version 1.0.0 or higher is required for this plugin to function. Please update it.', 'my-plugin-textdomain' ),
'error'
);
} );
return;
}Once installation is complete:
- Follow Creating Abilities to build your MCP tools.
- Read Basic Examples to see how to use MCP Adapter in your plugin.
- Review Architecture Overview for system design.