$issuer, 'authorization_endpoint' => rest_url('llamly/v1/oauth/authorize'), 'token_endpoint' => rest_url('llamly/v1/oauth/token'), 'registration_endpoint' => rest_url('llamly/v1/oauth/register'), 'revocation_endpoint' => rest_url('llamly/v1/oauth/revoke'), 'response_types_supported' => ['code'], 'grant_types_supported' => ['authorization_code', 'refresh_token'], 'token_endpoint_auth_methods_supported' => ['none'], 'code_challenge_methods_supported' => ['S256'], 'authorization_response_iss_parameter_supported' => true, 'scopes_supported' => ['llamly.read', 'llamly.write'], ]; } elseif ($type === 'protected-resource') { $metadata = [ 'resource' => untrailingslashit(rest_url('llamly/v1/endpoint')), 'authorization_servers' => [$issuer], 'bearer_methods_supported' => ['header'], 'scopes_supported' => ['llamly.read', 'llamly.write'], 'resource_name' => 'Llamly MCP endpoint', ]; } else { return; } nocache_headers(); header('Content-Type: application/json; charset=utf-8'); header('Cache-Control: public, max-age=300'); echo wp_json_encode($metadata, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); exit; } }