Ability to customize the .well-known/ directory contents #43050
-
|
I have built an authenticated MCP server based on a Supabase service, leveraging Supabase OAuth. I originally wanted to use Supabase Edge functions for that, but it turns out it's impossible. Since authenticated MCP servers use OAuth, the MCP client must be able to determine the authentication provider for the server by calling the .well-known path on the server. To my knowledge, it is not possible to customize the contents of that resource on a Supabase instance, so I was stuck. I ended up implementing the MCP server in a separate express server, hosted on a domain where I controlled the .well-known contents. This kinds of defeats the purpose of a backend as a service... Anyway, the MCP server is working but it's cumbersome to host (see https://marmelab.com/atomic-crm/doc/users/mcp-server/ for a demo of what I built). I wanted to know if there is a new or hidden way to customize the .well-known/ directory contents, or the Supabase team intends to support it in the near future? Because without OAuth, the ability to build an MCP server with Edge functions, explained in your documentation, cannot be used in production. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Hey @fzaninotto! We've been working on a solution to the exact problem you are facing called BYO-MCP (build your own MCP on Edge Functions). I agree that auth is the real power of building your own MCP on Supabase. Project level OAuth 2.1 servers was the first step to making this work and this is publicly available now. The second step is to wire this into an Edge Function so that it correctly handles oauth as described in the MCP spec. You are correct that If you're eager to try this out now, you can reference https://github.com/gregnr/edge-function-mcp-sandbox which manually implements the above auth logic (in mcp/index.ts). We're in the middle of building some lightweight SDKs to wrap this logic so that it's simpler to use, but if you need something working today this should be a good reference. Hope that helps but let me know if you had any other thoughts or questions about the implementation. We're hoping to have some official docs for this soon. |
Beta Was this translation helpful? Give feedback.
Hey @fzaninotto! We've been working on a solution to the exact problem you are facing called BYO-MCP (build your own MCP on Edge Functions). I agree that auth is the real power of building your own MCP on Supabase. Project level OAuth 2.1 servers was the first step to making this work and this is publicly available now. The second step is to wire this into an Edge Function so that it correctly handles oauth as described in the MCP spec.
You are correct that
.well-knownpaths cannot be customized on Supabase today, but our solution to this actually doesn't require.well-knownat all. MCP auth expects awww-authenticateheader in the HTTP response which tells the client where to find the pr…