WORDPRESS_MCP_PATH . 'includes/', 'Firebase\\JWT\\' => WORDPRESS_MCP_PATH . 'vendor/firebase/php-jwt/src/', ); foreach ( $prefixes as $prefix => $base_dir ) { $length = strlen( $prefix ); if ( 0 !== strncmp( $prefix, $class_name, $length ) ) { continue; } $relative_class = substr( $class_name, $length ); $file = $base_dir . str_replace( '\\', '/', $relative_class ) . '.php'; if ( file_exists( $file ) ) { require_once $file; } } } ); if ( ! function_exists( 'WPMCP' ) ) { /** * Get the embedded WordPress MCP instance. * * @return \Rwpai\WordpressMcp\Core\WpMcp */ function WPMCP() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid return \Rwpai\WordpressMcp\Core\WpMcp::instance(); } } /** * Bootstrap embedded MCP services. * * @return void */ function rwpai_bootstrap_embedded_mcp() { static $bootstrapped = false; if ( $bootstrapped ) { return; } rwpai_ensure_mcp_settings(); $mcp = WPMCP(); new \Rwpai\WordpressMcp\Core\McpStdioTransport( $mcp ); new \Rwpai\WordpressMcp\Core\McpStreamableTransport( $mcp ); if ( function_exists( 'rwpai_register_mcp_auth_hooks' ) ) { rwpai_register_mcp_auth_hooks(); } if ( class_exists( '\WP_CLI' ) ) { \WP_CLI::add_command( 'mcp validate-tools', \Rwpai\WordpressMcp\Cli\ValidateToolsCommand::class ); // phpcs:ignore } $bootstrapped = true; } add_action( 'init', 'rwpai_bootstrap_embedded_mcp', 20 );