@papi-ai/server 0.7.8 → 0.7.10

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.
Files changed (2) hide show
  1. package/dist/index.js +14 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -22579,14 +22579,26 @@ If you already have an account, check that both **PAPI_PROJECT_ID** and **PAPI_D
22579
22579
  }
22580
22580
  if (httpToken) {
22581
22581
  const authHeader = req.headers["authorization"] ?? "";
22582
- const provided = authHeader.startsWith("Bearer ") ? authHeader.slice(7) : "";
22583
- if (provided !== httpToken) {
22582
+ const bearerMatch = authHeader.startsWith("Bearer ") ? authHeader.slice(7) : "";
22583
+ const urlMatch = req.url?.match(/^\/(mcp|sse)\/(.+)$/);
22584
+ const urlToken = urlMatch?.[2];
22585
+ if (bearerMatch === httpToken) {
22586
+ } else if (urlToken === httpToken) {
22587
+ req.url = `/${urlMatch[1]}`;
22588
+ } else {
22584
22589
  res.writeHead(401, { "Content-Type": "application/json" });
22585
22590
  res.end(JSON.stringify({ error: "Unauthorized" }));
22586
22591
  return;
22587
22592
  }
22588
22593
  }
22589
22594
  if (req.url === "/mcp" || req.url === "/sse") {
22595
+ req.headers["accept"] = "application/json, text/event-stream";
22596
+ const acceptIdx = req.rawHeaders.findIndex((h) => h.toLowerCase() === "accept");
22597
+ if (acceptIdx >= 0) {
22598
+ req.rawHeaders[acceptIdx + 1] = "application/json, text/event-stream";
22599
+ } else {
22600
+ req.rawHeaders.push("Accept", "application/json, text/event-stream");
22601
+ }
22590
22602
  if (req.method === "POST") {
22591
22603
  const chunks = [];
22592
22604
  req.on("data", (chunk) => chunks.push(chunk));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@papi-ai/server",
3
- "version": "0.7.8",
3
+ "version": "0.7.10",
4
4
  "description": "PAPI MCP server — AI-powered sprint planning, build execution, and strategy review for software projects",
5
5
  "license": "Elastic-2.0",
6
6
  "type": "module",