Automattic\WooCommerce\Internal\MCP

MCPAdapterProvider::initialize_mcp_adapterprivateWC 1.0

Initialize the MCP adapter.

Method of the class: MCPAdapterProvider{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->initialize_mcp_adapter(): void;

MCPAdapterProvider::initialize_mcp_adapter() code WC 10.3.3

private function initialize_mcp_adapter(): void {
	// Check if MCP adapter class exists (should be autoloaded by WooCommerce's composer).
	if ( ! class_exists( 'WP\MCP\Core\McpAdapter' ) ) {
		if ( function_exists( 'wc_get_logger' ) ) {
			wc_get_logger()->warning(
				'MCP adapter class not found. Skipping MCP initialization.',
				array( 'source' => 'woocommerce-mcp' )
			);
		}
		return;
	}

	// Initialize the MCP adapter instance - this triggers the rest_api_init hook registration.
	\WP\MCP\Core\McpAdapter::instance();
}