Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

Expose WWW-Authenticate to browser MCP clients

Claude41956b1b056e
diff --git a/supabase/functions/mcp/index.ts b/supabase/functions/mcp/index.ts
index 12d83735..5ce369ae 100644
--- a/supabase/functions/mcp/index.ts
+++ b/supabase/functions/mcp/index.ts
@@ -461,7 +461,15 @@ Each task should include at least: id (required, used for the mark-as-done actio
Deno.serve(
pipeline(
[
- withCors({}),
+ // Browser-based MCP clients must read the WWW-Authenticate challenge
+ // to start OAuth discovery, and it is not a CORS-safelisted header.
+ withCors({
+ exposedHeaders: [
+ "WWW-Authenticate",
+ "Mcp-Session-Id",
+ "x-supabase-server-error",
+ ],
+ }),
withOAuthProtectedResource(),
withSupabase({ auth: "user" }),
withPostgresClient(),