@saiteja1123/mcp-server 1.1.3 → 1.1.4
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/package.json +2 -1
- package/src/index.js +3 -4
- package/src/rule-engine/index.js +1 -1
- package/src/rule-engine/localScan.js +2 -0
- package/src/server.js +62 -5
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saiteja1123/mcp-server",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"private": false,
|
|
5
|
+
"license": "MIT",
|
|
5
6
|
"description": "Vibesecur MCP security scanner - one-folder locking, cross-IDE, Cursor/VSCode/Windsurf",
|
|
6
7
|
"type": "module",
|
|
7
8
|
"main": "./src/index.js",
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Re-
|
|
3
|
-
*
|
|
4
|
-
* `@vibesecur/rule-engine` directly.
|
|
2
|
+
* Re-export bundled local rule engine for MCP tooling.
|
|
3
|
+
* This keeps the MCP package self-contained at runtime.
|
|
5
4
|
*/
|
|
6
|
-
export * from '
|
|
5
|
+
export * from './rule-engine/index.js';
|
package/src/rule-engine/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* rule-engine/index.js
|
|
3
3
|
* Bundled inline - no external @vibesecur/rule-engine dep needed.
|
|
4
|
-
* This allows `npx @
|
|
4
|
+
* This allows `npx @saiteja1123/mcp-server` to work standalone.
|
|
5
5
|
*/
|
|
6
6
|
export { JS_RULES, PY_RULES, CHECKLIST } from './rules.js';
|
|
7
7
|
export { localScan } from './localScan.js';
|
package/src/server.js
CHANGED
|
@@ -110,7 +110,11 @@ function humanRepoSummary(meta, agg) {
|
|
|
110
110
|
|
|
111
111
|
function flattenFindings(fileResults) {
|
|
112
112
|
return fileResults.flatMap((fr) =>
|
|
113
|
-
(fr.result.findings || []).map((f) => ({
|
|
113
|
+
(fr.result.findings || []).map((f) => ({
|
|
114
|
+
...f,
|
|
115
|
+
filePath: fr.filePath,
|
|
116
|
+
snippetPreview: f.snippetPreview || f.snippet || '',
|
|
117
|
+
})),
|
|
114
118
|
);
|
|
115
119
|
}
|
|
116
120
|
|
|
@@ -124,10 +128,11 @@ function pickTopFindings(fileResults, n) {
|
|
|
124
128
|
return flat.slice(0, n).map((f) => ({
|
|
125
129
|
filePath: f.filePath,
|
|
126
130
|
lineNumber: f.lineNumber,
|
|
131
|
+
endLineNumber: f.endLineNumber || f.lineNumber,
|
|
127
132
|
ruleId: f.ruleId,
|
|
128
133
|
ruleName: f.ruleName,
|
|
129
134
|
severity: f.severity,
|
|
130
|
-
snippetPreview: (f.
|
|
135
|
+
snippetPreview: (f.snippetPreview || '').slice(0, 120),
|
|
131
136
|
}));
|
|
132
137
|
}
|
|
133
138
|
|
|
@@ -284,6 +289,11 @@ server.registerTool('scanFile', {
|
|
|
284
289
|
result = localScan(code, useLang);
|
|
285
290
|
}
|
|
286
291
|
const findings = result.findings || [];
|
|
292
|
+
const findingsWithLocation = findings.map((f) => ({
|
|
293
|
+
...f,
|
|
294
|
+
filePath: resolvedPath,
|
|
295
|
+
snippetPreview: f.snippetPreview || f.snippet || '',
|
|
296
|
+
}));
|
|
287
297
|
const bySev = findings.reduce((a, f) => {
|
|
288
298
|
a[f.severity] = (a[f.severity] || 0) + 1;
|
|
289
299
|
return a;
|
|
@@ -295,10 +305,13 @@ server.registerTool('scanFile', {
|
|
|
295
305
|
lang: useLang,
|
|
296
306
|
score: result.score,
|
|
297
307
|
grade: result.grade,
|
|
298
|
-
findings:
|
|
308
|
+
findings: findingsWithLocation.length,
|
|
299
309
|
bySeverity: bySev,
|
|
300
310
|
checklist: result.checklist,
|
|
301
|
-
result
|
|
311
|
+
result: {
|
|
312
|
+
...result,
|
|
313
|
+
findings: findingsWithLocation,
|
|
314
|
+
},
|
|
302
315
|
};
|
|
303
316
|
return { content: [{ type: 'text', text: JSON.stringify(body, null, 2) }], structuredContent: body };
|
|
304
317
|
} catch (e) {
|
|
@@ -323,6 +336,17 @@ server.registerTool('scanRepo', {
|
|
|
323
336
|
await ensureDirectory(resolvedRoot);
|
|
324
337
|
const { matchedFiles, limitedFiles, fileResults, aggregate, topRiskFiles } =
|
|
325
338
|
await gatherRepoScan(resolvedRoot, includeGlobs, excludeGlobs, maxFiles);
|
|
339
|
+
const allFindings = flattenFindings(fileResults).map((f) => ({
|
|
340
|
+
filePath: f.filePath,
|
|
341
|
+
lineNumber: f.lineNumber,
|
|
342
|
+
endLineNumber: f.endLineNumber || f.lineNumber,
|
|
343
|
+
ruleId: f.ruleId,
|
|
344
|
+
ruleName: f.ruleName,
|
|
345
|
+
severity: f.severity,
|
|
346
|
+
category: f.category,
|
|
347
|
+
snippetPreview: (f.snippetPreview || '').slice(0, 120),
|
|
348
|
+
fix: f.fix,
|
|
349
|
+
}));
|
|
326
350
|
const meta = buildScanMeta(resolvedRoot, includeGlobs, excludeGlobs, maxFiles, matchedFiles.length, limitedFiles.length);
|
|
327
351
|
const body = {
|
|
328
352
|
meta,
|
|
@@ -334,6 +358,7 @@ server.registerTool('scanRepo', {
|
|
|
334
358
|
summary: aggregate.summary,
|
|
335
359
|
checklist: aggregate.checklist,
|
|
336
360
|
topRiskFiles,
|
|
361
|
+
allFindings,
|
|
337
362
|
};
|
|
338
363
|
return { content: [{ type: 'text', text: JSON.stringify(body, null, 2) }], structuredContent: { ...body, fileResults } };
|
|
339
364
|
} catch (e) {
|
|
@@ -350,8 +375,16 @@ server.registerTool('scanSummary', {
|
|
|
350
375
|
excludeGlobs: z.array(z.string()).default(DEFAULT_EXCLUDE),
|
|
351
376
|
maxFiles: z.number().int().min(1).max(5000).default(200),
|
|
352
377
|
topFindings: z.number().int().min(1).max(50).default(20),
|
|
378
|
+
maxFindings: z.number().int().min(20).max(500).default(200),
|
|
353
379
|
},
|
|
354
|
-
}, async ({
|
|
380
|
+
}, async ({
|
|
381
|
+
rootPath,
|
|
382
|
+
includeGlobs = DEFAULT_INCLUDE,
|
|
383
|
+
excludeGlobs = DEFAULT_EXCLUDE,
|
|
384
|
+
maxFiles = 200,
|
|
385
|
+
topFindings = 20,
|
|
386
|
+
maxFindings = 200,
|
|
387
|
+
}) => {
|
|
355
388
|
try {
|
|
356
389
|
const guard = await guardPath(rootPath);
|
|
357
390
|
if (!guard.ok) return guardError(guard);
|
|
@@ -361,12 +394,24 @@ server.registerTool('scanSummary', {
|
|
|
361
394
|
await gatherRepoScan(resolvedRoot, includeGlobs, excludeGlobs, maxFiles);
|
|
362
395
|
const meta = buildScanMeta(resolvedRoot, includeGlobs, excludeGlobs, maxFiles, matchedFiles.length, limitedFiles.length);
|
|
363
396
|
const top = pickTopFindings(fileResults, topFindings);
|
|
397
|
+
const allFindings = flattenFindings(fileResults).slice(0, maxFindings).map((f) => ({
|
|
398
|
+
filePath: f.filePath,
|
|
399
|
+
lineNumber: f.lineNumber,
|
|
400
|
+
endLineNumber: f.endLineNumber || f.lineNumber,
|
|
401
|
+
ruleId: f.ruleId,
|
|
402
|
+
ruleName: f.ruleName,
|
|
403
|
+
severity: f.severity,
|
|
404
|
+
category: f.category,
|
|
405
|
+
snippetPreview: (f.snippetPreview || '').slice(0, 120),
|
|
406
|
+
fix: f.fix,
|
|
407
|
+
}));
|
|
364
408
|
const payload = {
|
|
365
409
|
meta,
|
|
366
410
|
humanSummary: humanRepoSummary(meta, aggregate),
|
|
367
411
|
summary: aggregate.summary,
|
|
368
412
|
checklist: { passed: aggregate.checklist.filter((c) => c.pass).length, total: aggregate.checklist.length },
|
|
369
413
|
topFindings: top,
|
|
414
|
+
allFindings,
|
|
370
415
|
};
|
|
371
416
|
return { content: [{ type: 'text', text: JSON.stringify(payload, null, 2) }], structuredContent: payload };
|
|
372
417
|
} catch (e) {
|
|
@@ -396,6 +441,17 @@ server.registerTool('scanCurrentWorkspace', {
|
|
|
396
441
|
await ensureDirectory(guard.resolvedRoot);
|
|
397
442
|
const { matchedFiles, limitedFiles, fileResults, aggregate, topRiskFiles } =
|
|
398
443
|
await gatherRepoScan(guard.resolvedRoot, includeGlobs, excludeGlobs, maxFiles);
|
|
444
|
+
const allFindings = flattenFindings(fileResults).map((f) => ({
|
|
445
|
+
filePath: f.filePath,
|
|
446
|
+
lineNumber: f.lineNumber,
|
|
447
|
+
endLineNumber: f.endLineNumber || f.lineNumber,
|
|
448
|
+
ruleId: f.ruleId,
|
|
449
|
+
ruleName: f.ruleName,
|
|
450
|
+
severity: f.severity,
|
|
451
|
+
category: f.category,
|
|
452
|
+
snippetPreview: (f.snippetPreview || '').slice(0, 120),
|
|
453
|
+
fix: f.fix,
|
|
454
|
+
}));
|
|
399
455
|
const meta = buildScanMeta(guard.resolvedRoot, includeGlobs, excludeGlobs, maxFiles, matchedFiles.length, limitedFiles.length);
|
|
400
456
|
const body = {
|
|
401
457
|
meta,
|
|
@@ -407,6 +463,7 @@ server.registerTool('scanCurrentWorkspace', {
|
|
|
407
463
|
summary: aggregate.summary,
|
|
408
464
|
checklist: aggregate.checklist,
|
|
409
465
|
topRiskFiles,
|
|
466
|
+
allFindings,
|
|
410
467
|
};
|
|
411
468
|
return { content: [{ type: 'text', text: JSON.stringify(body, null, 2) }], structuredContent: { ...body, fileResults } };
|
|
412
469
|
} catch (e) {
|