mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-09-06 08:16:03 +00:00
fix: trying resource metadata failure for mcp auth
This commit is contained in:
parent
b8e5376b99
commit
82dbb573b1
1 changed files with 11 additions and 5 deletions
|
|
@ -114,12 +114,18 @@ const handleMcpRequest = async (c: Context<{ Bindings: Bindings }>) => {
|
|||
const token = authHeader?.replace(/^Bearer\s+/i, "")
|
||||
const containerTag = c.req.header("x-sm-project")
|
||||
const apiUrl = c.env.API_URL || DEFAULT_API_URL
|
||||
const mcpURL =
|
||||
c.env.API_URL === "http://localhost:8787"
|
||||
? "http://localhost:8788"
|
||||
: "https://mcp.supermemory.ai"
|
||||
|
||||
const reqHost = c.req.header("x-forwarded-host") || c.req.header("host") || ""
|
||||
const reqProto = c.req.header("x-forwarded-proto") || "https"
|
||||
const resourceMetadataUrl = reqHost
|
||||
? `${reqProto}://${reqHost}/.well-known/oauth-protected-resource`
|
||||
: "/.well-known/oauth-protected-resource"
|
||||
// TODO: commented out because this might be issue with auth
|
||||
//const reqHost = c.req.header("x-forwarded-host") || c.req.header("host") || ""
|
||||
//const reqProto = c.req.header("x-forwarded-proto") || "https"
|
||||
//const resourceMetadataUrl = reqHost
|
||||
// ? `${reqProto}://${reqHost}/.well-known/oauth-protected-resource`
|
||||
// : "/.well-known/oauth-protected-resource"
|
||||
const resourceMetadataUrl = `${mcpURL}/.well-known/oauth-protected-resource`
|
||||
|
||||
if (!token) {
|
||||
return new Response("Unauthorized", {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue