@sodiumhq/mcp-pm 0.1.0-beta.5669 → 0.1.0-beta.5826
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/http.js +4 -6
- package/package.json +1 -1
package/dist/http.js
CHANGED
|
@@ -197,10 +197,9 @@ function metadataUrl(config) {
|
|
|
197
197
|
const suffix = url.pathname === "/" ? "" : url.pathname;
|
|
198
198
|
return `${url.origin}/.well-known/oauth-protected-resource${suffix}`;
|
|
199
199
|
}
|
|
200
|
-
function buildChallenge(config
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
return parts.join(", ");
|
|
200
|
+
function buildChallenge(config) {
|
|
201
|
+
const scope = `${config.scopes.read} ${config.scopes.write}`;
|
|
202
|
+
return `Bearer resource_metadata="${metadataUrl(config)}", scope="${scope}"`;
|
|
204
203
|
}
|
|
205
204
|
const jwksCache = /* @__PURE__ */ new Map();
|
|
206
205
|
function getJwks(issuer) {
|
|
@@ -415,8 +414,7 @@ const httpServer = createServer((req, res) => {
|
|
|
415
414
|
console.error(`[sodium-pm-mcp-http] ${req.method} ${req.url} failed: ${message}`);
|
|
416
415
|
if (res.headersSent) return;
|
|
417
416
|
if (AUTH && error instanceof AuthError) {
|
|
418
|
-
|
|
419
|
-
res.setHeader("WWW-Authenticate", buildChallenge(AUTH, scope));
|
|
417
|
+
res.setHeader("WWW-Authenticate", buildChallenge(AUTH));
|
|
420
418
|
sendJsonError(res, error.status, message);
|
|
421
419
|
return;
|
|
422
420
|
}
|