MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / resolveResourceUrl

Function resolveResourceUrl

mcp/src/http-server.ts:121–130  ·  view source on GitHub ↗
(req: Request)

Source from the content-addressed store, hash-verified

119 // 3. unset + Host missing/disallowed: caller wrapped function
120 // rejects with 421 before reaching here.
121 const resolveResourceUrl = (req: Request): string | null => {
122 if (opts.publicUrl) {
123 return opts.publicUrl.replace(/\/+$/, "");
124 }
125 const host = req.headers.host;
126 if (!host) return null;
127 const bare = host.split(":")[0]!.toLowerCase();
128 if (!allowedHosts.has(bare)) return null;
129 return `https://${host}`;
130 };
131
132 app.get("/.well-known/oauth-protected-resource", (req, res) => {
133 const resource = resolveResourceUrl(req);

Callers 1

buildAppFunction · 0.85

Calls 1

hasMethod · 0.80

Tested by

no test coverage detected