agent-security-scanner-mcp 3.1.0 → 3.2.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/README.md +69 -1
- package/index.js +31 -2428
- package/package.json +5 -1
- package/src/analyzer.py +119 -0
- package/src/cli/demo.js +238 -0
- package/src/cli/doctor.js +273 -0
- package/src/cli/init.js +288 -0
- package/src/fix-patterns.js +698 -0
- package/src/tools/check-package.js +169 -0
- package/src/tools/fix-security.js +115 -0
- package/src/tools/scan-packages.js +154 -0
- package/src/tools/scan-prompt.js +570 -0
- package/src/tools/scan-security.js +117 -0
- package/src/utils.js +153 -0
package/README.md
CHANGED
|
@@ -64,12 +64,13 @@ Scan a file for security vulnerabilities. Use after writing or editing any code
|
|
|
64
64
|
|-----------|------|----------|-------------|
|
|
65
65
|
| `file_path` | string | Yes | Absolute or relative path to the code file to scan |
|
|
66
66
|
| `output_format` | string | No | `"json"` (default) or `"sarif"` for GitHub/GitLab Security tab integration |
|
|
67
|
+
| `verbosity` | string | No | `"minimal"` (counts only), `"compact"` (default, actionable info), `"full"` (complete metadata) |
|
|
67
68
|
|
|
68
69
|
**Example:**
|
|
69
70
|
|
|
70
71
|
```json
|
|
71
72
|
// Input
|
|
72
|
-
{ "file_path": "src/auth.js" }
|
|
73
|
+
{ "file_path": "src/auth.js", "verbosity": "compact" }
|
|
73
74
|
|
|
74
75
|
// Output
|
|
75
76
|
{
|
|
@@ -113,6 +114,7 @@ Automatically fix all security vulnerabilities in a file. Use after `scan_securi
|
|
|
113
114
|
| Parameter | Type | Required | Description |
|
|
114
115
|
|-----------|------|----------|-------------|
|
|
115
116
|
| `file_path` | string | Yes | Path to the file to fix |
|
|
117
|
+
| `verbosity` | string | No | `"minimal"` (summary only), `"compact"` (default, fix list), `"full"` (includes fixed_content) |
|
|
116
118
|
|
|
117
119
|
**Example:**
|
|
118
120
|
|
|
@@ -206,6 +208,7 @@ Scan a code file's imports to detect AI-hallucinated package names. Use after wr
|
|
|
206
208
|
|-----------|------|----------|-------------|
|
|
207
209
|
| `file_path` | string | Yes | Path to the code file or dependency manifest to scan |
|
|
208
210
|
| `ecosystem` | string | Yes | `npm`, `pypi`, `rubygems`, `crates`, `dart`, `perl`, `raku` |
|
|
211
|
+
| `verbosity` | string | No | `"minimal"` (counts only), `"compact"` (default, flagged packages), `"full"` (all details) |
|
|
209
212
|
|
|
210
213
|
**Example:**
|
|
211
214
|
|
|
@@ -238,6 +241,7 @@ Scan a prompt or instruction for malicious intent before executing it. Use when
|
|
|
238
241
|
|-----------|------|----------|-------------|
|
|
239
242
|
| `prompt_text` | string | Yes | The prompt or instruction text to analyze |
|
|
240
243
|
| `context` | object | No | `sensitivity_level`: `"high"`, `"medium"` (default), or `"low"` |
|
|
244
|
+
| `verbosity` | string | No | `"minimal"` (action only), `"compact"` (default, findings), `"full"` (audit details) |
|
|
241
245
|
|
|
242
246
|
**Example:**
|
|
243
247
|
|
|
@@ -526,8 +530,72 @@ Upload results to GitHub Advanced Security or GitLab SAST dashboard.
|
|
|
526
530
|
|
|
527
531
|
---
|
|
528
532
|
|
|
533
|
+
## Token Optimization
|
|
534
|
+
|
|
535
|
+
All MCP tools support a `verbosity` parameter to minimize context window consumption — critical for AI coding agents with limited context.
|
|
536
|
+
|
|
537
|
+
### Verbosity Levels
|
|
538
|
+
|
|
539
|
+
| Level | Tokens | Use Case |
|
|
540
|
+
|-------|--------|----------|
|
|
541
|
+
| `minimal` | ~50 | CI/CD pipelines, batch scans, quick pass/fail checks |
|
|
542
|
+
| `compact` | ~200 | Interactive development (default) |
|
|
543
|
+
| `full` | ~2,500 | Debugging, compliance reports, audit trails |
|
|
544
|
+
|
|
545
|
+
### Token Reduction by Tool
|
|
546
|
+
|
|
547
|
+
| Tool | minimal | compact | full |
|
|
548
|
+
|------|---------|---------|------|
|
|
549
|
+
| `scan_security` | 98% reduction | 69% reduction | baseline |
|
|
550
|
+
| `fix_security` | 91% reduction | 56% reduction | baseline |
|
|
551
|
+
| `scan_agent_prompt` | 83% reduction | 55% reduction | baseline |
|
|
552
|
+
| `scan_packages` | 75% reduction | 70% reduction | baseline |
|
|
553
|
+
|
|
554
|
+
### Example Usage
|
|
555
|
+
|
|
556
|
+
```json
|
|
557
|
+
// Minimal - just counts (~50 tokens)
|
|
558
|
+
{ "file_path": "app.py", "verbosity": "minimal" }
|
|
559
|
+
// Returns: { "total": 5, "critical": 2, "warning": 3, "message": "Found 5 issue(s)" }
|
|
560
|
+
|
|
561
|
+
// Compact - actionable info (~200 tokens, default)
|
|
562
|
+
{ "file_path": "app.py", "verbosity": "compact" }
|
|
563
|
+
// Returns: { "issues": [{ "line": 42, "ruleId": "...", "severity": "error", "fix": "..." }] }
|
|
564
|
+
|
|
565
|
+
// Full - complete metadata (~2,500 tokens)
|
|
566
|
+
{ "file_path": "app.py", "verbosity": "full" }
|
|
567
|
+
// Returns: { "issues": [{ ...all fields including CWE, OWASP, references }] }
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
### Recommended Verbosity by Scenario
|
|
571
|
+
|
|
572
|
+
| Scenario | Recommended | Why |
|
|
573
|
+
|----------|-------------|-----|
|
|
574
|
+
| CI/CD pipelines | `minimal` | Only need pass/fail counts |
|
|
575
|
+
| Batch scanning multiple files | `minimal` | Aggregate results, avoid context overflow |
|
|
576
|
+
| Interactive development | `compact` | Need line numbers and fix suggestions |
|
|
577
|
+
| Debugging false positives | `full` | Need CWE/OWASP references and metadata |
|
|
578
|
+
| Compliance documentation | `full` | Need complete audit trail |
|
|
579
|
+
|
|
580
|
+
### Impact on Multi-File Sessions
|
|
581
|
+
|
|
582
|
+
| Session Size | Without Verbosity | With `minimal` | Savings |
|
|
583
|
+
|--------------|-------------------|----------------|---------|
|
|
584
|
+
| 1 file | ~3,000 tokens | ~120 tokens | 96% |
|
|
585
|
+
| 10 files | ~30,000 tokens | ~1,200 tokens | 96% |
|
|
586
|
+
| 50 files | ~150,000 tokens | ~6,000 tokens | 96% |
|
|
587
|
+
|
|
588
|
+
> **Note:** Security analysis runs at full depth regardless of verbosity setting. Verbosity only affects output format, not detection capabilities.
|
|
589
|
+
|
|
590
|
+
---
|
|
591
|
+
|
|
529
592
|
## Changelog
|
|
530
593
|
|
|
594
|
+
### v3.2.0
|
|
595
|
+
- **Token Optimization** - New `verbosity` parameter for all tools reduces context window usage by up to 98%
|
|
596
|
+
- **Three Verbosity Levels** - `minimal` (~50 tokens), `compact` (~200 tokens, default), `full` (~2,500 tokens)
|
|
597
|
+
- **Batch Scanning Support** - Scan 50+ files without context overflow using `minimal` verbosity
|
|
598
|
+
|
|
531
599
|
### v3.1.0
|
|
532
600
|
- **Flask Taint Rules** - New taint rules for Flask SQL injection, command injection, path traversal, and template injection
|
|
533
601
|
- **Bug Fixes** - Fixed doctor/demo commands, init command no longer breaks JSON files with URLs
|