File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -114,12 +114,18 @@ const handleMcpRequest = async (c: Context<{ Bindings: Bindings }>) => {
114114 const token = authHeader ?. replace ( / ^ B e a r e r \s + / i, "" )
115115 const containerTag = c . req . header ( "x-sm-project" )
116116 const apiUrl = c . env . API_URL || DEFAULT_API_URL
117-
118- const reqHost = c . req . header ( "x-forwarded-host" ) || c . req . header ( "host" ) || ""
119- const reqProto = c . req . header ( "x-forwarded-proto" ) || "https"
120- const resourceMetadataUrl = reqHost
121- ? `${ reqProto } ://${ reqHost } /.well-known/oauth-protected-resource`
122- : "/.well-known/oauth-protected-resource"
117+ const mcpURL =
118+ c . env . API_URL === "http://localhost:8787"
119+ ? "http://localhost:8788"
120+ : "https://mcp.supermemory.ai"
121+
122+ // TODO: commented out because this might be issue with auth
123+ //const reqHost = c.req.header("x-forwarded-host") || c.req.header("host") || ""
124+ //const reqProto = c.req.header("x-forwarded-proto") || "https"
125+ //const resourceMetadataUrl = reqHost
126+ // ? `${reqProto}://${reqHost}/.well-known/oauth-protected-resource`
127+ // : "/.well-known/oauth-protected-resource"
128+ const resourceMetadataUrl = `${ mcpURL } /.well-known/oauth-protected-resource`
123129
124130 if ( ! token ) {
125131 return new Response ( "Unauthorized" , {
You can’t perform that action at this time.
0 commit comments