agent-security-scanner-mcp 1.5.0 → 2.0.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 CHANGED
@@ -2,15 +2,40 @@
2
2
 
3
3
  A powerful MCP (Model Context Protocol) server for real-time security vulnerability scanning. Integrates with Claude Desktop, Claude Code, OpenCode.ai, Kilo Code, and any MCP-compatible client to automatically detect and fix security issues as you code.
4
4
 
5
- [![npm version](https://img.shields.io/npm/v/agent-security-scanner-mcp)](https://www.npmjs.com/package/agent-security-scanner-mcp)
6
- [![Downloads](https://img.shields.io/npm/dm/agent-security-scanner-mcp)](https://www.npmjs.com/package/agent-security-scanner-mcp)
7
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ AI coding agents like **Claude Code**, **Cursor**, **Windsurf**, **Cline**, **Copilot**, and **Devin** are transforming software development. But they introduce attack surfaces that traditional security tools weren't designed to handle:
8
6
 
9
- **275+ Semgrep-aligned security rules** | **105 auto-fix templates** | **1M+ packages indexed** | **AI Agent prompt security**
7
+ - **Prompt Injection** Malicious instructions hidden in codebases hijack your AI agent
8
+ - **Package Hallucination** – AI invents package names that attackers register as malware
9
+ - **Data Exfiltration** – Compromised agents silently leak secrets to external servers
10
+ - **Backdoor Insertion** – Manipulated agents inject vulnerabilities into your code
10
11
 
11
- ---
12
+ **agent-security-scanner-mcp** is the first security scanner purpose-built for the agentic era. It protects AI coding agents in real-time via the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/).
13
+
14
+
15
+ **275+ Semgrep-aligned security rules | 105 auto-fix templates | 1M+ packages indexed | AI Agent prompt security**
16
+
17
+ ## What's New in v2.0.0
18
+
19
+ - **AST-based analysis** - tree-sitter powered parsing for 12 languages with higher accuracy
20
+ - **Taint analysis** - Track data flow from sources (user input) to sinks (dangerous functions)
21
+ - **Graceful fallback** - Works out-of-the-box with regex; enhanced detection when tree-sitter installed
22
+ - **Metavariable patterns** - Semgrep-style `$VAR` patterns for structural matching
23
+ - **Doctor command upgrade** - Now checks for AST engine availability
24
+
25
+ ### Enhanced Detection with tree-sitter (Optional)
26
+
27
+ For maximum detection accuracy, install the AST engine:
28
+
29
+ ```bash
30
+ pip install tree-sitter tree-sitter-python tree-sitter-javascript
31
+ ```
12
32
 
13
- ## What's New in v1.4.5
33
+ The scanner works without tree-sitter using regex-based detection, but AST analysis provides:
34
+ - Fewer false positives through structural understanding
35
+ - Taint tracking across function boundaries
36
+ - Language-aware pattern matching
37
+
38
+ ## What's New in v1.5.0
14
39
 
15
40
  - **92% smaller package** - Only 2.7 MB (down from 84 MB)
16
41
  - **6 ecosystems included** - PyPI, RubyGems, crates.io, pub.dev, CPAN, raku.land
@@ -33,8 +58,6 @@ A powerful MCP (Model Context Protocol) server for real-time security vulnerabil
33
58
  - **Terraform support** - AWS S3, IAM, RDS, security groups, CloudTrail
34
59
  - **Kubernetes support** - Privileged containers, RBAC, network policies, secrets
35
60
 
36
- ---
37
-
38
61
  ## Features
39
62
 
40
63
  - **Real-time scanning** - Detect vulnerabilities instantly as you write code
@@ -44,8 +67,6 @@ A powerful MCP (Model Context Protocol) server for real-time security vulnerabil
44
67
  - **CWE & OWASP mapped** - Every rule includes CWE and OWASP references
45
68
  - **Hallucination detection** - Detect AI-invented package names across 7 ecosystems (4.3M+ packages)
46
69
 
47
- ---
48
-
49
70
  ## Installation
50
71
 
51
72
  ### Default Package (Lightweight - 2.7 MB)
@@ -70,12 +91,26 @@ Or run directly with npx:
70
91
  npx agent-security-scanner-mcp
71
92
  ```
72
93
 
73
- ### Requirements
94
+ ## Requirements
74
95
 
75
96
  - Node.js >= 18.0.0
76
97
  - Python 3.x (for the analyzer engine)
77
-
78
- ---
98
+ - tree-sitter (optional, for enhanced AST-based detection)
99
+
100
+ ## Works With All Major AI Coding Tools
101
+
102
+ | Tool | Integration | Status |
103
+ |------|-------------|--------|
104
+ | **Claude Desktop** | Native MCP | ✅ Full Support |
105
+ | **Claude Code** | Native MCP | ✅ Full Support |
106
+ | **Cursor** | MCP Server | ✅ Full Support |
107
+ | **Windsurf** | MCP Server | ✅ Full Support |
108
+ | **Cline** | MCP Server | ✅ Full Support |
109
+ | **Kilo Code** | MCP Server | ✅ Full Support |
110
+ | **OpenCode** | MCP Server | ✅ Full Support |
111
+ | **Cody** | MCP Server | ✅ Full Support |
112
+ | **Zed** | MCP Server | ✅ Full Support |
113
+ | **Any MCP Client** | MCP Protocol | ✅ Compatible |
79
114
 
80
115
  ## Quick Start
81
116
 
@@ -90,13 +125,13 @@ npx agent-security-scanner-mcp init <client>
90
125
  **Examples:**
91
126
 
92
127
  ```bash
93
- npx agent-security-scanner-mcp init claude-desktop
94
- npx agent-security-scanner-mcp init claude-code
95
- npx agent-security-scanner-mcp init opencode
96
- npx agent-security-scanner-mcp init kilo-code
97
128
  npx agent-security-scanner-mcp init cursor
129
+ npx agent-security-scanner-mcp init claude-desktop
98
130
  npx agent-security-scanner-mcp init windsurf
99
131
  npx agent-security-scanner-mcp init cline
132
+ npx agent-security-scanner-mcp init claude-code
133
+ npx agent-security-scanner-mcp init kilo-code
134
+ npx agent-security-scanner-mcp init opencode
100
135
  npx agent-security-scanner-mcp init cody
101
136
  ```
102
137
 
@@ -116,7 +151,7 @@ The init command auto-detects your OS, locates the config file, creates a timest
116
151
  | `--yes`, `-y` | Skip prompts, use safe defaults |
117
152
  | `--force` | Overwrite existing entry if present |
118
153
  | `--path <file>` | Override the config file path |
119
- | `--name <key>` | Custom server key name (default: `security-scanner`) |
154
+ | `--name <key>` | Custom server key name (default: `agentic-security`) |
120
155
 
121
156
  **Advanced examples:**
122
157
 
@@ -131,19 +166,42 @@ npx agent-security-scanner-mcp init cline --force
131
166
  npx agent-security-scanner-mcp init claude-desktop --path ~/my-config.json --name my-scanner
132
167
  ```
133
168
 
134
- #### Safety
169
+ ### Diagnose Your Setup
135
170
 
136
- - Never deletes anything only adds or updates entries
137
- - Always creates a timestamped backup before modifying (e.g., `config.json.bak-20250204-143022`)
138
- - Stops with a clear error if the config file contains invalid JSON
139
- - Shows a diff and asks for confirmation if an existing entry differs
140
- - Supports `--dry-run` to inspect changes before applying
171
+ Check your environment and all client configurations:
141
172
 
142
- ---
173
+ ```bash
174
+ npx agent-security-scanner-mcp doctor
175
+ ```
176
+
177
+ Checks Node.js version, Python availability, analyzer engine, and scans all client configs for issues. Auto-fix trivial problems with `--fix`:
178
+
179
+ ```bash
180
+ npx agent-security-scanner-mcp doctor --fix
181
+ ```
182
+
183
+ ### Try It Now
184
+
185
+ Generate a vulnerable demo file and scan it instantly:
186
+
187
+ ```bash
188
+ npx agent-security-scanner-mcp demo
189
+ ```
190
+
191
+ Supports multiple languages:
192
+
193
+ ```bash
194
+ npx agent-security-scanner-mcp demo --lang js # JavaScript (default)
195
+ npx agent-security-scanner-mcp demo --lang py # Python
196
+ npx agent-security-scanner-mcp demo --lang go # Go
197
+ npx agent-security-scanner-mcp demo --lang java # Java
198
+ ```
199
+
200
+ Creates a small file with 3 intentional vulnerabilities, runs the scanner, shows findings with CWE/OWASP references, and asks if you want to keep the file for testing.
143
201
 
144
- ## Configuration
202
+ ---
145
203
 
146
- > **Tip:** Use `npx agent-security-scanner-mcp init <client>` for automatic setup instead of manual configuration below.
204
+ ## Manual Configuration
147
205
 
148
206
  ### Claude Desktop
149
207
 
@@ -161,7 +219,6 @@ Add to your `claude_desktop_config.json`:
161
219
  ```
162
220
 
163
221
  **Config file locations:**
164
-
165
222
  - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
166
223
  - Windows: `%APPDATA%\Claude\claude_desktop_config.json`
167
224
 
@@ -243,9 +300,7 @@ Or if installed globally:
243
300
  }
244
301
  ```
245
302
 
246
- ### Windows Users
247
-
248
- Use the cmd wrapper:
303
+ **Windows users** - Use cmd wrapper:
249
304
 
250
305
  ```json
251
306
  {
@@ -258,8 +313,6 @@ Use the cmd wrapper:
258
313
  }
259
314
  ```
260
315
 
261
- ---
262
-
263
316
  ## Available Tools
264
317
 
265
318
  ### `scan_security`
@@ -279,7 +332,6 @@ Returns:
279
332
  ```
280
333
 
281
334
  **Example output:**
282
-
283
335
  ```json
284
336
  {
285
337
  "file": "/path/to/file.js",
@@ -359,7 +411,6 @@ Returns:
359
411
  | NONE | 0-24 | ALLOW |
360
412
 
361
413
  **Example - Malicious prompt (BLOCKED):**
362
-
363
414
  ```json
364
415
  {
365
416
  "action": "BLOCK",
@@ -385,7 +436,6 @@ Returns:
385
436
  ```
386
437
 
387
438
  **Example - Safe prompt (ALLOWED):**
388
-
389
439
  ```json
390
440
  {
391
441
  "action": "ALLOW",
@@ -400,7 +450,7 @@ Returns:
400
450
  **Attack Categories Detected (56 rules):**
401
451
 
402
452
  | Category | Rules | Examples |
403
- |----------|-------|---------|
453
+ |----------|-------|----------|
404
454
  | Exfiltration | 10 | Send code to webhook, read .env files, push to external repo |
405
455
  | Malicious Injection | 11 | Add backdoor, create reverse shell, disable authentication |
406
456
  | System Manipulation | 9 | rm -rf /, modify /etc/passwd, add cron persistence |
@@ -417,7 +467,7 @@ Detect AI-hallucinated package names that don't exist in official registries. Pr
417
467
  **4,346,531 packages indexed across 7 ecosystems:**
418
468
 
419
469
  | Ecosystem | Packages | Registry | Source Dataset |
420
- |-----------|----------|----------|---------------|
470
+ |-----------|----------|----------|----------------|
421
471
  | npm | 3,329,177 | npmjs.com | garak-llm/npm-20241031 |
422
472
  | PyPI | 554,762 | pypi.org | garak-llm/pypi-20241031 |
423
473
  | RubyGems | 180,693 | rubygems.org | garak-llm/rubygems-20241031 |
@@ -443,7 +493,6 @@ Returns:
443
493
  ```
444
494
 
445
495
  **Example:**
446
-
447
496
  ```json
448
497
  {
449
498
  "package": "flutter_animations",
@@ -472,7 +521,6 @@ Returns:
472
521
  ```
473
522
 
474
523
  **Example output:**
475
-
476
524
  ```json
477
525
  {
478
526
  "file": "/path/to/main.dart",
@@ -482,7 +530,7 @@ Returns:
482
530
  "hallucinated_count": 1,
483
531
  "hallucinated_packages": ["fake_flutter_pkg"],
484
532
  "legitimate_packages": ["flutter", "http", "provider", "shared_preferences"],
485
- "recommendation": "Found 1 potentially hallucinated package(s): fake_flutter_pkg"
533
+ "recommendation": "⚠️ Found 1 potentially hallucinated package(s): fake_flutter_pkg"
486
534
  }
487
535
  ```
488
536
 
@@ -509,7 +557,7 @@ Show statistics about loaded package lists.
509
557
 
510
558
  Add your own package lists to `packages/` directory:
511
559
 
512
- ```
560
+ ```bash
513
561
  # Format: one package name per line
514
562
  packages/
515
563
  ├── npm.txt # 3,329,177 packages (JavaScript)
@@ -533,14 +581,14 @@ python scripts/fetch-garak-packages.py
533
581
  Package lists are sourced from [garak-llm](https://huggingface.co/garak-llm) Hugging Face datasets:
534
582
 
535
583
  | Ecosystem | Dataset | Snapshot Date |
536
- |-----------|---------|--------------|
537
- | npm | garak-llm/npm-20241031 | Oct 31, 2024 |
538
- | PyPI | garak-llm/pypi-20241031 | Oct 31, 2024 |
539
- | RubyGems | garak-llm/rubygems-20241031 | Oct 31, 2024 |
540
- | crates.io | garak-llm/crates-20250307 | Mar 7, 2025 |
541
- | Dart | garak-llm/dart-20250811 | Aug 11, 2025 |
542
- | Perl | garak-llm/perl-20250811 | Aug 11, 2025 |
543
- | Raku | garak-llm/raku-20250811 | Aug 11, 2025 |
584
+ |-----------|---------|---------------|
585
+ | npm | [garak-llm/npm-20241031](https://huggingface.co/datasets/garak-llm/npm-20241031) | Oct 31, 2024 |
586
+ | PyPI | [garak-llm/pypi-20241031](https://huggingface.co/datasets/garak-llm/pypi-20241031) | Oct 31, 2024 |
587
+ | RubyGems | [garak-llm/rubygems-20241031](https://huggingface.co/datasets/garak-llm/rubygems-20241031) | Oct 31, 2024 |
588
+ | crates.io | [garak-llm/crates-20250307](https://huggingface.co/datasets/garak-llm/crates-20250307) | Mar 7, 2025 |
589
+ | Dart | [garak-llm/dart-20250811](https://huggingface.co/datasets/garak-llm/dart-20250811) | Aug 11, 2025 |
590
+ | Perl | [garak-llm/perl-20250811](https://huggingface.co/datasets/garak-llm/perl-20250811) | Aug 11, 2025 |
591
+ | Raku | [garak-llm/raku-20250811](https://huggingface.co/datasets/garak-llm/raku-20250811) | Aug 11, 2025 |
544
592
 
545
593
  ---
546
594
 
@@ -549,41 +597,41 @@ Package lists are sourced from [garak-llm](https://huggingface.co/garak-llm) Hug
549
597
  ### By Language
550
598
 
551
599
  | Language | Rules | Categories |
552
- |----------|-------|-----------|
600
+ |----------|-------|------------|
553
601
  | JavaScript/TypeScript | 31 | XSS, injection, secrets, crypto |
554
602
  | Python | 36 | Injection, deserialization, crypto, XXE |
555
603
  | Java | 27 | Injection, XXE, crypto, deserialization |
556
604
  | Go | 22 | Injection, crypto, race conditions |
557
- | PHP | 25 | SQL injection, XSS, command injection, deserialization |
558
- | Ruby/Rails | 25 | Mass assignment, CSRF, eval, YAML deserialization |
559
- | C/C++ | 25 | Buffer overflow, format string, memory safety |
560
- | Terraform/K8s | 35 | AWS misconfig, IAM, privileged containers, RBAC |
605
+ | **PHP** | 25 | SQL injection, XSS, command injection, deserialization |
606
+ | **Ruby/Rails** | 25 | Mass assignment, CSRF, eval, YAML deserialization |
607
+ | **C/C++** | 25 | Buffer overflow, format string, memory safety |
608
+ | **Terraform/K8s** | 35 | AWS misconfig, IAM, privileged containers, RBAC |
561
609
  | Dockerfile | 18 | Secrets, permissions, best practices |
562
610
  | Generic (Secrets) | 31 | API keys, tokens, passwords |
563
611
 
564
612
  ### By Category
565
613
 
566
614
  | Category | Rules | Auto-Fix |
567
- |----------|-------|---------|
568
- | Injection (SQL, Command, XSS) | 55 | Yes |
569
- | Hardcoded Secrets | 50 | Yes |
570
- | Weak Cryptography | 25 | Yes |
571
- | Insecure Deserialization | 18 | Yes |
572
- | Memory Safety (C/C++) | 20 | Yes |
573
- | Infrastructure as Code | 35 | Yes |
574
- | Path Traversal | 10 | Yes |
575
- | SSRF | 8 | Yes |
576
- | XXE | 8 | Yes |
577
- | SSL/TLS Issues | 12 | Yes |
578
- | CSRF | 6 | Yes |
579
- | Other | 28 | Yes |
580
-
581
- ### Auto-Fix Templates (105 total)
615
+ |----------|-------|----------|
616
+ | **Injection (SQL, Command, XSS)** | 55 | Yes |
617
+ | **Hardcoded Secrets** | 50 | Yes |
618
+ | **Weak Cryptography** | 25 | Yes |
619
+ | **Insecure Deserialization** | 18 | Yes |
620
+ | **Memory Safety (C/C++)** | 20 | Yes |
621
+ | **Infrastructure as Code** | 35 | Yes |
622
+ | **Path Traversal** | 10 | Yes |
623
+ | **SSRF** | 8 | Yes |
624
+ | **XXE** | 8 | Yes |
625
+ | **SSL/TLS Issues** | 12 | Yes |
626
+ | **CSRF** | 6 | Yes |
627
+ | **Other** | 28 | Yes |
628
+
629
+ ## Auto-Fix Templates (105 total)
582
630
 
583
631
  Every detected vulnerability includes an automatic fix suggestion:
584
632
 
585
633
  | Vulnerability | Fix Strategy |
586
- |--------------|-------------|
634
+ |--------------|--------------|
587
635
  | SQL Injection | Parameterized queries with placeholders |
588
636
  | XSS (innerHTML) | Replace with `textContent` or DOMPurify |
589
637
  | Command Injection | Use `execFile()` / `spawn()` with `shell: false` |
@@ -595,8 +643,6 @@ Every detected vulnerability includes an automatic fix suggestion:
595
643
  | Eval/Exec | Remove or use safer alternatives |
596
644
  | CORS Wildcard | Specify allowed origins |
597
645
 
598
- ---
599
-
600
646
  ## Example Usage
601
647
 
602
648
  ### Scanning a file
@@ -604,7 +650,6 @@ Every detected vulnerability includes an automatic fix suggestion:
604
650
  Ask Claude: *"Scan my app.js file for security issues"*
605
651
 
606
652
  Claude will use `scan_security` and return:
607
-
608
653
  - All vulnerabilities found
609
654
  - Severity levels
610
655
  - CWE/OWASP references
@@ -615,17 +660,13 @@ Claude will use `scan_security` and return:
615
660
  Ask Claude: *"Fix all security issues in app.js"*
616
661
 
617
662
  Claude will use `fix_security` to:
618
-
619
663
  - Apply all available auto-fixes
620
664
  - Return the secured code
621
665
  - List all changes made
622
666
 
623
- ---
624
-
625
667
  ## Supported Vulnerabilities
626
668
 
627
669
  ### Injection
628
-
629
670
  - SQL Injection (multiple databases)
630
671
  - NoSQL Injection (MongoDB)
631
672
  - Command Injection (exec, spawn, subprocess)
@@ -635,7 +676,6 @@ Claude will use `fix_security` to:
635
676
  - Template Injection (Jinja2, SpEL)
636
677
 
637
678
  ### Secrets & Credentials
638
-
639
679
  - AWS Access Keys & Secret Keys
640
680
  - GitHub Tokens (PAT, OAuth, App)
641
681
  - Stripe API Keys
@@ -647,7 +687,6 @@ Claude will use `fix_security` to:
647
687
  - 25+ more token types
648
688
 
649
689
  ### Cryptography
650
-
651
690
  - Weak Hashing (MD5, SHA1)
652
691
  - Weak Ciphers (DES, RC4)
653
692
  - ECB Mode Usage
@@ -656,7 +695,6 @@ Claude will use `fix_security` to:
656
695
  - Weak TLS Versions
657
696
 
658
697
  ### Deserialization
659
-
660
698
  - Python pickle/marshal/shelve
661
699
  - YAML unsafe load
662
700
  - Java ObjectInputStream
@@ -664,7 +702,6 @@ Claude will use `fix_security` to:
664
702
  - Go gob decode
665
703
 
666
704
  ### Network & SSL
667
-
668
705
  - SSL Verification Disabled
669
706
  - Certificate Validation Bypass
670
707
  - SSRF Vulnerabilities
@@ -672,7 +709,6 @@ Claude will use `fix_security` to:
672
709
  - CORS Misconfiguration
673
710
 
674
711
  ### Memory Safety (C/C++)
675
-
676
712
  - Buffer Overflow (strcpy, strcat, sprintf, gets)
677
713
  - Format String Vulnerabilities
678
714
  - Use-After-Free
@@ -682,7 +718,6 @@ Claude will use `fix_security` to:
682
718
  - Unsafe temp files (mktemp, tmpnam)
683
719
 
684
720
  ### Infrastructure as Code
685
-
686
721
  - AWS S3 Public Access
687
722
  - Security Groups Open to World (SSH, RDP)
688
723
  - IAM Admin Policies (Action:*, Resource:*)
@@ -698,7 +733,6 @@ Claude will use `fix_security` to:
698
733
  - Cluster Admin Bindings
699
734
 
700
735
  ### Other
701
-
702
736
  - Path Traversal
703
737
  - XXE (XML External Entities)
704
738
  - CSRF Disabled
@@ -710,12 +744,6 @@ Claude will use `fix_security` to:
710
744
  - Mass Assignment (Rails)
711
745
  - Unsafe Eval/Constantize
712
746
 
713
- ---
714
-
715
- ## Contributing
716
-
717
- Contributions welcome! Please see our [GitHub repository](https://github.com/sinewaveai/agent-security-layer-fork).
718
-
719
747
  ### Adding New Rules
720
748
 
721
749
  Rules are defined in YAML format in the `rules/` directory:
@@ -732,22 +760,16 @@ Rules are defined in YAML format in the `rules/` directory:
732
760
  owasp: "Category"
733
761
  ```
734
762
 
735
- ---
736
-
737
- ## License
738
-
739
- MIT
763
+ ## Feedback & Support
740
764
 
741
- ---
765
+ We welcome your feedback!
742
766
 
743
- ## Links
767
+ - 🐛 **Bug Reports:** [Report issues](https://github.com/sinewaveai/agent-security-scanner-mcp/issues)
768
+ - 💡 **Feature Requests:** [Request features](https://github.com/sinewaveai/agent-security-scanner-mcp/issues)
769
+ - 💬 **Questions:** [Ask questions](https://github.com/sinewaveai/agent-security-scanner-mcp/issues)
744
770
 
745
- - **npm:** https://www.npmjs.com/package/agent-security-scanner-mcp
746
- - **GitHub:** https://github.com/sinewaveai/agent-security-layer-fork
747
- - **Issues:** https://github.com/sinewaveai/agent-security-layer-fork/issues
771
+ We actively monitor issues and prioritize based on community feedback.
748
772
 
749
- ---
750
-
751
- ## Keywords
773
+ ## License
752
774
 
753
- mcp, model-context-protocol, claude, opencode, kilocode, security, scanner, vulnerability, sast, code-analysis, sql-injection, xss, secrets-detection, hallucination-detection, package-verification, supply-chain-security, prompt-injection, agent-security, llm-security, ai-safety, claude-desktop, claude-code, mcp-server, cursor, cody, cline, windsurf, agentic, devin, owasp, cwe, semgrep
775
+ MIT