Automattic\WooCommerce\Internal\MCP

MCPAdapterProvider::initialize_mcp_adapterprivateWC 1.0

Initialize the MCP adapter.

Метод класса: MCPAdapterProvider{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// private - только в коде основоного (родительского) класса
$result = $this->initialize_mcp_adapter(): void;

Код MCPAdapterProvider::initialize_mcp_adapter() WC 11.0.1

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();
}