crukx-mcp 0.1.21 → 0.1.23
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/server.js +23 -5
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -15,7 +15,7 @@ import { z as z2 } from "zod";
|
|
|
15
15
|
// src/api/client.ts
|
|
16
16
|
import { z } from "zod";
|
|
17
17
|
import { randomUUID } from "crypto";
|
|
18
|
-
var TIMEOUT_MS =
|
|
18
|
+
var TIMEOUT_MS = 55e3;
|
|
19
19
|
var AuditResultSchema = z.object({
|
|
20
20
|
auditId: z.string(),
|
|
21
21
|
findings: z.array(z.object({
|
|
@@ -58,7 +58,8 @@ async function request(path, init = {}) {
|
|
|
58
58
|
...init,
|
|
59
59
|
signal: controller.signal,
|
|
60
60
|
headers: {
|
|
61
|
-
|
|
61
|
+
// Only set Content-Type for requests that have a body
|
|
62
|
+
...init.body ? { "Content-Type": "application/json" } : {},
|
|
62
63
|
Authorization: `Bearer ${token}`,
|
|
63
64
|
"X-Crukx-Source": "mcp",
|
|
64
65
|
...init.headers
|
|
@@ -99,12 +100,12 @@ path: ${params.repoPath ?? "."}`,
|
|
|
99
100
|
return AuditResultSchema.parse(initial);
|
|
100
101
|
}
|
|
101
102
|
const swarmId = initial.swarmId;
|
|
102
|
-
const deadline = Date.now() +
|
|
103
|
+
const deadline = Date.now() + 45e3;
|
|
103
104
|
const cfg = getConfig();
|
|
104
105
|
const baseUrl = auth?.api_url ?? cfg.CRUKX_API_URL;
|
|
105
106
|
const token = auth?.access_token ?? cfg.CRUKX_ACCESS_TOKEN;
|
|
106
107
|
while (Date.now() < deadline) {
|
|
107
|
-
await new Promise((r) => setTimeout(r,
|
|
108
|
+
await new Promise((r) => setTimeout(r, 1500));
|
|
108
109
|
const res = await fetch(`${baseUrl}/v1/audit/status/${swarmId}`, {
|
|
109
110
|
headers: { Authorization: `Bearer ${token}`, "X-Crukx-Source": "mcp" }
|
|
110
111
|
});
|
|
@@ -114,7 +115,24 @@ path: ${params.repoPath ?? "."}`,
|
|
|
114
115
|
return AuditResultSchema.parse(poll);
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
|
-
|
|
118
|
+
return AuditResultSchema.parse({
|
|
119
|
+
auditId: initial.auditId ?? "timeout",
|
|
120
|
+
swarmId,
|
|
121
|
+
status: "timeout",
|
|
122
|
+
findings: [],
|
|
123
|
+
summary: {
|
|
124
|
+
totalFindings: 0,
|
|
125
|
+
criticalCount: 0,
|
|
126
|
+
highCount: 0,
|
|
127
|
+
mediumCount: 0,
|
|
128
|
+
lowCount: 0,
|
|
129
|
+
infoCount: 0,
|
|
130
|
+
reliabilityScore: 0,
|
|
131
|
+
confidence: 0,
|
|
132
|
+
swarmConsensus: { agree: 0, total: 7 }
|
|
133
|
+
},
|
|
134
|
+
metadata: { processingTimeMs: 45e3, agentsUsed: [], swarmId }
|
|
135
|
+
});
|
|
118
136
|
}
|
|
119
137
|
async function fetchReport(reportId) {
|
|
120
138
|
return request(`/v1/mcp/reports/${reportId}`);
|