$site_url, 'authorization_endpoint' => $base_url . '/authorize', 'token_endpoint' => $base_url . '/oauth/token', 'revocation_endpoint' => $base_url . '/oauth/revoke', 'response_types_supported' => array( 'code' ), 'grant_types_supported' => array( 'authorization_code', 'client_credentials', 'refresh_token', ), 'code_challenge_methods_supported' => array( 'S256', 'plain' ), 'token_endpoint_auth_methods_supported' => array( 'client_secret_post', 'client_secret_basic', ), 'revocation_endpoint_auth_methods_supported' => array( 'client_secret_post', 'client_secret_basic', ), 'service_documentation' => ABILITIES_BRIDGE_PLUGIN_URL . 'docs/OAUTH2-IMPLEMENTATION-COMPLETE.md', ); // Add CORS headers for discovery. return rest_ensure_response( $metadata ); } /** * Handle MCP Discovery Request * * Returns MCP server metadata for Claude Desktop remote connector discovery. * This endpoint tells Claude Desktop where to find OAuth endpoints. * * @return WP_REST_Response MCP server metadata */ public static function handle_mcp_discovery() { // Add CORS headers for Claude Desktop. self::add_cors_headers(); $site_url = trailingslashit( get_site_url() ); $base_url = trailingslashit( rest_url( 'abilities-bridge-mcp/v1' ) ); $discovery = array( 'name' => 'Abilities Bridge', 'version' => ABILITIES_BRIDGE_VERSION, 'description' => 'WordPress MCP Server for Claude Desktop', 'vendor' => get_bloginfo( 'name' ), 'capabilities' => array( 'tools' => true, 'resources' => true, 'prompts' => true, ), 'experimental' => array( 'oauth' => array( 'authorizationEndpoint' => $base_url . 'authorize', 'tokenEndpoint' => $base_url . 'oauth/token', 'grantTypes' => array( 'authorization_code', 'refresh_token' ), 'pkceRequired' => true, 'scopesSupported' => array( 'claudeai', 'memory', 'abilities', 'admin' ), ), ), 'documentation' => ABILITIES_BRIDGE_PLUGIN_URL . 'README.md', ); return rest_ensure_response( $discovery ); } }