@lifeaitools/clauth 1.5.65 → 1.5.66

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.
@@ -3252,11 +3252,16 @@ function createServer(initPassword, whitelist, port, tunnelHostnameInit = null,
3252
3252
 
3253
3253
  // ── MCP SSE transport — /sse and namespaced paths ────
3254
3254
  // GET /sse|/gws|/clauth — open SSE stream, receive endpoint event
3255
- // Remote clients (claude.ai) use Streamable HTTP (POST only) return 404 on GET
3256
- // so claude.ai knows to POST directly rather than trying SSE transport.
3257
- if (method === "GET" && isMcpPath && req._clauthRemote) {
3258
- res.writeHead(404, { "Content-Type": "application/json", ...CORS });
3259
- return res.end(JSON.stringify({ error: "Use POST for Streamable HTTP transport" }));
3255
+ // Remote clients (claude.ai) arrive with a Bearer token via OAuth.
3256
+ // They use Streamable HTTP (POST only) return 405 on GET so claude.ai
3257
+ // knows to POST directly. Local clients have no Bearer token and use SSE.
3258
+ if (method === "GET" && isMcpPath) {
3259
+ const getAuthHeader = req.headers.authorization;
3260
+ const getToken = getAuthHeader?.startsWith("Bearer ") ? getAuthHeader.slice(7) : null;
3261
+ if (!noAuthHost && getToken && oauthTokens.has(getToken)) {
3262
+ res.writeHead(405, { "Content-Type": "application/json", "Allow": "POST", ...CORS });
3263
+ return res.end(JSON.stringify({ error: "Method Not Allowed", detail: "Use POST for Streamable HTTP transport" }));
3264
+ }
3260
3265
  }
3261
3266
  if (method === "GET" && (reqPath === "/sse" || isMcpPath)) {
3262
3267
  const sessionId = `ses_${++sseCounter}_${Date.now()}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifeaitools/clauth",
3
- "version": "1.5.65",
3
+ "version": "1.5.66",
4
4
  "description": "Hardware-bound credential vault for the LIFEAI infrastructure stack",
5
5
  "type": "module",
6
6
  "bin": {