© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•2mo ago•
7 replies
François

Building an MCP server in an edge function that uses OAuth

🤖AI Toolsauth
I'm trying to connect an agent (Claude Desktop) to an application I built with Supabase. I've added a simple edge function to act as a MCP server for Claude. I've served it under https (via ngrok) and registered it in Claude as a custom connector.
Claude calls my MCP server and initializes it properly (using the tools/list, initialize, notifications/initialized methods).
Then, when I ask Claude to use my tool, Claude calls my MCP server with a tools/call method. This is fine.
The problem comes after: I want the tolls calling to be authenticated. So my mcp server returns a 401 reponse with a Www-Authenticate header pointing to a second Edge function dedicated to the OAuth workflow. This is exactly what the MCP spec explains for authenticated apps.
However Claude never calls this endpoint and considers that the tool call is failed.
What am I missing?
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Server to server edge function
SupabaseSSupabase / help-and-questions
5mo ago
(solved) Edge Function that sends an HTTP request
SupabaseSSupabase / help-and-questions
4y ago
Edge Function that has subfolder?
SupabaseSSupabase / help-and-questions
5mo ago
EarlyDrop in edge function
SupabaseSSupabase / help-and-questions
7mo ago