perfai-cloud-mcp 0.1.0
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/LICENSE +21 -0
- package/README.md +243 -0
- package/dist/auth/oauthFlow.d.ts +23 -0
- package/dist/auth/oauthFlow.d.ts.map +1 -0
- package/dist/auth/oauthFlow.js +174 -0
- package/dist/auth/pkce.d.ts +11 -0
- package/dist/auth/pkce.d.ts.map +1 -0
- package/dist/auth/pkce.js +17 -0
- package/dist/auth/tokenValidator.d.ts +40 -0
- package/dist/auth/tokenValidator.d.ts.map +1 -0
- package/dist/auth/tokenValidator.js +117 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +387 -0
- package/dist/client/apiClient.d.ts +27 -0
- package/dist/client/apiClient.d.ts.map +1 -0
- package/dist/client/apiClient.js +81 -0
- package/dist/client/authManager.d.ts +42 -0
- package/dist/client/authManager.d.ts.map +1 -0
- package/dist/client/authManager.js +136 -0
- package/dist/client/errors.d.ts +10 -0
- package/dist/client/errors.d.ts.map +1 -0
- package/dist/client/errors.js +29 -0
- package/dist/client/types.d.ts +54 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +1 -0
- package/dist/config.d.ts +23 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +50 -0
- package/dist/env.d.ts +2 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +8 -0
- package/dist/log-guard.d.ts +2 -0
- package/dist/log-guard.d.ts.map +1 -0
- package/dist/log-guard.js +17 -0
- package/dist/server.d.ts +4 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +370 -0
- package/dist/tools/index.d.ts +352 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +39 -0
- package/dist/tools/protected/autoFix.d.ts +22 -0
- package/dist/tools/protected/autoFix.d.ts.map +1 -0
- package/dist/tools/protected/autoFix.js +64 -0
- package/dist/tools/protected/autoFixAll.d.ts +26 -0
- package/dist/tools/protected/autoFixAll.d.ts.map +1 -0
- package/dist/tools/protected/autoFixAll.js +79 -0
- package/dist/tools/protected/checkAppStatus.d.ts +21 -0
- package/dist/tools/protected/checkAppStatus.d.ts.map +1 -0
- package/dist/tools/protected/checkAppStatus.js +57 -0
- package/dist/tools/protected/checkTaskStatus.d.ts +21 -0
- package/dist/tools/protected/checkTaskStatus.d.ts.map +1 -0
- package/dist/tools/protected/checkTaskStatus.js +53 -0
- package/dist/tools/protected/getFixSummary.d.ts +17 -0
- package/dist/tools/protected/getFixSummary.d.ts.map +1 -0
- package/dist/tools/protected/getFixSummary.js +90 -0
- package/dist/tools/protected/getVulnerabilities.d.ts +29 -0
- package/dist/tools/protected/getVulnerabilities.d.ts.map +1 -0
- package/dist/tools/protected/getVulnerabilities.js +41 -0
- package/dist/tools/protected/listApps.d.ts +25 -0
- package/dist/tools/protected/listApps.d.ts.map +1 -0
- package/dist/tools/protected/listApps.js +32 -0
- package/dist/tools/protected/logout.d.ts +12 -0
- package/dist/tools/protected/logout.d.ts.map +1 -0
- package/dist/tools/protected/logout.js +9 -0
- package/dist/tools/protected/registerApp.d.ts +33 -0
- package/dist/tools/protected/registerApp.d.ts.map +1 -0
- package/dist/tools/protected/registerApp.js +96 -0
- package/dist/tools/protected/runSecurityTest.d.ts +17 -0
- package/dist/tools/protected/runSecurityTest.d.ts.map +1 -0
- package/dist/tools/protected/runSecurityTest.js +48 -0
- package/dist/tools/protected/selectApp.d.ts +18 -0
- package/dist/tools/protected/selectApp.d.ts.map +1 -0
- package/dist/tools/protected/selectApp.js +29 -0
- package/dist/tools/protected/submitAppCredentials.d.ts +22 -0
- package/dist/tools/protected/submitAppCredentials.d.ts.map +1 -0
- package/dist/tools/protected/submitAppCredentials.js +43 -0
- package/dist/tools/protected/suggestFix.d.ts +22 -0
- package/dist/tools/protected/suggestFix.d.ts.map +1 -0
- package/dist/tools/protected/suggestFix.js +37 -0
- package/dist/tools/protected/vulnerabilityActions.d.ts +62 -0
- package/dist/tools/protected/vulnerabilityActions.d.ts.map +1 -0
- package/dist/tools/protected/vulnerabilityActions.js +69 -0
- package/dist/tools/public/authStatus.d.ts +12 -0
- package/dist/tools/public/authStatus.d.ts.map +1 -0
- package/dist/tools/public/authStatus.js +13 -0
- package/dist/tools/public/login.d.ts +21 -0
- package/dist/tools/public/login.d.ts.map +1 -0
- package/dist/tools/public/login.js +305 -0
- package/dist/utils/formatters.d.ts +7 -0
- package/dist/utils/formatters.d.ts.map +1 -0
- package/dist/utils/formatters.js +47 -0
- package/dist/utils/poll.d.ts +19 -0
- package/dist/utils/poll.d.ts.map +1 -0
- package/dist/utils/poll.js +32 -0
- package/dist/utils/promptBuilder.d.ts +20 -0
- package/dist/utils/promptBuilder.d.ts.map +1 -0
- package/dist/utils/promptBuilder.js +131 -0
- package/package.json +55 -0
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { handleLogin } from "./public/login.js";
|
|
2
|
+
import { handleAuthStatus } from "./public/authStatus.js";
|
|
3
|
+
import { handleLogout } from "./protected/logout.js";
|
|
4
|
+
import { handleRegisterApp } from "./protected/registerApp.js";
|
|
5
|
+
import { handleCheckAppStatus } from "./protected/checkAppStatus.js";
|
|
6
|
+
import { handleListApps } from "./protected/listApps.js";
|
|
7
|
+
import { handleSelectApp } from "./protected/selectApp.js";
|
|
8
|
+
import { handleSubmitAppCredentials } from "./protected/submitAppCredentials.js";
|
|
9
|
+
import { handleRunSecurityTest } from "./protected/runSecurityTest.js";
|
|
10
|
+
import { handleCheckTaskStatus } from "./protected/checkTaskStatus.js";
|
|
11
|
+
import { handleGetVulnerabilities } from "./protected/getVulnerabilities.js";
|
|
12
|
+
import { handleSuggestFix } from "./protected/suggestFix.js";
|
|
13
|
+
import { handleAutoFix } from "./protected/autoFix.js";
|
|
14
|
+
import { handleAutoFixAll } from "./protected/autoFixAll.js";
|
|
15
|
+
import { handleGetFixSummary } from "./protected/getFixSummary.js";
|
|
16
|
+
import { handleDismissVulnerability, handleReopenVulnerability, handleMarkVulnerabilityFixed } from "./protected/vulnerabilityActions.js";
|
|
17
|
+
export declare const PUBLIC_TOOLS: {
|
|
18
|
+
readonly login: {
|
|
19
|
+
readonly name: "login";
|
|
20
|
+
readonly description: string;
|
|
21
|
+
readonly inputSchema: {
|
|
22
|
+
readonly type: "object";
|
|
23
|
+
readonly properties: {
|
|
24
|
+
readonly email: {
|
|
25
|
+
readonly type: "string";
|
|
26
|
+
readonly description: "PerfAI account email (optional)";
|
|
27
|
+
};
|
|
28
|
+
readonly password: {
|
|
29
|
+
readonly type: "string";
|
|
30
|
+
readonly description: "PerfAI account password (optional)";
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
readonly additionalProperties: false;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
readonly auth_status: {
|
|
37
|
+
readonly name: "auth_status";
|
|
38
|
+
readonly description: "🔎 Check whether the server currently holds a valid PerfAI session.";
|
|
39
|
+
readonly inputSchema: {
|
|
40
|
+
readonly type: "object";
|
|
41
|
+
readonly properties: {};
|
|
42
|
+
readonly additionalProperties: false;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export declare const PROTECTED_TOOLS: {
|
|
47
|
+
readonly logout: {
|
|
48
|
+
readonly name: "logout";
|
|
49
|
+
readonly description: "🚪 Clear the current PerfAI session and selected app/task state.";
|
|
50
|
+
readonly inputSchema: {
|
|
51
|
+
readonly type: "object";
|
|
52
|
+
readonly properties: {};
|
|
53
|
+
readonly additionalProperties: false;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
readonly register_app: {
|
|
57
|
+
readonly name: "register_app";
|
|
58
|
+
readonly description: string;
|
|
59
|
+
readonly inputSchema: {
|
|
60
|
+
readonly type: "object";
|
|
61
|
+
readonly properties: {
|
|
62
|
+
readonly appUrl: {
|
|
63
|
+
readonly type: "string";
|
|
64
|
+
readonly description: "Fully-qualified URL of the deployed app, e.g. https://app.example.com";
|
|
65
|
+
};
|
|
66
|
+
readonly createTestAccounts: {
|
|
67
|
+
readonly type: "boolean";
|
|
68
|
+
readonly description: "Let PerfAI auto sign-up test accounts during onboarding (default: true)";
|
|
69
|
+
};
|
|
70
|
+
readonly skipEndpoints: {
|
|
71
|
+
readonly type: "array";
|
|
72
|
+
readonly items: {
|
|
73
|
+
readonly type: "string";
|
|
74
|
+
};
|
|
75
|
+
readonly description: "Optional list of endpoints to exclude from onboarding";
|
|
76
|
+
};
|
|
77
|
+
readonly tenantOneCredentials: {
|
|
78
|
+
readonly type: "object";
|
|
79
|
+
readonly description: "Optional credentials to use instead of auto sign-up";
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
readonly required: readonly ["appUrl"];
|
|
83
|
+
readonly additionalProperties: false;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
readonly check_app_status: {
|
|
87
|
+
readonly name: "check_app_status";
|
|
88
|
+
readonly description: string;
|
|
89
|
+
readonly inputSchema: {
|
|
90
|
+
readonly type: "object";
|
|
91
|
+
readonly properties: {
|
|
92
|
+
readonly appId: {
|
|
93
|
+
readonly type: "string";
|
|
94
|
+
readonly description: "App ID (defaults to the most recently registered/selected app)";
|
|
95
|
+
};
|
|
96
|
+
readonly wait_seconds: {
|
|
97
|
+
readonly type: "number";
|
|
98
|
+
readonly description: "Max seconds to poll before returning current status (default 20, max 240)";
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
readonly additionalProperties: false;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
readonly list_apps: {
|
|
105
|
+
readonly name: "list_apps";
|
|
106
|
+
readonly description: "📋 List previously registered apps (GET /v1/apps). Supports search + pagination.";
|
|
107
|
+
readonly inputSchema: {
|
|
108
|
+
readonly type: "object";
|
|
109
|
+
readonly properties: {
|
|
110
|
+
readonly search: {
|
|
111
|
+
readonly type: "string";
|
|
112
|
+
readonly description: "Case-insensitive partial match on label/name";
|
|
113
|
+
};
|
|
114
|
+
readonly page: {
|
|
115
|
+
readonly type: "number";
|
|
116
|
+
readonly description: "Page number (default 1)";
|
|
117
|
+
};
|
|
118
|
+
readonly pageSize: {
|
|
119
|
+
readonly type: "number";
|
|
120
|
+
readonly description: "Results per page, 1-100 (default 20)";
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
readonly additionalProperties: false;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
readonly select_app: {
|
|
127
|
+
readonly name: "select_app";
|
|
128
|
+
readonly description: "🎯 Set the 'current app' for subsequent tools (run_security_test, get_vulnerabilities, etc.) by appId.";
|
|
129
|
+
readonly inputSchema: {
|
|
130
|
+
readonly type: "object";
|
|
131
|
+
readonly properties: {
|
|
132
|
+
readonly appId: {
|
|
133
|
+
readonly type: "string";
|
|
134
|
+
readonly description: "App ID, e.g. from list_apps";
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
readonly required: readonly ["appId"];
|
|
138
|
+
readonly additionalProperties: false;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
readonly submit_app_credentials: {
|
|
142
|
+
readonly name: "submit_app_credentials";
|
|
143
|
+
readonly description: string;
|
|
144
|
+
readonly inputSchema: {
|
|
145
|
+
readonly type: "object";
|
|
146
|
+
readonly properties: {
|
|
147
|
+
readonly appId: {
|
|
148
|
+
readonly type: "string";
|
|
149
|
+
readonly description: "App ID (defaults to the current app)";
|
|
150
|
+
};
|
|
151
|
+
readonly credentials: {
|
|
152
|
+
readonly type: "object";
|
|
153
|
+
readonly description: "Credential payload — shape depends on the app's login type (e.g. {\"username\":..., \"password\":...})";
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
readonly required: readonly ["credentials"];
|
|
157
|
+
readonly additionalProperties: false;
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
readonly run_security_test: {
|
|
161
|
+
readonly name: "run_security_test";
|
|
162
|
+
readonly description: string;
|
|
163
|
+
readonly inputSchema: {
|
|
164
|
+
readonly type: "object";
|
|
165
|
+
readonly properties: {
|
|
166
|
+
readonly appId: {
|
|
167
|
+
readonly type: "string";
|
|
168
|
+
readonly description: "App ID (defaults to the current app)";
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
readonly additionalProperties: false;
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
readonly check_task_status: {
|
|
175
|
+
readonly name: "check_task_status";
|
|
176
|
+
readonly description: string;
|
|
177
|
+
readonly inputSchema: {
|
|
178
|
+
readonly type: "object";
|
|
179
|
+
readonly properties: {
|
|
180
|
+
readonly taskId: {
|
|
181
|
+
readonly type: "string";
|
|
182
|
+
readonly description: "Task ID (defaults to the most recently started task)";
|
|
183
|
+
};
|
|
184
|
+
readonly wait_seconds: {
|
|
185
|
+
readonly type: "number";
|
|
186
|
+
readonly description: "Max seconds to poll before returning current status (default 20, max 240)";
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
readonly additionalProperties: false;
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
readonly get_vulnerabilities: {
|
|
193
|
+
readonly name: "get_vulnerabilities";
|
|
194
|
+
readonly description: string;
|
|
195
|
+
readonly inputSchema: {
|
|
196
|
+
readonly type: "object";
|
|
197
|
+
readonly properties: {
|
|
198
|
+
readonly appId: {
|
|
199
|
+
readonly type: "string";
|
|
200
|
+
readonly description: "App ID (defaults to the current app)";
|
|
201
|
+
};
|
|
202
|
+
readonly search: {
|
|
203
|
+
readonly type: "string";
|
|
204
|
+
readonly description: "Case-insensitive keyword search";
|
|
205
|
+
};
|
|
206
|
+
readonly page: {
|
|
207
|
+
readonly type: "number";
|
|
208
|
+
readonly description: "Page number (default 1)";
|
|
209
|
+
};
|
|
210
|
+
readonly pageSize: {
|
|
211
|
+
readonly type: "number";
|
|
212
|
+
readonly description: "Results per page, 1-100 (default 20)";
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
readonly additionalProperties: false;
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
readonly suggest_fix: {
|
|
219
|
+
readonly name: "suggest_fix";
|
|
220
|
+
readonly description: string;
|
|
221
|
+
readonly inputSchema: {
|
|
222
|
+
readonly type: "object";
|
|
223
|
+
readonly properties: {
|
|
224
|
+
readonly vulnerability_id: {
|
|
225
|
+
readonly type: "string";
|
|
226
|
+
readonly description: "Sequence number from get_vulnerabilities (e.g. '3') or raw vulnerability id";
|
|
227
|
+
};
|
|
228
|
+
readonly appId: {
|
|
229
|
+
readonly type: "string";
|
|
230
|
+
readonly description: "App ID (defaults to the current app)";
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
readonly required: readonly ["vulnerability_id"];
|
|
234
|
+
readonly additionalProperties: false;
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
readonly auto_fix: {
|
|
238
|
+
readonly name: "auto_fix";
|
|
239
|
+
readonly description: string;
|
|
240
|
+
readonly inputSchema: {
|
|
241
|
+
readonly type: "object";
|
|
242
|
+
readonly properties: {
|
|
243
|
+
readonly vulnerability_id: {
|
|
244
|
+
readonly type: "string";
|
|
245
|
+
readonly description: "Sequence number from get_vulnerabilities (e.g. '3') or raw vulnerability id";
|
|
246
|
+
};
|
|
247
|
+
readonly appId: {
|
|
248
|
+
readonly type: "string";
|
|
249
|
+
readonly description: "App ID (defaults to the current app)";
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
readonly required: readonly ["vulnerability_id"];
|
|
253
|
+
readonly additionalProperties: false;
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
readonly auto_fix_all: {
|
|
257
|
+
readonly name: "auto_fix_all";
|
|
258
|
+
readonly description: string;
|
|
259
|
+
readonly inputSchema: {
|
|
260
|
+
readonly type: "object";
|
|
261
|
+
readonly properties: {
|
|
262
|
+
readonly appId: {
|
|
263
|
+
readonly type: "string";
|
|
264
|
+
readonly description: "App ID (defaults to the current app)";
|
|
265
|
+
};
|
|
266
|
+
readonly severity: {
|
|
267
|
+
readonly type: "string";
|
|
268
|
+
readonly enum: readonly ["critical", "high", "medium", "low"];
|
|
269
|
+
readonly description: "Only fix vulnerabilities of this severity level";
|
|
270
|
+
};
|
|
271
|
+
readonly max_fixes: {
|
|
272
|
+
readonly type: "number";
|
|
273
|
+
readonly description: "Maximum number of fixes to include (default: all)";
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
readonly additionalProperties: false;
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
readonly get_fix_summary: {
|
|
280
|
+
readonly name: "get_fix_summary";
|
|
281
|
+
readonly description: string;
|
|
282
|
+
readonly inputSchema: {
|
|
283
|
+
readonly type: "object";
|
|
284
|
+
readonly properties: {
|
|
285
|
+
readonly appId: {
|
|
286
|
+
readonly type: "string";
|
|
287
|
+
readonly description: "App ID (defaults to the current app)";
|
|
288
|
+
};
|
|
289
|
+
};
|
|
290
|
+
readonly additionalProperties: false;
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
readonly dismiss_vulnerability: {
|
|
294
|
+
readonly name: "dismiss_vulnerability";
|
|
295
|
+
readonly description: "🙈 Dismiss a finding as a false positive / won't-fix (POST /v1/vulnerabilities/{id}/dismiss).";
|
|
296
|
+
readonly inputSchema: {
|
|
297
|
+
readonly type: "object";
|
|
298
|
+
readonly properties: {
|
|
299
|
+
readonly vulnerability_id: {
|
|
300
|
+
readonly type: "string";
|
|
301
|
+
readonly description: "Sequence number from get_vulnerabilities (e.g. '3') or raw vulnerability id";
|
|
302
|
+
};
|
|
303
|
+
readonly appId: {
|
|
304
|
+
readonly type: "string";
|
|
305
|
+
readonly description: "App ID (defaults to the current app)";
|
|
306
|
+
};
|
|
307
|
+
};
|
|
308
|
+
readonly required: readonly ["vulnerability_id"];
|
|
309
|
+
readonly additionalProperties: false;
|
|
310
|
+
};
|
|
311
|
+
};
|
|
312
|
+
readonly reopen_vulnerability: {
|
|
313
|
+
readonly name: "reopen_vulnerability";
|
|
314
|
+
readonly description: "🔁 Reopen a dismissed/fixed finding (POST /v1/vulnerabilities/{id}/reopen).";
|
|
315
|
+
readonly inputSchema: {
|
|
316
|
+
readonly type: "object";
|
|
317
|
+
readonly properties: {
|
|
318
|
+
readonly vulnerability_id: {
|
|
319
|
+
readonly type: "string";
|
|
320
|
+
readonly description: "Sequence number from get_vulnerabilities (e.g. '3') or raw vulnerability id";
|
|
321
|
+
};
|
|
322
|
+
readonly appId: {
|
|
323
|
+
readonly type: "string";
|
|
324
|
+
readonly description: "App ID (defaults to the current app)";
|
|
325
|
+
};
|
|
326
|
+
};
|
|
327
|
+
readonly required: readonly ["vulnerability_id"];
|
|
328
|
+
readonly additionalProperties: false;
|
|
329
|
+
};
|
|
330
|
+
};
|
|
331
|
+
readonly mark_vulnerability_fixed: {
|
|
332
|
+
readonly name: "mark_vulnerability_fixed";
|
|
333
|
+
readonly description: "✅ Mark a finding as fixed after applying the suggested fix (POST /v1/vulnerabilities/{id}/fix).";
|
|
334
|
+
readonly inputSchema: {
|
|
335
|
+
readonly type: "object";
|
|
336
|
+
readonly properties: {
|
|
337
|
+
readonly vulnerability_id: {
|
|
338
|
+
readonly type: "string";
|
|
339
|
+
readonly description: "Sequence number from get_vulnerabilities (e.g. '3') or raw vulnerability id";
|
|
340
|
+
};
|
|
341
|
+
readonly appId: {
|
|
342
|
+
readonly type: "string";
|
|
343
|
+
readonly description: "App ID (defaults to the current app)";
|
|
344
|
+
};
|
|
345
|
+
};
|
|
346
|
+
readonly required: readonly ["vulnerability_id"];
|
|
347
|
+
readonly additionalProperties: false;
|
|
348
|
+
};
|
|
349
|
+
};
|
|
350
|
+
};
|
|
351
|
+
export { handleLogin, handleAuthStatus, handleLogout, handleRegisterApp, handleCheckAppStatus, handleListApps, handleSelectApp, handleSubmitAppCredentials, handleRunSecurityTest, handleCheckTaskStatus, handleGetVulnerabilities, handleSuggestFix, handleAutoFix, handleAutoFixAll, handleGetFixSummary, handleDismissVulnerability, handleReopenVulnerability, handleMarkVulnerabilityFixed, };
|
|
352
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAkB,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1E,OAAO,EAAc,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAmB,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,EAAsB,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACzF,OAAO,EAAgB,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAiB,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC1E,OAAO,EAA4B,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAC3G,OAAO,EAAuB,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC5F,OAAO,EAAuB,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC5F,OAAO,EAA0B,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AACrG,OAAO,EAAkB,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EAAe,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EAAkB,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EAAqB,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACtF,OAAO,EAEL,0BAA0B,EAE1B,yBAAyB,EAEzB,4BAA4B,EAC7B,MAAM,qCAAqC,CAAC;AAE7C,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAGf,CAAC;AAEX,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiBlB,CAAC;AAEX,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,0BAA0B,EAC1B,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,0BAA0B,EAC1B,yBAAyB,EACzB,4BAA4B,GAC7B,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { loginTool, handleLogin } from "./public/login.js";
|
|
2
|
+
import { authStatusTool, handleAuthStatus } from "./public/authStatus.js";
|
|
3
|
+
import { logoutTool, handleLogout } from "./protected/logout.js";
|
|
4
|
+
import { registerAppTool, handleRegisterApp } from "./protected/registerApp.js";
|
|
5
|
+
import { checkAppStatusTool, handleCheckAppStatus } from "./protected/checkAppStatus.js";
|
|
6
|
+
import { listAppsTool, handleListApps } from "./protected/listApps.js";
|
|
7
|
+
import { selectAppTool, handleSelectApp } from "./protected/selectApp.js";
|
|
8
|
+
import { submitAppCredentialsTool, handleSubmitAppCredentials } from "./protected/submitAppCredentials.js";
|
|
9
|
+
import { runSecurityTestTool, handleRunSecurityTest } from "./protected/runSecurityTest.js";
|
|
10
|
+
import { checkTaskStatusTool, handleCheckTaskStatus } from "./protected/checkTaskStatus.js";
|
|
11
|
+
import { getVulnerabilitiesTool, handleGetVulnerabilities } from "./protected/getVulnerabilities.js";
|
|
12
|
+
import { suggestFixTool, handleSuggestFix } from "./protected/suggestFix.js";
|
|
13
|
+
import { autoFixTool, handleAutoFix } from "./protected/autoFix.js";
|
|
14
|
+
import { autoFixAllTool, handleAutoFixAll } from "./protected/autoFixAll.js";
|
|
15
|
+
import { getFixSummaryTool, handleGetFixSummary } from "./protected/getFixSummary.js";
|
|
16
|
+
import { dismissVulnerabilityTool, handleDismissVulnerability, reopenVulnerabilityTool, handleReopenVulnerability, markVulnerabilityFixedTool, handleMarkVulnerabilityFixed, } from "./protected/vulnerabilityActions.js";
|
|
17
|
+
export const PUBLIC_TOOLS = {
|
|
18
|
+
login: loginTool,
|
|
19
|
+
auth_status: authStatusTool,
|
|
20
|
+
};
|
|
21
|
+
export const PROTECTED_TOOLS = {
|
|
22
|
+
logout: logoutTool,
|
|
23
|
+
register_app: registerAppTool,
|
|
24
|
+
check_app_status: checkAppStatusTool,
|
|
25
|
+
list_apps: listAppsTool,
|
|
26
|
+
select_app: selectAppTool,
|
|
27
|
+
submit_app_credentials: submitAppCredentialsTool,
|
|
28
|
+
run_security_test: runSecurityTestTool,
|
|
29
|
+
check_task_status: checkTaskStatusTool,
|
|
30
|
+
get_vulnerabilities: getVulnerabilitiesTool,
|
|
31
|
+
suggest_fix: suggestFixTool,
|
|
32
|
+
auto_fix: autoFixTool,
|
|
33
|
+
auto_fix_all: autoFixAllTool,
|
|
34
|
+
get_fix_summary: getFixSummaryTool,
|
|
35
|
+
dismiss_vulnerability: dismissVulnerabilityTool,
|
|
36
|
+
reopen_vulnerability: reopenVulnerabilityTool,
|
|
37
|
+
mark_vulnerability_fixed: markVulnerabilityFixedTool,
|
|
38
|
+
};
|
|
39
|
+
export { handleLogin, handleAuthStatus, handleLogout, handleRegisterApp, handleCheckAppStatus, handleListApps, handleSelectApp, handleSubmitAppCredentials, handleRunSecurityTest, handleCheckTaskStatus, handleGetVulnerabilities, handleSuggestFix, handleAutoFix, handleAutoFixAll, handleGetFixSummary, handleDismissVulnerability, handleReopenVulnerability, handleMarkVulnerabilityFixed, };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AuthManager } from "../../client/authManager.js";
|
|
2
|
+
export declare const autoFixTool: {
|
|
3
|
+
readonly name: "auto_fix";
|
|
4
|
+
readonly description: string;
|
|
5
|
+
readonly inputSchema: {
|
|
6
|
+
readonly type: "object";
|
|
7
|
+
readonly properties: {
|
|
8
|
+
readonly vulnerability_id: {
|
|
9
|
+
readonly type: "string";
|
|
10
|
+
readonly description: "Sequence number from get_vulnerabilities (e.g. '3') or raw vulnerability id";
|
|
11
|
+
};
|
|
12
|
+
readonly appId: {
|
|
13
|
+
readonly type: "string";
|
|
14
|
+
readonly description: "App ID (defaults to the current app)";
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
readonly required: readonly ["vulnerability_id"];
|
|
18
|
+
readonly additionalProperties: false;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export declare function handleAutoFix(auth: AuthManager, args: any): Promise<any>;
|
|
22
|
+
//# sourceMappingURL=autoFix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autoFix.d.ts","sourceRoot":"","sources":["../../../src/tools/protected/autoFix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAG1D,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;CAsBd,CAAC;AAEX,wBAAsB,aAAa,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CA8C9E"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { buildAutoFixInstruction } from "../../utils/promptBuilder.js";
|
|
2
|
+
export const autoFixTool = {
|
|
3
|
+
name: "auto_fix",
|
|
4
|
+
description: "🔧 Auto-fix a single vulnerability. Returns structured, step-by-step fix instructions " +
|
|
5
|
+
"that you (the AI assistant) should execute immediately — locate the affected code, apply " +
|
|
6
|
+
"the fix, then call mark_vulnerability_fixed. Pass the sequence number from get_vulnerabilities " +
|
|
7
|
+
"(e.g. \"3\") or the raw vulnerability id.",
|
|
8
|
+
inputSchema: {
|
|
9
|
+
type: "object",
|
|
10
|
+
properties: {
|
|
11
|
+
vulnerability_id: {
|
|
12
|
+
type: "string",
|
|
13
|
+
description: "Sequence number from get_vulnerabilities (e.g. '3') or raw vulnerability id",
|
|
14
|
+
},
|
|
15
|
+
appId: {
|
|
16
|
+
type: "string",
|
|
17
|
+
description: "App ID (defaults to the current app)",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
required: ["vulnerability_id"],
|
|
21
|
+
additionalProperties: false,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
export async function handleAutoFix(auth, args) {
|
|
25
|
+
const appId = args?.appId ?? auth.currentAppId;
|
|
26
|
+
if (!appId) {
|
|
27
|
+
return {
|
|
28
|
+
content: [{ type: "text", text: "❌ No app selected. Run register_app or select_app first." }],
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
if (!args?.vulnerability_id) {
|
|
32
|
+
return {
|
|
33
|
+
content: [{ type: "text", text: "❌ vulnerability_id is required." }],
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
const vuln = auth.getCachedVulnerability(appId, args.vulnerability_id);
|
|
37
|
+
if (!vuln) {
|
|
38
|
+
return {
|
|
39
|
+
content: [
|
|
40
|
+
{
|
|
41
|
+
type: "text",
|
|
42
|
+
text: `❌ Could not find "${args.vulnerability_id}" in the last get_vulnerabilities listing ` +
|
|
43
|
+
`for this app. Run get_vulnerabilities first, then reference the # it shows.`,
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
if (vuln.isFixed) {
|
|
49
|
+
return {
|
|
50
|
+
content: [{ type: "text", text: `✅ Vulnerability #${args.vulnerability_id} is already marked as fixed.` }],
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
if (vuln.isDismissed) {
|
|
54
|
+
return {
|
|
55
|
+
content: [{ type: "text", text: `⏭️ Vulnerability #${args.vulnerability_id} is dismissed. Reopen it first if you want to fix it.` }],
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const seq = Number(args.vulnerability_id);
|
|
59
|
+
const sequence = Number.isInteger(seq) && seq > 0 ? seq : 1;
|
|
60
|
+
const appLabel = auth.currentAppUrl ?? appId;
|
|
61
|
+
return {
|
|
62
|
+
content: [{ type: "text", text: buildAutoFixInstruction(appLabel, vuln, sequence) }],
|
|
63
|
+
};
|
|
64
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AuthManager } from "../../client/authManager.js";
|
|
2
|
+
export declare const autoFixAllTool: {
|
|
3
|
+
readonly name: "auto_fix_all";
|
|
4
|
+
readonly description: string;
|
|
5
|
+
readonly inputSchema: {
|
|
6
|
+
readonly type: "object";
|
|
7
|
+
readonly properties: {
|
|
8
|
+
readonly appId: {
|
|
9
|
+
readonly type: "string";
|
|
10
|
+
readonly description: "App ID (defaults to the current app)";
|
|
11
|
+
};
|
|
12
|
+
readonly severity: {
|
|
13
|
+
readonly type: "string";
|
|
14
|
+
readonly enum: readonly ["critical", "high", "medium", "low"];
|
|
15
|
+
readonly description: "Only fix vulnerabilities of this severity level";
|
|
16
|
+
};
|
|
17
|
+
readonly max_fixes: {
|
|
18
|
+
readonly type: "number";
|
|
19
|
+
readonly description: "Maximum number of fixes to include (default: all)";
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
readonly additionalProperties: false;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare function handleAutoFixAll(auth: AuthManager, args: any): Promise<any>;
|
|
26
|
+
//# sourceMappingURL=autoFixAll.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autoFixAll.d.ts","sourceRoot":"","sources":["../../../src/tools/protected/autoFixAll.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAI1D,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;CA0BjB,CAAC;AAEX,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAyDjF"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { getVulnerabilities } from "../../client/apiClient.js";
|
|
2
|
+
import { buildBatchFixPlan } from "../../utils/promptBuilder.js";
|
|
3
|
+
export const autoFixAllTool = {
|
|
4
|
+
name: "auto_fix_all",
|
|
5
|
+
description: "🔧 Auto-fix ALL unfixed vulnerabilities for the current app. Fetches every vulnerability, " +
|
|
6
|
+
"builds a prioritized fix plan (critical → low), and returns structured step-by-step " +
|
|
7
|
+
"instructions for each. You (the AI assistant) should execute each fix in order, then call " +
|
|
8
|
+
"mark_vulnerability_fixed for each one after applying the code change.",
|
|
9
|
+
inputSchema: {
|
|
10
|
+
type: "object",
|
|
11
|
+
properties: {
|
|
12
|
+
appId: {
|
|
13
|
+
type: "string",
|
|
14
|
+
description: "App ID (defaults to the current app)",
|
|
15
|
+
},
|
|
16
|
+
severity: {
|
|
17
|
+
type: "string",
|
|
18
|
+
enum: ["critical", "high", "medium", "low"],
|
|
19
|
+
description: "Only fix vulnerabilities of this severity level",
|
|
20
|
+
},
|
|
21
|
+
max_fixes: {
|
|
22
|
+
type: "number",
|
|
23
|
+
description: "Maximum number of fixes to include (default: all)",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
additionalProperties: false,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
export async function handleAutoFixAll(auth, args) {
|
|
30
|
+
const appId = args?.appId ?? auth.currentAppId;
|
|
31
|
+
if (!appId) {
|
|
32
|
+
return {
|
|
33
|
+
content: [{ type: "text", text: "❌ No app selected. Run register_app or select_app first." }],
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
// Fetch all vulnerabilities (paginate through all pages)
|
|
38
|
+
let allVulnerabilities = [];
|
|
39
|
+
let page = 1;
|
|
40
|
+
const pageSize = 100;
|
|
41
|
+
while (true) {
|
|
42
|
+
const result = await getVulnerabilities(auth, appId, { page, pageSize });
|
|
43
|
+
allVulnerabilities = allVulnerabilities.concat(result.data);
|
|
44
|
+
if (allVulnerabilities.length >= result.total)
|
|
45
|
+
break;
|
|
46
|
+
page++;
|
|
47
|
+
}
|
|
48
|
+
// Cache them for mark_vulnerability_fixed calls later
|
|
49
|
+
auth.cacheVulnerabilities(appId, allVulnerabilities);
|
|
50
|
+
// Apply filters
|
|
51
|
+
let toFix = allVulnerabilities.filter(v => !v.isFixed && !v.isDismissed);
|
|
52
|
+
if (args?.severity) {
|
|
53
|
+
const target = args.severity.toLowerCase();
|
|
54
|
+
toFix = toFix.filter(v => (v.severity ?? "").toLowerCase() === target);
|
|
55
|
+
}
|
|
56
|
+
if (args?.max_fixes && args.max_fixes > 0) {
|
|
57
|
+
toFix = toFix.slice(0, args.max_fixes);
|
|
58
|
+
}
|
|
59
|
+
if (toFix.length === 0) {
|
|
60
|
+
const msg = args?.severity
|
|
61
|
+
? `✅ No unfixed ${args.severity} vulnerabilities found.`
|
|
62
|
+
: "✅ No unfixed vulnerabilities found. All issues are either fixed or dismissed.";
|
|
63
|
+
return { content: [{ type: "text", text: msg }] };
|
|
64
|
+
}
|
|
65
|
+
const appLabel = auth.currentAppUrl ?? appId;
|
|
66
|
+
const plan = buildBatchFixPlan(appLabel, toFix);
|
|
67
|
+
return { content: [{ type: "text", text: plan }] };
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
return {
|
|
71
|
+
content: [
|
|
72
|
+
{
|
|
73
|
+
type: "text",
|
|
74
|
+
text: `❌ Failed to fetch vulnerabilities: ${error instanceof Error ? error.message : String(error)}`,
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AuthManager } from "../../client/authManager.js";
|
|
2
|
+
export declare const checkAppStatusTool: {
|
|
3
|
+
readonly name: "check_app_status";
|
|
4
|
+
readonly description: string;
|
|
5
|
+
readonly inputSchema: {
|
|
6
|
+
readonly type: "object";
|
|
7
|
+
readonly properties: {
|
|
8
|
+
readonly appId: {
|
|
9
|
+
readonly type: "string";
|
|
10
|
+
readonly description: "App ID (defaults to the most recently registered/selected app)";
|
|
11
|
+
};
|
|
12
|
+
readonly wait_seconds: {
|
|
13
|
+
readonly type: "number";
|
|
14
|
+
readonly description: "Max seconds to poll before returning current status (default 20, max 240)";
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
readonly additionalProperties: false;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export declare function handleCheckAppStatus(auth: AuthManager, args: any): Promise<any>;
|
|
21
|
+
//# sourceMappingURL=checkAppStatus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkAppStatus.d.ts","sourceRoot":"","sources":["../../../src/tools/protected/checkAppStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAM1D,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;CAiBrB,CAAC;AAEX,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAuCrF"}
|