security-mcp 1.1.0 → 1.1.1

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.
Files changed (56) hide show
  1. package/README.md +963 -193
  2. package/defaults/agent-run-schema.json +98 -0
  3. package/dist/cli/install.js +69 -2
  4. package/dist/cli/onboarding.js +4 -4
  5. package/dist/cli/update.js +83 -15
  6. package/dist/gate/checks/ai-redteam.js +83 -59
  7. package/dist/gate/checks/runtime.js +55 -2
  8. package/dist/gate/checks/scanners.js +6 -1
  9. package/dist/gate/exceptions.js +6 -1
  10. package/dist/mcp/orchestration.js +586 -0
  11. package/dist/mcp/server.js +69 -12
  12. package/dist/repo/search.js +5 -7
  13. package/dist/review/store.js +5 -0
  14. package/dist/types/agent-run.js +8 -0
  15. package/package.json +5 -5
  16. package/skills/agentic-loop-exploiter/SKILL.md +69 -0
  17. package/skills/ai-llm-redteam/SKILL.md +118 -0
  18. package/skills/algorithm-implementation-reviewer/SKILL.md +85 -0
  19. package/skills/android-penetration-tester/SKILL.md +83 -0
  20. package/skills/appsec-code-auditor/SKILL.md +86 -0
  21. package/skills/artifact-integrity-analyst/SKILL.md +68 -0
  22. package/skills/attack-navigator/SKILL.md +64 -0
  23. package/skills/auth-session-hacker/SKILL.md +87 -0
  24. package/skills/aws-penetration-tester/SKILL.md +60 -0
  25. package/skills/azure-penetration-tester/SKILL.md +64 -0
  26. package/skills/business-logic-attacker/SKILL.md +76 -0
  27. package/skills/cicd-pipeline-hijacker/SKILL.md +81 -0
  28. package/skills/ciso-orchestrator/SKILL.md +165 -0
  29. package/skills/cloud-infra-specialist/SKILL.md +85 -0
  30. package/skills/compliance-gap-analyst/SKILL.md +77 -0
  31. package/skills/compliance-grc/SKILL.md +148 -0
  32. package/skills/crypto-pki-specialist/SKILL.md +136 -0
  33. package/skills/dependency-confusion-attacker/SKILL.md +78 -0
  34. package/skills/evidence-collector/SKILL.md +86 -0
  35. package/skills/gcp-penetration-tester/SKILL.md +63 -0
  36. package/skills/injection-specialist/SKILL.md +62 -0
  37. package/skills/ios-security-auditor/SKILL.md +77 -0
  38. package/skills/k8s-container-escaper/SKILL.md +74 -0
  39. package/skills/key-management-lifecycle-analyst/SKILL.md +92 -0
  40. package/skills/logic-race-fuzzer/SKILL.md +67 -0
  41. package/skills/mobile-api-network-attacker/SKILL.md +81 -0
  42. package/skills/mobile-security-specialist/SKILL.md +124 -0
  43. package/skills/model-extraction-attacker/SKILL.md +68 -0
  44. package/skills/pentest-infra/SKILL.md +69 -0
  45. package/skills/pentest-social/SKILL.md +72 -0
  46. package/skills/pentest-team/SKILL.md +126 -0
  47. package/skills/pentest-web-api/SKILL.md +71 -0
  48. package/skills/privacy-flow-analyst/SKILL.md +70 -0
  49. package/skills/prompt-injection-specialist/SKILL.md +76 -0
  50. package/skills/rag-poisoning-specialist/SKILL.md +71 -0
  51. package/skills/senior-security-engineer/SKILL.md +42 -12
  52. package/skills/serialization-memory-attacker/SKILL.md +78 -0
  53. package/skills/stride-pasta-analyst/SKILL.md +72 -0
  54. package/skills/supply-chain-devsecops/SKILL.md +82 -0
  55. package/skills/threat-modeler/SKILL.md +116 -0
  56. package/skills/tls-certificate-auditor/SKILL.md +76 -0
package/README.md CHANGED
@@ -1,245 +1,244 @@
1
- # security-mcp -- Your AI's Built-In Security Expert
1
+ # security-mcp - AI Security Engineer for Claude Code, Cursor, Copilot & Codex
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/security-mcp.svg)](https://www.npmjs.com/package/security-mcp)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
5
5
  [![Node.js](https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg)](https://nodejs.org)
6
6
  [![CI](https://github.com/AbrahamOO/security-mcp/actions/workflows/security-gate.yml/badge.svg)](https://github.com/AbrahamOO/security-mcp/actions)
7
7
 
8
- **Stop shipping vulnerable code.** security-mcp gives your AI assistant the knowledge of a Senior Security Engineer who actively **finds and fixes** security issues in your code -- not just lists them.
8
+ **Stop shipping vulnerable code.**
9
9
 
10
- Works with Claude Code, GitHub Copilot, Cursor, Codex, Replit, and any MCP-compatible editor.
10
+ **security-mcp** is a [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server that gives your AI coding assistant the knowledge and tooling of a senior security engineer. Instead of just warning you about vulnerabilities, it **writes the secure code** - inline, immediately, every time.
11
+
12
+ Works with **Claude Code, GitHub Copilot, Cursor, Codex, Replit**, and any MCP-compatible editor.
13
+
14
+ > **One command to install. Zero security background required.**
11
15
 
12
16
  ---
13
17
 
14
- ## Who Is This For?
18
+ ## Table of Contents
19
+
20
+ - [What Problem Does This Solve?](#what-problem-does-this-solve)
21
+ - [Who Is This For?](#who-is-this-for)
22
+ - [Two Modes - Pick Your Depth](#two-modes--pick-your-depth)
23
+ - [Quick Start - Install in 60 Seconds](#quick-start--install-in-60-seconds)
24
+ - [Step-by-Step Installation Guide](#step-by-step-installation-guide)
25
+ - [Claude Code](#step-by-step-claude-code)
26
+ - [Cursor](#step-by-step-cursor)
27
+ - [VS Code / GitHub Copilot](#step-by-step-vs-code--github-copilot)
28
+ - [Manual Configuration](#manual-configuration-any-mcp-editor)
29
+ - [How to Run Your First Security Review](#how-to-run-your-first-security-review)
30
+ - [CI/CD Security Gate](#cicd-security-gate)
31
+ - [What Gets Fixed Automatically](#what-gets-fixed-automatically)
32
+ - [Architecture](#architecture)
33
+ - [MCP Tools Reference](#mcp-tools-reference)
34
+ - [Security Frameworks Applied](#security-frameworks-applied)
35
+ - [Configuration](#configuration)
36
+ - [Environment Variables](#environment-variables)
37
+ - [The 10 Rules That Are Never Broken](#the-10-rules-that-are-never-broken)
38
+ - [Troubleshooting](#troubleshooting)
39
+ - [FAQ](#faq)
40
+
41
+ ---
42
+
43
+ ## What Problem Does This Solve?
15
44
 
16
- You don't need a security background to use this. It's built for:
45
+ When you use an AI coding assistant to build features fast, security is easy to skip - not because you don't care, but because:
17
46
 
18
- - **Vibe coders** building fast and shipping faster -- who need security to just work
19
- - **Indie hackers and solo founders** who can't afford a dedicated security team
47
+ - Security is deep expertise that takes years to develop
48
+ - Most AI assistants write working code but don't enforce secure code
49
+ - Static analysis tools flag problems but don't fix them
50
+ - Hiring a security team or running a pentest is expensive and slow
51
+
52
+ **security-mcp closes that gap.** It integrates a security enforcement layer directly into your AI assistant. Every code change, every PR, every new feature gets reviewed against OWASP, MITRE ATT&CK, NIST, PCI DSS, and 16 other frameworks - and the AI writes the fix immediately.
53
+
54
+ **The result:** You ship faster AND more securely. No security background required.
55
+
56
+ ---
57
+
58
+ ## Who Is This For?
59
+
60
+ - **Vibe coders and solo founders** building fast who need security to just work without slowing them down
20
61
  - **Full-stack developers** who know their code works but aren't sure if it's safe
21
62
  - **Startups and small teams** shipping web apps, mobile apps, APIs, and SaaS products
22
- - **AI-assisted developers** using Claude Code, Copilot, Cursor, or Codex to write code
23
- - **Anyone who's ever shipped code and wondered "wait, is this secure?"**
24
-
25
- You write the code. Your AI + security-mcp enforces the security.
63
+ - **AI-assisted developers** using Claude Code, Copilot, Cursor, or Codex to write most of their code
64
+ - **Teams preparing for SOC 2, PCI DSS, or ISO 27001 audits** who need evidence and gap analysis
65
+ - **Security-conscious engineers** who want systematic coverage, not ad-hoc reviews
66
+ - **Anyone who's shipped code and thought "wait, is this actually secure?"**
26
67
 
27
68
  ---
28
69
 
29
- ## What It Fortifies
70
+ ## Two Modes - Pick Your Depth
30
71
 
31
- security-mcp actively hardens every surface of your software:
72
+ ### `/senior-security-engineer` - Your Daily Security Expert
32
73
 
33
- | Surface | What Gets Fortified |
34
- | --- | --- |
35
- | **Web Apps** | XSS, CSRF, injection attacks, insecure headers, authentication flaws, session bugs |
36
- | **APIs (REST, GraphQL, gRPC)** | Auth gaps, IDOR, rate limiting, input validation, CORS misconfigs, SSRF |
37
- | **Mobile Apps (iOS + Android)** | Insecure storage, certificate pinning, network security, reverse engineering exposure |
38
- | **Cloud Infrastructure (AWS, GCP, Azure)** | Open firewall rules, public buckets, wildcard IAM, missing encryption, exposed metadata |
39
- | **AI / LLMs** | Prompt injection, jailbreaks, RAG access control, output validation, data leakage |
40
- | **Code and Dependencies** | Hardcoded secrets, vulnerable packages, supply chain risks, insecure crypto |
41
- | **CI/CD Pipelines** | Secrets in logs, overprivileged deploy credentials, unvalidated artifacts |
74
+ A single elite security engineer agent that reviews your code, finds vulnerabilities, and writes the fix immediately. You choose the scope: just your recent changes, your whole codebase, or specific files and folders. It covers secrets, dependencies, cryptography, injection, authentication, web headers, cloud config, AI/LLM safety, mobile, and more - all in parallel. Every finding gets an inline code fix, not a suggestion. Finishes with a SHA-256 attested report you can keep as an audit trail.
75
+
76
+ **Use this on every PR. Use it before you push. Use it when something feels off.**
77
+
78
+ ### `/ciso-orchestrator` - A Full Security Program in One Command
79
+
80
+ 40 specialist agents running in parallel across 3 phases: threat modeling, deep code and infrastructure attack simulation, then compliance synthesis. Every domain gets its own specialist - a dedicated injection attacker, a JWT/OAuth hacker, a cloud privilege escalation analyst, a prompt injection specialist, a TLS auditor, a pentest team that reads the threat model as its attack brief, and a compliance analyst that maps every finding to PCI DSS 4.0, SOC 2, ISO 27001, NIST 800-53, HIPAA, and GDPR. Agents learn from each run and improve over time. Optionally fetches live CVE, CISA KEV, and ATT&CK data. Produces a merged findings report with full compliance mapping and a signed attestation.
81
+
82
+ **Use this before major releases, compliance audits, or security reviews. -> [See the full 40-agent architecture](#ciso-orchestrator-flow-40-agents)**
42
83
 
43
84
  ---
44
85
 
45
- ## Quick Start
86
+ | | `/senior-security-engineer` | `/ciso-orchestrator` |
87
+ | --- | --- | --- |
88
+ | **What it is** | Single expert agent | 40-agent parallel security program |
89
+ | **Best for** | Daily development, PR reviews, targeted hardening | Pre-launch audits, compliance prep, incident response |
90
+ | **Speed** | Seconds to minutes | Minutes to hours |
91
+ | **Scope** | You choose: recent changes, full codebase, or specific files | Always full - every surface, every framework |
92
+ | **Agents** | 1 | 40 (9 leads + 30 specialists) |
93
+ | **Output** | Inline code fixes + SHA-256 attestation | Full domain reports + merged findings + attestation |
94
+ | **API cost** | Low | High |
95
+ | **Internet** | Not required | Optional (enriches findings with live CVEs, CISA KEV, MITRE ATT&CK) |
46
96
 
47
- ```bash
48
- npx -y security-mcp@latest install
49
- ```
97
+ **Rule of thumb:** Use `/senior-security-engineer` on every PR. Use `/ciso-orchestrator` before major releases or compliance deadlines.
50
98
 
51
- That's it. The tool auto-detects your editor and writes the MCP config. Restart your editor -- done.
99
+ ---
52
100
 
53
- To target a specific editor:
101
+ ## Quick Start - Install in 60 Seconds
54
102
 
55
103
  ```bash
56
- npx -y security-mcp@latest install --claude-code
57
- npx -y security-mcp@latest install --cursor
58
- npx -y security-mcp@latest install --vscode
104
+ npx -y security-mcp@latest install
59
105
  ```
60
106
 
61
- Preview without writing anything:
107
+ Restart your editor. Then in Claude Code:
62
108
 
63
- ```bash
64
- npx -y security-mcp@latest install --dry-run
109
+ ```text
110
+ /senior-security-engineer
65
111
  ```
66
112
 
67
- ### Global Install
113
+ That's it. The engineer will ask how you want to scope the review, then find and fix security issues in your code.
68
114
 
69
- Install the package globally, then configure editors to call the global binary directly:
115
+ For a full 40-agent deep audit:
70
116
 
71
- ```bash
72
- npm install -g security-mcp@latest
73
- security-mcp install-global
117
+ ```text
118
+ /ciso-orchestrator
74
119
  ```
75
120
 
76
- Preview the global install flow without writing:
121
+ ---
77
122
 
78
- ```bash
79
- security-mcp install-global --dry-run
80
- ```
123
+ ## Step-by-Step Installation Guide
81
124
 
82
- ### Update Behavior
125
+ ### Step-by-Step: Claude Code
83
126
 
84
- - `npx -y security-mcp@latest ...` always runs the latest published npm version.
85
- - Global installs (`npm install -g security-mcp`) do not auto-upgrade by themselves.
86
- - The CLI now checks npm for new releases and prints an update prompt when a newer version is available.
127
+ **Prerequisite:** Node.js 20+ installed. Check with `node --version`.
87
128
 
88
- Global update command:
129
+ **Step 1 - Run the installer:**
89
130
 
90
131
  ```bash
91
- npm install -g security-mcp@latest
92
- security-mcp install-global
132
+ npx -y security-mcp@latest install --claude-code
93
133
  ```
94
134
 
95
- In **Claude Code**, activate the security engineer:
135
+ This writes the MCP server config to `~/.claude/settings.json`.
96
136
 
97
- ```text
98
- /senior-security-engineer
137
+ **Step 2 - Verify the config was written:**
138
+
139
+ ```bash
140
+ cat ~/.claude/settings.json
99
141
  ```
100
142
 
101
- Your AI will now **find and fix** security issues instead of just mentioning them.
143
+ You should see:
102
144
 
103
- ---
145
+ ```json
146
+ {
147
+ "mcpServers": {
148
+ "security-mcp": {
149
+ "command": "npx",
150
+ "args": ["-y", "security-mcp@latest", "serve"]
151
+ }
152
+ }
153
+ }
154
+ ```
104
155
 
105
- ## How It Works
156
+ **Step 3 - Restart Claude Code** to pick up the new MCP server.
106
157
 
107
- When you invoke `/senior-security-engineer` or call any security-mcp MCP tool, your AI shifts into the role of a Senior Security Engineer. It will:
158
+ **Step 4 - Verify the tools loaded.** In Claude Code, run:
108
159
 
109
- 1. **Ask scan scope first** -- folder-by-folder, file-by-file, or recent changes
110
- 2. **Start a review run** -- carry a `runId` for ordered execution and attestation
111
- 3. **Scan your code** for vulnerabilities, misconfigurations, and security anti-patterns
112
- 4. **Fix what it finds** -- not just flag it; it rewrites the insecure code with the secure version
113
- 5. **Enforce policies** -- set up input validation, auth middleware, security headers, and rate limiting
114
- 6. **Block dangerous patterns** -- refuse to implement code that introduces known vulnerabilities
115
- 7. **Produce an attestation** -- emit a confidence summary and integrity hash for the completed review
160
+ ```text
161
+ /mcp
162
+ ```
116
163
 
117
- ### MCP Tools (Your AI Uses These Automatically)
164
+ You should see `security-mcp` listed as a connected server with `security.*`, `orchestration.*`, and `repo.*` tools available.
118
165
 
119
- | Tool | What It Does |
120
- | --- | --- |
121
- | `security.start_review` | Starts a stateful review run and returns the `runId` used for ordered execution and attestation |
122
- | `security.get_system_prompt` | Loads the full security directive into your AI session -- activates the Senior Security Engineer mode |
123
- | `security.threat_model` | Generates a complete threat model for any feature before a single line of code is written |
124
- | `security.checklist` | Returns a hardened pre-ship checklist specific to your surface (web, API, mobile, AI, cloud) |
125
- | `security.scan_strategy` | Forces scan mode selection (`folder_by_folder`, `file_by_file`, `recent_changes`) and builds an exhaustive review plan |
126
- | `security.generate_policy` | Writes a `security-policy.json` for your project that the gate enforces on every PR |
127
- | `security.terraform_hardening_blueprint` | Produces an advanced Terraform hardening baseline (network, IAM, data, logging, CI controls) |
128
- | `security.generate_opa_rego` | Generates preventive OPA/Rego policies for Terraform plans, CI pipelines, and Kubernetes admission (requires explicit consent) |
129
- | `security.self_heal_loop` | Proposes self-healing improvements, but requires explicit human approval before any change |
130
- | `security.attest_review` | Writes an auditable review attestation with integrity hash and confidence summary |
131
- | `security.run_pr_gate` | Scans recent changes, selected folders, or selected files and **blocks merge** on CRITICAL/HIGH vulnerabilities; requires `runId` in MCP usage |
132
- | `repo.read_file` | Reads files from your workspace for analysis |
133
- | `repo.search` | Searches your codebase for vulnerable patterns |
134
-
135
- ### Security Gate (Blocks Bad Code from Shipping)
166
+ **Step 5 - Run your first security review:**
136
167
 
137
- ```bash
138
- npx -y security-mcp@latest ci:pr-gate
168
+ ```text
169
+ /senior-security-engineer
139
170
  ```
140
171
 
141
- Add this to your CI pipeline. It scans every PR and **blocks the merge** if it finds:
172
+ The agent will ask:
142
173
 
143
- - Hardcoded secrets or credentials
144
- - Known vulnerable dependencies (CRITICAL/HIGH CVEs)
145
- - Dangerous IaC patterns (open firewall rules, world-readable storage, wildcard IAM)
146
- - Auth gaps, SSRF, CSRF exposure
147
- - AI/LLM output that isn't properly bounded or validated
174
+ - **A) Recent changes** - scans only what changed since your last commit (fastest, use daily)
175
+ - **B) Full codebase** - scans everything (use for new projects or after major changes)
176
+ - **C) Specific files or folders** - scans exactly what you specify
177
+
178
+ Pick one and let it run.
148
179
 
149
180
  ---
150
181
 
151
- ## What Gets Fixed Automatically
182
+ ### Step-by-Step: Cursor
152
183
 
153
- When your AI has security-mcp active, it will **fix these automatically** -- not just warn about them:
184
+ **Step 1 - Run the installer:**
154
185
 
155
- ### Secrets and Authentication
186
+ ```bash
187
+ npx -y security-mcp@latest install --cursor
188
+ ```
156
189
 
157
- - Moves hardcoded secrets to environment variables / secret managers
158
- - Implements proper JWT validation (signature, expiry, issuer, audience)
159
- - Adds rate limiting and account lockout to auth endpoints
160
- - Enforces MFA requirements and session timeout policies
161
- - Implements Argon2id password hashing (not MD5, not SHA-1)
190
+ This writes to `~/.cursor/mcp.json`.
162
191
 
163
- ### Input Validation and Injection
192
+ **Step 2 - Verify:**
164
193
 
165
- - Adds server-side schema validation (Zod / Yup) to every API route
166
- - Blocks SQL injection, XSS, command injection, path traversal, SSRF
167
- - Sanitizes file uploads (validates magic bytes, strips filenames, scans for malware)
168
- - Normalizes and validates all user inputs with allowlist rules
194
+ ```bash
195
+ cat ~/.cursor/mcp.json
196
+ ```
169
197
 
170
- ### Network and Cloud
198
+ Expected output:
171
199
 
172
- - Removes `0.0.0.0/0` ingress rules and replaces with source-restricted rules
173
- - Locks down S3/GCS/Azure Blob buckets that are world-readable
174
- - Removes wildcard IAM permissions and replaces with least-privilege policies
175
- - Enforces TLS 1.3 and rejects weak cipher suites
200
+ ```json
201
+ {
202
+ "mcpServers": {
203
+ "security-mcp": {
204
+ "command": "npx",
205
+ "args": ["-y", "security-mcp@latest", "serve"]
206
+ }
207
+ }
208
+ }
209
+ ```
176
210
 
177
- ### Web Security
211
+ **Step 3 - Restart Cursor.**
178
212
 
179
- - Sets mandatory security headers (CSP, HSTS, X-Frame-Options, Permissions-Policy)
180
- - Removes inline JavaScript; enforces nonce-based CSP
181
- - Fixes CORS configurations that allow `*` on authenticated endpoints
182
- - Adds CSRF protection to all state-mutating endpoints
213
+ **Step 4 - Open Cursor's MCP panel** (Settings -> MCP) and confirm `security-mcp` shows as connected.
183
214
 
184
- ### AI / LLM Security
215
+ **Step 5 - In the Cursor AI chat, type:**
185
216
 
186
- - Separates user content from system prompts (prevents prompt injection)
187
- - Adds output schema validation so models can't return arbitrary dangerous content
188
- - Enforces access control on RAG document retrieval
189
- - Adds rate limiting specific to AI endpoints
217
+ ```text
218
+ Use /senior-security-engineer to review my recent changes
219
+ ```
190
220
 
191
221
  ---
192
222
 
193
- ## Supported Editors
223
+ ### Step-by-Step: VS Code / GitHub Copilot
194
224
 
195
- | Editor | Install Command | Config Location |
196
- | --- | --- | --- |
197
- | Claude Code | `npx -y security-mcp@latest install --claude-code` | `~/.claude/settings.json` |
198
- | Claude Code (global binary) | `security-mcp install-global --claude-code` | `~/.claude/settings.json` |
199
- | Cursor (global) | `npx -y security-mcp@latest install --cursor` | `~/.cursor/mcp.json` |
200
- | Cursor (global binary) | `security-mcp install-global --cursor` | `~/.cursor/mcp.json` |
201
- | Cursor (workspace) | `npx -y security-mcp@latest install --cursor` | `.cursor/mcp.json` |
202
- | VS Code | `npx -y security-mcp@latest install --vscode` | User `settings.json` |
203
- | VS Code (global binary) | `security-mcp install-global --vscode` | User `settings.json` |
204
- | GitHub Copilot | Manual config (see below) | `.vscode/settings.json` |
205
- | Codex | Manual config (see below) | Editor config |
206
- | Replit | Manual config (see below) | `.replit` config |
207
- | Any MCP-compatible | `npx -y security-mcp@latest config` or `security-mcp config --use-global-binary` | Paste into editor config |
225
+ **Step 1 - Run the installer:**
208
226
 
209
- ---
227
+ ```bash
228
+ npx -y security-mcp@latest install --vscode
229
+ ```
210
230
 
211
- ## Security Frameworks Applied (Automatically)
212
-
213
- You don't need to know what these are. They're the standards that the world's top security teams use.
214
- security-mcp applies all of them on your behalf:
215
-
216
- - OWASP Top 10 (Web + API) -- the most common attack patterns
217
- - OWASP ASVS Level 2/3 -- application security verification
218
- - OWASP MASVS -- mobile app security
219
- - OWASP Top 10 for LLMs -- AI-specific vulnerabilities
220
- - MITRE ATT&CK Enterprise, Cloud, and Mobile -- real attacker playbooks
221
- - MITRE D3FEND -- defensive countermeasures mapped to every attack
222
- - MITRE ATLAS -- adversarial ML/AI attack techniques
223
- - NIST 800-53 Rev 5 -- the US government's security control catalog
224
- - NIST 800-207 -- Zero Trust Architecture
225
- - NIST AI RMF -- AI risk management
226
- - PCI DSS 4.0 -- payment card security (if you handle payments)
227
- - SOC 2 Type II -- cloud service security (if you serve enterprise customers)
228
- - ISO 27001:2022 -- international security management standard
229
- - GDPR / CCPA / HIPAA -- data privacy compliance
230
- - SLSA Level 3 -- supply chain security
231
- - CIS Benchmarks Level 2 -- hardened configurations for cloud and containers
232
- - CVSS v4.0 + EPSS -- vulnerability scoring and exploit probability
231
+ This writes to your VS Code user `settings.json`.
233
232
 
234
- ---
233
+ **Step 2 - Verify in VS Code:**
235
234
 
236
- ## Manual Editor Configuration
235
+ Open Command Palette (`Cmd+Shift+P` / `Ctrl+Shift+P`) -> `Preferences: Open User Settings (JSON)`.
237
236
 
238
- ### Claude Code (`~/.claude/settings.json`)
237
+ You should see:
239
238
 
240
239
  ```json
241
240
  {
242
- "mcpServers": {
241
+ "mcp.servers": {
243
242
  "security-mcp": {
244
243
  "command": "npx",
245
244
  "args": ["-y", "security-mcp@latest", "serve"]
@@ -248,20 +247,42 @@ security-mcp applies all of them on your behalf:
248
247
  }
249
248
  ```
250
249
 
251
- ### Claude Code With Global Binary (`~/.claude/settings.json`)
250
+ **Step 3 - Restart VS Code.**
251
+
252
+ **Step 4 - In GitHub Copilot Chat, type:**
253
+
254
+ ```text
255
+ @security-mcp run /senior-security-engineer on recent changes
256
+ ```
257
+
258
+ ---
259
+
260
+ ### Manual Configuration (Any MCP Editor)
261
+
262
+ If the installer doesn't detect your editor, or you prefer to configure manually:
263
+
264
+ **Step 1 - Print the config snippet:**
265
+
266
+ ```bash
267
+ npx -y security-mcp@latest config
268
+ ```
269
+
270
+ **Step 2 - Copy the output** and paste it into your editor's MCP configuration file.
271
+
272
+ **Claude Code** (`~/.claude/settings.json`):
252
273
 
253
274
  ```json
254
275
  {
255
276
  "mcpServers": {
256
277
  "security-mcp": {
257
- "command": "security-mcp",
258
- "args": ["serve"]
278
+ "command": "npx",
279
+ "args": ["-y", "security-mcp@latest", "serve"]
259
280
  }
260
281
  }
261
282
  }
262
283
  ```
263
284
 
264
- ### Cursor (`~/.cursor/mcp.json` or `.cursor/mcp.json`)
285
+ **Cursor** (`~/.cursor/mcp.json`):
265
286
 
266
287
  ```json
267
288
  {
@@ -274,7 +295,7 @@ security-mcp applies all of them on your behalf:
274
295
  }
275
296
  ```
276
297
 
277
- ### VS Code / GitHub Copilot (`settings.json`)
298
+ **VS Code / GitHub Copilot** (`settings.json`):
278
299
 
279
300
  ```json
280
301
  {
@@ -287,34 +308,133 @@ security-mcp applies all of them on your behalf:
287
308
  }
288
309
  ```
289
310
 
290
- Print the config snippet for any editor:
311
+ **Windsurf / Codex / Replit** - use the same `command`/`args` format your editor supports for MCP servers.
312
+
313
+ **Step 3 - Restart your editor** after saving the config.
314
+
315
+ ---
316
+
317
+ ### Global Install (Optional)
318
+
319
+ If you want the `security-mcp` binary available system-wide without `npx`:
291
320
 
292
321
  ```bash
293
- npx -y security-mcp@latest config
294
- security-mcp config --use-global-binary
322
+ npm install -g security-mcp@latest
323
+ security-mcp install-global
324
+ ```
325
+
326
+ Then you can use:
327
+
328
+ ```bash
329
+ security-mcp install-global --claude-code
330
+ security-mcp install-global --cursor
331
+ security-mcp install-global --vscode
295
332
  ```
296
333
 
297
334
  ---
298
335
 
299
- ## Security Policy (CI/CD Gate)
336
+ ### Preview Without Writing Anything
300
337
 
301
- Copy the default policy into your project:
338
+ To see what the installer would do without making any changes:
302
339
 
303
340
  ```bash
304
- cp node_modules/security-mcp/defaults/security-policy.json .mcp/policies/security-policy.json
305
- cp node_modules/security-mcp/defaults/evidence-map.json .mcp/mappings/evidence-map.json
306
- cp node_modules/security-mcp/defaults/control-catalog.json .mcp/catalog/control-catalog.json
307
- cp node_modules/security-mcp/defaults/security-tools.json .mcp/scanners/security-tools.json
308
- cp node_modules/security-mcp/defaults/security-exceptions.json .mcp/exceptions/security-exceptions.json
341
+ npx -y security-mcp@latest install --dry-run
309
342
  ```
310
343
 
311
- Or generate one tailored to your project:
344
+ ---
345
+
346
+ ## How to Run Your First Security Review
347
+
348
+ ### Daily Workflow: `/senior-security-engineer`
349
+
350
+ **Step 1 - Open your project in your editor.**
351
+
352
+ **Step 2 - Invoke the skill:**
312
353
 
313
354
  ```text
314
- Ask your AI: "Run security.generate_policy with surfaces=[web, api, ai] and cloud=aws"
355
+ /senior-security-engineer
315
356
  ```
316
357
 
317
- Add the gate to GitHub Actions:
358
+ **Step 3 - Choose your scan scope when prompted:**
359
+
360
+ - **Recent changes** - scans only files modified since your last commit. Use this on every PR.
361
+ - **Full codebase** - scans all source files. Use when onboarding a new project.
362
+ - **Specific folders** - you name the folders. Use when you know the blast radius.
363
+
364
+ **Step 4 - Watch it work.** The agent will:
365
+
366
+ 1. Call `security.start_review` to create a tracked run
367
+ 2. Build a scan plan covering all relevant OWASP/NIST/ATT&CK controls
368
+ 3. Run 18 security checks in parallel across secrets, dependencies, crypto, auth, injection, cloud config, AI/LLM, mobile, and more
369
+ 4. Write fixes directly into your code for every finding it can remediate
370
+ 5. Generate a SHA-256 attested report at `.mcp/reports/{runId}.attestation.json`
371
+
372
+ **Step 5 - Review the output.** Each finding shows:
373
+
374
+ - What the vulnerability is and why it matters
375
+ - Which attack it enables (mapped to MITRE ATT&CK and CWE)
376
+ - The exact fix that was applied to your code
377
+
378
+ **Step 6 - Commit with confidence.** The attestation file is your audit trail.
379
+
380
+ ---
381
+
382
+ ### Deep Audit: `/ciso-orchestrator`
383
+
384
+ Use this before a major release, compliance deadline, or security review.
385
+
386
+ **Step 1 - Invoke:**
387
+
388
+ ```text
389
+ /ciso-orchestrator
390
+ ```
391
+
392
+ **Step 2 - Answer the internet permission prompt.**
393
+
394
+ The orchestrator will ask:
395
+
396
+ > "I can fetch live CVE data, CISA KEV, and MITRE ATT&CK updates to improve this analysis. Allow internet access for this run? (yes/no)"
397
+
398
+ - **Yes** - agents enrich findings with live threat intelligence. More accurate, more current.
399
+ - **No** - agents use cached intel. Still comprehensive, no external calls made.
400
+
401
+ **Step 3 - Wait for Phase 1 (7 lead agents + 30 sub-agents, all parallel).**
402
+
403
+ Each agent writes findings to `.mcp/agent-runs/{agentRunId}/`.
404
+
405
+ **Step 4 - Wait for Phase 2 (pentest team + compliance synthesizer).**
406
+
407
+ The pentest team reads Phase 1's threat model as its attack brief. The compliance agent maps every finding to PCI DSS 4.0, SOC 2, ISO 27001, NIST 800-53, HIPAA, and GDPR controls.
408
+
409
+ **Step 5 - Review the merged report.**
410
+
411
+ The orchestrator presents:
412
+
413
+ ```text
414
+ Agents: 9 leads completed (+ sub-agents)
415
+ Findings: X CRITICAL / X HIGH / X MEDIUM / X LOW
416
+ Remediated inline: X
417
+ Open (need your decision): X
418
+ SKILL.md coverage: XX% (§1-§24)
419
+ Release blocked: yes / no
420
+ Attestation: .mcp/reports/{runId}.attestation.json
421
+ ```
422
+
423
+ **Step 6 - For any open findings**, follow the required actions in the report. The agent will help you implement each fix.
424
+
425
+ ---
426
+
427
+ ## CI/CD Security Gate
428
+
429
+ Block insecure code from merging on every pull request - no Claude session required, pure Node.js execution:
430
+
431
+ ```bash
432
+ npx -y security-mcp ci:pr-gate
433
+ ```
434
+
435
+ ### Add to GitHub Actions
436
+
437
+ Create `.github/workflows/security-gate.yml`:
318
438
 
319
439
  ```yaml
320
440
  name: Security Gate
@@ -329,7 +449,7 @@ jobs:
329
449
  steps:
330
450
  - uses: actions/checkout@v4
331
451
  with:
332
- fetch-depth: 0
452
+ fetch-depth: 0 # required for git diff to work
333
453
 
334
454
  - uses: actions/setup-node@v4
335
455
  with:
@@ -341,32 +461,682 @@ jobs:
341
461
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
342
462
  ```
343
463
 
464
+ ### What the CI Gate Checks
465
+
466
+ The gate runs **18 checks in parallel** against your diff:
467
+
468
+ | Category | What It Catches |
469
+ | --- | --- |
470
+ | **Secrets** | Hardcoded API keys, tokens, passwords, private keys (via Gitleaks patterns) |
471
+ | **Dependencies** | CRITICAL/HIGH CVEs in npm/pip/go/maven packages; CISA Known Exploited Vulnerabilities |
472
+ | **Cryptography** | MD5, SHA-1, DES, RC4, ECB mode, `Math.random()` for tokens, short JWT secrets |
473
+ | **Authentication** | Missing rate limiting, no account lockout, JWT `alg:none`, weak session config |
474
+ | **Injection** | SQL, NoSQL, command injection, path traversal, SSRF, prototype pollution |
475
+ | **Web headers** | Missing CSP, HSTS, X-Frame-Options, X-Content-Type-Options, Referrer-Policy |
476
+ | **IaC** | `0.0.0.0/0` firewall rules, public storage buckets, wildcard IAM permissions |
477
+ | **AI/LLM** | `eval()` on model output, unvalidated model responses, prompt injection patterns |
478
+ | **Database** | TLS disabled on connections, raw query concatenation, missing connection encryption |
479
+ | **Mobile** | `android:debuggable=true`, cleartext traffic, insecure ATS config |
480
+ | **GraphQL** | Introspection in production, no depth/complexity limits, batching abuse |
481
+ | **Kubernetes** | Privileged containers, missing security context, hostPath mounts |
482
+ | **DLP** | PII in logs, stack traces in API responses, sensitive data in error messages |
483
+ | **Supply chain** | Missing lockfiles, floating version ranges (`^`, `~`), abandoned packages |
484
+ | **SBOM** | Generates CycloneDX SBOM for the scanned surface |
485
+ | **Runtime** | HTTP security headers and TLS config on live staging URL (if configured) |
486
+ | **AI red-team** | Static + optional dynamic probes against AI endpoints |
487
+ | **Exceptions** | Validates any active security exceptions are non-expired and properly approved |
488
+
489
+ ### Customize the Gate Policy
490
+
491
+ Copy the default policy into your project and edit:
492
+
493
+ ```bash
494
+ mkdir -p .mcp/policies
495
+ cp node_modules/security-mcp/defaults/security-policy.json .mcp/policies/security-policy.json
496
+ ```
497
+
498
+ Or generate one tailored to your stack:
499
+
500
+ ```text
501
+ Ask your AI: "Run security.generate_policy with surfaces=[web, api, ai] and cloud=aws"
502
+ ```
503
+
504
+ ### Add Exceptions for Known Accepted Risks
505
+
506
+ Copy and edit the exceptions file:
507
+
508
+ ```bash
509
+ mkdir -p .mcp/exceptions
510
+ cp node_modules/security-mcp/defaults/security-exceptions.json .mcp/exceptions/security-exceptions.json
511
+ ```
512
+
513
+ Format:
514
+
515
+ ```json
516
+ {
517
+ "version": "1.0.0",
518
+ "exceptions": [
519
+ {
520
+ "id": "EX-001",
521
+ "finding_ids": ["CRYPTO_WEAK_HASH"],
522
+ "justification": "Legacy hash used only for non-security cache keys",
523
+ "ticket": "JIRA-1234",
524
+ "owner": "alice@example.com",
525
+ "approver": "bob@example.com",
526
+ "approval_role": "SecurityLead",
527
+ "expires_on": "2025-12-31"
528
+ }
529
+ ]
530
+ }
531
+ ```
532
+
533
+ Expired exceptions automatically become CRITICAL findings that block the gate.
534
+
535
+ ---
536
+
537
+ ## What Gets Fixed Automatically
538
+
539
+ When your AI has security-mcp active, it **writes the production-ready fix** - not a suggestion, not a warning comment:
540
+
541
+ ### Secrets and Credentials
542
+
543
+ | Insecure | Fixed to |
544
+ | --- | --- |
545
+ | `const KEY = "sk-abc123"` | `const KEY = process.env["API_KEY"]` + vault reference |
546
+ | `password: "hardcoded"` in config | Environment variable + secret manager setup |
547
+ | JWT signed with `"secret"` | RS256 with generated key pair, proper validation |
548
+ | Bcrypt with cost factor 4 | Argon2id with `memory: 65536, iterations: 3, parallelism: 4` |
549
+
550
+ ### Authentication and Authorization
551
+
552
+ - Rate limiting middleware added to all auth endpoints (configurable thresholds)
553
+ - Account lockout after N failed attempts with progressive delays
554
+ - Session absolute timeout (8h) and idle timeout (30 min)
555
+ - FIDO2/WebAuthn requirement flagged for admin interfaces
556
+ - IDOR protection: tenant/user IDs read from JWT claims, never from request params
557
+
558
+ ### Injection and Input Validation
559
+
560
+ - Zod/Yup schema validation added to every API route handler
561
+ - SQL: string concatenation -> parameterized queries or tagged template literals
562
+ - Command execution: `exec(userInput)` -> `spawnSync` with arg array, no shell
563
+ - Path traversal: user-controlled paths validated against project boundary
564
+ - SSRF: server-side HTTP clients get RFC-1918 CIDR block lists + DNS validation
565
+
566
+ ### Web Security Headers
567
+
568
+ Before:
569
+
570
+ ```javascript
571
+ app.get("/", (req, res) => res.send(html));
572
+ ```
573
+
574
+ After:
575
+
576
+ ```javascript
577
+ app.use(helmet({
578
+ contentSecurityPolicy: {
579
+ directives: {
580
+ defaultSrc: ["'self'"],
581
+ scriptSrc: ["'self'", (req, res) => `'nonce-${res.locals.nonce}'`],
582
+ }
583
+ },
584
+ hsts: { maxAge: 63072000, includeSubDomains: true, preload: true },
585
+ frameguard: { action: "deny" },
586
+ noSniff: true,
587
+ referrerPolicy: { policy: "strict-origin-when-cross-origin" }
588
+ }));
589
+ ```
590
+
591
+ ### Cloud Infrastructure
592
+
593
+ - `cidr_blocks = ["0.0.0.0/0"]` -> source-restricted CIDR with comment explaining rationale
594
+ - `acl = "public-read"` S3 -> Block Public Access enabled at bucket and account level
595
+ - Wildcard IAM `"Action": "*"` -> least-privilege policy with specific actions
596
+ - Long-lived static credentials -> IAM roles / Workload Identity / OIDC federation
597
+
598
+ ### Cryptography
599
+
600
+ - `crypto.createHash('md5')` -> `crypto.createHash('sha256')`
601
+ - `Math.random()` for tokens -> `crypto.randomBytes(32).toString('hex')`
602
+ - AES-CBC -> AES-256-GCM with per-message nonce
603
+ - RSA PKCS#1 v1.5 -> RSA-OAEP or ECDH P-256
604
+
605
+ ### AI / LLM Security
606
+
607
+ - String-concatenated system prompts -> structured `messages` array with role separation
608
+ - `eval(modelOutput)` -> `JSON.parse()` + Zod schema validation
609
+ - RAG retrieval without auth check -> authorization check before and after retrieval
610
+ - Unvalidated tool calls -> allowlist router that blocks unlisted tool names
611
+
612
+ ---
613
+
614
+ ## Architecture
615
+
616
+ ### System Overview
617
+
618
+ ```text
619
+ ┌───────────────────────────────────────────────────────────────┐
620
+ │ Your Editor (Claude Code) │
621
+ │ │
622
+ │ /senior-security-engineer /ciso-orchestrator │
623
+ │ (single expert agent) (40-agent security program) │
624
+ │ │ │ │
625
+ └──────────┼────────────────────────────────┼───────────────────┘
626
+ │ │
627
+ └──────────────┬─────────────────┘
628
+ │ MCP protocol (stdio)
629
+
630
+ ┌──────────────────────────────────────────────────────────────┐
631
+ │ MCP Server (src/mcp/server.ts) │
632
+ │ │
633
+ │ security.* tools orchestration.* tools │
634
+ │ ───────────────── ────────────────────── │
635
+ │ start_review create_agent_run │
636
+ │ run_pr_gate update_agent_status │
637
+ │ threat_model merge_agent_findings │
638
+ │ checklist ensure_skill │
639
+ │ attest_review read/write_agent_memory │
640
+ │ get_system_prompt check_updates / apply_updates │
641
+ │ scan_strategy verify_skill_coverage │
642
+ │ generate_policy │
643
+ │ terraform_blueprint repo.* tools │
644
+ │ generate_opa_rego ───────────── │
645
+ │ generate_compliance_report read_file / search │
646
+ │ notify_webhooks │
647
+ │ generate_remediations │
648
+ └──────────────────────────────────────────────────────────────┘
649
+
650
+
651
+ ┌──────────────────────────────────────────────────────────────┐
652
+ │ Policy Gate Engine (src/gate/policy.ts) │
653
+ │ │
654
+ │ 18 checks run in parallel: │
655
+ │ checkSecrets checkDependencies checkApi checkInfra │
656
+ │ checkCrypto checkMobileIos checkMobileAndroid │
657
+ │ checkAi checkGraphQL checkKubernetes │
658
+ │ checkDatabase checkDlp checkWebNextjs │
659
+ │ runSbomChecks runAiRedteamChecks runRuntimeChecks ... │
660
+ │ │
661
+ │ Surface detection -> Control catalog -> Exception handling -> │
662
+ │ Confidence scoring -> PASS / FAIL │
663
+ └──────────────────────────────────────────────────────────────┘
664
+ ```
665
+
666
+ ### `/senior-security-engineer` Flow
667
+
668
+ ```text
669
+ User: /senior-security-engineer
670
+
671
+
672
+ Claude reads SKILL.md + asks scope choice:
673
+ A) Recent changes (git diff)
674
+ B) Full codebase
675
+ C) Specific files/folders
676
+
677
+ ▼ user picks scope
678
+ security.start_review(mode)
679
+ └── creates .mcp/reviews/{runId}.json
680
+
681
+
682
+ security.threat_model(runId, feature)
683
+ └── STRIDE + PASTA + ATT&CK template for changed surface
684
+
685
+
686
+ security.run_pr_gate(runId, mode, targets)
687
+ ├── git diff / glob targets -> changed files list
688
+ ├── detectSurfaces() -> web? api? infra? mobile? ai?
689
+ ├── 18 checks in parallel
690
+ ├── apply exceptions from .mcp/exceptions/
691
+ ├── compute confidence score
692
+ └── returns PASS/FAIL + findings[]
693
+
694
+
695
+ Claude writes inline fixes for every finding
696
+ (production-ready secure code, not suggestions)
697
+
698
+
699
+ security.attest_review(runId)
700
+ └── .mcp/reports/{runId}.attestation.json
701
+ └── SHA-256 integrity hash
702
+ ```
703
+
704
+ ### `/ciso-orchestrator` Flow (40 Agents)
705
+
706
+ ```text
707
+ User: /ciso-orchestrator
708
+
709
+
710
+ CISO Orchestrator
711
+ ├── orchestration.check_updates() -> prompt if new version available
712
+ ├── ask internet permission -> stored for all child agents
713
+ ├── scan project for stack context
714
+ │ (package.json, go.mod, terraform/, .github/workflows/, Dockerfile)
715
+ │ -> stackContext: { languages, frameworks, cloudProvider, hasAI, hasMobile, ... }
716
+ ├── security.start_review() -> runId
717
+ ├── orchestration.create_agent_run() -> agentRunId + manifest.json
718
+ └── orchestration.ensure_skill(×39) -> download skills if not cached
719
+
720
+
721
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
722
+ PHASE 1 - 7 leads + sub-agents (all parallel)
723
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
724
+
725
+ Agent 1: threat-modeler
726
+ ├── stride-pasta-analyst -> STRIDE matrix, PASTA 7 stages, LINDDUN, DREAD
727
+ ├── attack-navigator -> ATT&CK Navigator layer + D3FEND countermeasures
728
+ ├── business-logic-attacker -> attack trees per route/flow found in codebase
729
+ └── privacy-flow-analyst -> GDPR/HIPAA data flows, DPIA trigger check
730
+ Output: .mcp/agent-runs/{id}/threat-model.json
731
+
732
+ Agent 2: appsec-code-auditor
733
+ ├── injection-specialist -> SQL/NoSQL/SSTI/OS cmd/CRLF/log injection
734
+ ├── auth-session-hacker -> JWT algo confusion, SAML wrap, OAuth confusion
735
+ ├── logic-race-fuzzer -> race conditions, integer overflow, mass assignment
736
+ └── serialization-memory-attacker -> prototype pollution, ReDoS, zip slip, sandbox escape
737
+ Output: .mcp/agent-runs/{id}/appsec-findings.json
738
+
739
+ Agent 3: cloud-infra-specialist
740
+ ├── aws-penetration-tester -> IAM escalation, S3, Lambda, EKS (if AWS)
741
+ ├── gcp-penetration-tester -> SA abuse, GCS, Cloud Run, GKE (if GCP)
742
+ ├── azure-penetration-tester -> Managed Identity, AKS, Key Vault (if Azure)
743
+ └── k8s-container-escaper -> privileged pods, RBAC escape, hostPath (if K8s)
744
+ Output: .mcp/agent-runs/{id}/infra-findings.json
745
+
746
+ Agent 4: supply-chain-devsecops
747
+ ├── dependency-confusion-attacker -> CVEs, CISA KEV, typosquatting, SBOM
748
+ ├── cicd-pipeline-hijacker -> pull_request_target, mutable Actions, injection
749
+ └── artifact-integrity-analyst -> SLSA L3, Cosign signatures, provenance
750
+ Output: .mcp/agent-runs/{id}/supply-chain-findings.json
751
+
752
+ Agent 5: ai-llm-redteam (skipped if no AI stack detected)
753
+ ├── prompt-injection-specialist -> direct + indirect injection, PoC payloads
754
+ ├── model-extraction-attacker -> API abuse, cost amplification, rate limiting
755
+ ├── rag-poisoning-specialist -> vector store isolation, metadata filter injection
756
+ └── agentic-loop-exploiter -> tool blast radius, loop hijacking, allowlist gaps
757
+ Output: .mcp/agent-runs/{id}/ai-findings.json
758
+
759
+ Agent 6: mobile-security-specialist (skipped if no mobile detected)
760
+ ├── ios-security-auditor -> Keychain, ATS, Secure Enclave, Universal Links
761
+ ├── android-penetration-tester -> manifest hardening, NSC, exported components
762
+ └── mobile-api-network-attacker -> cert pinning, API key extraction, token storage
763
+ Output: .mcp/agent-runs/{id}/mobile-findings.json
764
+
765
+ Agent 7: crypto-pki-specialist
766
+ ├── tls-certificate-auditor -> TLS 1.3, AEAD ciphers, HSTS preload, OCSP, mTLS
767
+ ├── algorithm-implementation-reviewer -> banned algos, Argon2id params, nonce reuse
768
+ └── key-management-lifecycle-analyst -> hardcoded keys, rotation, CMEK, post-quantum
769
+ Output: .mcp/agent-runs/{id}/crypto-findings.json
770
+
771
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
772
+ Wait for all Phase 1 agents to complete
773
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
774
+
775
+ PHASE 2 - adversarial + compliance (both parallel)
776
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
777
+
778
+ Agent 8: pentest-team (reads threat-model.json as attack brief)
779
+ ├── pentest-web-api -> OWASP Testing Guide on every route found in codebase
780
+ ├── pentest-infra -> privilege escalation graph, Terraform state, cloud posture
781
+ └── pentest-social -> OSINT on org, spear-phishing scenarios, insider threat model
782
+ Output: .mcp/agent-runs/{id}/pentest-report.json
783
+
784
+ Agent 9: compliance-grc (reads all Phase 1 findings)
785
+ ├── evidence-collector -> logging schema verification, SIEM rules, audit trail
786
+ └── compliance-gap-analyst -> PCI DSS 4.0, SOC 2, ISO 27001, NIST 800-53, HIPAA, GDPR
787
+ Output: .mcp/agent-runs/{id}/compliance-report.json
788
+
789
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
790
+ Wait for Phase 2 agents to complete
791
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
792
+
793
+ PHASE 3 - synthesis (sequential)
794
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
795
+
796
+ orchestration.merge_agent_findings() -> deduplicate + sort CRITICAL->LOW
797
+ orchestration.verify_skill_coverage() -> check §1-§24 SKILL.md section coverage
798
+ security.attest_review() -> SHA-256 attestation written
799
+
800
+ Final report:
801
+ ├── X CRITICAL / X HIGH / X MEDIUM / X LOW
802
+ ├── Remediated inline: X Open: X
803
+ ├── SKILL.md section coverage: XX%
804
+ ├── Release blocked: yes / no
805
+ └── .mcp/reports/{runId}.attestation.json
806
+ ```
807
+
808
+ ### Agent Memory System
809
+
810
+ Every agent persists what it learns so each subsequent run is smarter:
811
+
812
+ ```text
813
+ ~/.security-mcp/agent-memory/{agentName}/
814
+ ├── patterns.json ← confirmed attack patterns for this tech stack
815
+ ├── false-positives.json ← findings to deprioritize on next run
816
+ ├── remediations.json ← what fixes worked for this project
817
+ ├── intel.json ← cached threat intel (refreshed every 24h)
818
+ └── errors.json ← tool failure log (used for self-healing)
819
+ ```
820
+
821
+ ### Data Written to Your Project
822
+
823
+ ```text
824
+ .mcp/
825
+ ├── reviews/{runId}.json ← review run state + step tracking
826
+ ├── reports/{runId}.attestation.json ← SHA-256 auditable attestation
827
+ ├── agent-runs/{agentRunId}/
828
+ │ ├── manifest.json ← all agent statuses + current phase
829
+ │ ├── threat-model.json
830
+ │ ├── appsec-findings.json
831
+ │ ├── infra-findings.json
832
+ │ ├── supply-chain-findings.json
833
+ │ ├── ai-findings.json
834
+ │ ├── mobile-findings.json
835
+ │ ├── crypto-findings.json
836
+ │ ├── pentest-report.json
837
+ │ ├── compliance-report.json
838
+ │ ├── sbom.cyclonedx.json
839
+ │ └── merged-findings.json ← Phase 3 deduplicated, sorted output
840
+ ├── policies/security-policy.json
841
+ └── exceptions/security-exceptions.json
842
+ ```
843
+
844
+ ---
845
+
846
+ ## MCP Tools Reference
847
+
848
+ Your AI uses these automatically. You don't call them directly, but understanding what they do helps you know what's happening during a review.
849
+
850
+ ### Core Security Tools
851
+
852
+ | Tool | What It Does |
853
+ | --- | --- |
854
+ | `security.start_review` | Starts a stateful review run; returns `runId` used to track all subsequent steps and produce the final attestation |
855
+ | `security.run_pr_gate` | Runs 18 security checks in parallel; returns PASS/FAIL, findings with severity, and required actions |
856
+ | `security.threat_model` | Generates a STRIDE + PASTA + ATT&CK threat model template for a specific feature or surface |
857
+ | `security.checklist` | Returns the pre-release security checklist, optionally filtered by surface (web / api / mobile / ai / infra / payments) |
858
+ | `security.scan_strategy` | Builds an exhaustive scan plan mapping every check to OWASP, NIST, ATT&CK, and compliance controls |
859
+ | `security.get_system_prompt` | Returns the full security engineering directive, optionally scoped to your stack and cloud provider |
860
+ | `security.generate_policy` | Generates a `security-policy.json` tailored to your active surfaces and cloud provider |
861
+ | `security.terraform_hardening_blueprint` | Terraform hardening baseline with module layout, guardrails, and control mappings |
862
+ | `security.generate_opa_rego` | OPA/Rego policy code for Terraform plans, CI pipelines, and Kubernetes admission |
863
+ | `security.generate_compliance_report` | Maps gate findings to SOC 2, PCI-DSS, ISO 27001, NIST 800-53, HIPAA, or GDPR controls |
864
+ | `security.generate_remediations` | Maps each finding ID to a concrete code-level fix template |
865
+ | `security.notify_webhooks` | Sends findings to Slack, Jira, PagerDuty, or any webhook URL |
866
+ | `security.self_heal_loop` | Proposes adaptive policy improvements based on recurring findings (requires explicit human approval) |
867
+ | `security.attest_review` | Writes a SHA-256 integrity-hashed attestation file at `.mcp/reports/{runId}.attestation.json` |
868
+ | `repo.read_file` | Reads a project file for analysis (path-traversal guarded) |
869
+ | `repo.search` | Searches the codebase for patterns or regex (ReDoS guarded, max 500 matches) |
870
+
871
+ ### Orchestration Tools (`/ciso-orchestrator` only)
872
+
873
+ | Tool | What It Does |
874
+ | --- | --- |
875
+ | `orchestration.create_agent_run` | Initialises the 39-agent manifest and `.mcp/agent-runs/{id}/` directory |
876
+ | `orchestration.update_agent_status` | Agents report start/completion; automatically advances phase when all phase agents finish |
877
+ | `orchestration.merge_agent_findings` | Deduplicates findings from all agents, sorts by severity, writes `merged-findings.json` |
878
+ | `orchestration.ensure_skill` | Downloads a skill from the GitHub registry if not cached locally (`~/.claude/skills/`) |
879
+ | `orchestration.read_agent_memory` | Loads an agent's prior patterns, false-positives, remediations, and cached intel |
880
+ | `orchestration.write_agent_memory` | Persists newly learned patterns and remediations after a run |
881
+ | `orchestration.check_updates` | Checks npm and the skills manifest for newer versions of security-mcp or installed skills |
882
+ | `orchestration.apply_updates` | Returns update commands (manual) or instructions for the agent to run them (auto) |
883
+ | `orchestration.verify_skill_coverage` | Reports which SKILL.md sections §1-§24 had zero coverage findings in this run |
884
+
885
+ ---
886
+
887
+ ## Security Frameworks Applied
888
+
889
+ All of the following frameworks are applied automatically. You don't need to know them - they're the standards used by the world's top security teams, and security-mcp maps every finding and fix to them:
890
+
891
+ | Framework | What It Covers |
892
+ | --- | --- |
893
+ | **OWASP Top 10** (Web + API) | The 10 most critical web and API vulnerability classes |
894
+ | **OWASP ASVS Level 2/3** | Application security verification standard - L3 for auth, payments, PII |
895
+ | **OWASP MASVS** | Mobile application security verification standard |
896
+ | **OWASP Top 10 for LLMs** | AI-specific vulnerabilities: prompt injection, training data poisoning, etc. |
897
+ | **OWASP Testing Guide** | Methodology used by pentest sub-agents for endpoint-level testing |
898
+ | **MITRE ATT&CK Enterprise + Cloud + Mobile** | Real attacker playbooks - every finding maps to a technique ID |
899
+ | **MITRE D3FEND** | Defensive countermeasure mapped to every ATT&CK technique in scope |
900
+ | **MITRE ATLAS** | Adversarial ML/AI attack techniques |
901
+ | **MITRE CAPEC** | Attack patterns used at design-time threat modeling |
902
+ | **NIST 800-53 Rev 5** | Full US government security control catalog |
903
+ | **NIST CSF 2.0** | Govern / Identify / Protect / Detect / Respond / Recover |
904
+ | **NIST 800-207** | Zero Trust Architecture - every request authenticated and authorized |
905
+ | **NIST 800-218 (SSDF)** | Secure Software Development Framework |
906
+ | **NIST AI RMF** | AI risk management: Map, Measure, Manage, Govern |
907
+ | **PCI DSS 4.0** | Payment card industry data security standard |
908
+ | **SOC 2 Type II** | Trust Services Criteria (Security, Availability, Confidentiality, PI) |
909
+ | **ISO 27001:2022 + 27002** | International information security management system |
910
+ | **ISO 42001:2023** | AI management system - applied to all LLM/AI components |
911
+ | **GDPR / CCPA / HIPAA** | Data privacy: consent, retention, breach notification, minimum necessary |
912
+ | **SLSA Level 3** | Software supply chain security - hermetic builds, signed provenance |
913
+ | **CIS Benchmarks Level 2** | Hardened cloud, OS, and container configurations |
914
+ | **CVSS v4.0 + EPSS** | Vulnerability scoring and exploit probability - EPSS > 0.5 fixed within 48h |
915
+
916
+ ---
917
+
918
+ ## Configuration
919
+
920
+ ### Customize the Security Policy
921
+
922
+ The policy file controls what the gate blocks, what evidence it requires, and how exceptions are handled. Copy the default and edit:
923
+
924
+ ```bash
925
+ mkdir -p .mcp/policies
926
+ cp node_modules/security-mcp/defaults/security-policy.json .mcp/policies/security-policy.json
927
+ ```
928
+
929
+ Key sections:
930
+
931
+ ```json
932
+ {
933
+ "required_checks": {
934
+ "secrets_scan": { "severity_block": ["HIGH", "CRITICAL"] },
935
+ "dependency_scan": { "severity_block": ["CRITICAL"] },
936
+ "sast": { "severity_block": ["CRITICAL"] },
937
+ "iac_scan": { "severity_block": ["HIGH", "CRITICAL"] }
938
+ },
939
+ "vulnerability_slas": {
940
+ "CRITICAL": "24h",
941
+ "HIGH": "7d",
942
+ "MEDIUM": "30d",
943
+ "CISA_KEV": "24h"
944
+ },
945
+ "exceptions": {
946
+ "require_ticket": true,
947
+ "approval_roles": ["SecurityLead", "GRC", "CTO"]
948
+ }
949
+ }
950
+ ```
951
+
952
+ ### Add a Security Exception
953
+
954
+ When you have a finding you've consciously accepted (e.g., a CVE in a library you're actively replacing):
955
+
956
+ ```bash
957
+ mkdir -p .mcp/exceptions
958
+ cp node_modules/security-mcp/defaults/security-exceptions.json .mcp/exceptions/security-exceptions.json
959
+ ```
960
+
961
+ Edit `.mcp/exceptions/security-exceptions.json`:
962
+
963
+ ```json
964
+ {
965
+ "version": "1.0.0",
966
+ "exceptions": [
967
+ {
968
+ "id": "EX-001",
969
+ "finding_ids": ["DEP_CVE_CVE-2024-12345"],
970
+ "justification": "Library being replaced in sprint 42; no public exploit yet",
971
+ "ticket": "JIRA-9999",
972
+ "owner": "your-email@company.com",
973
+ "approver": "security-lead@company.com",
974
+ "approval_role": "SecurityLead",
975
+ "expires_on": "2025-06-30"
976
+ }
977
+ ]
978
+ }
979
+ ```
980
+
981
+ **Expired exceptions automatically become `SECURITY_EXCEPTION_EXPIRED` CRITICAL findings** that block the gate until renewed or resolved.
982
+
983
+ ---
984
+
985
+ ## Environment Variables
986
+
987
+ ### CI / Gate
988
+
989
+ | Variable | Default | Purpose |
990
+ | --- | --- | --- |
991
+ | `GITHUB_TOKEN` | set by Actions | Authenticates git operations in CI |
992
+ | `SECURITY_GATE_BASE_REF` | `origin/main` | Branch to diff against |
993
+ | `SECURITY_GATE_HEAD_REF` | `HEAD` | Branch being scanned |
994
+ | `SECURITY_GATE_POLICY` | `.mcp/policies/security-policy.json` | Path to policy file |
995
+ | `SECURITY_GATE_SCANNERS` | built-in | Path to custom scanner config (must be within project directory) |
996
+ | `SECURITY_GATE_EXCEPTIONS` | `.mcp/exceptions/security-exceptions.json` | Path to exceptions file (must be within project directory) |
997
+
998
+ ### Integrations (all optional)
999
+
1000
+ | Variable | Purpose |
1001
+ | --- | --- |
1002
+ | `SECURITY_SLACK_WEBHOOK` | Sends gate results to a Slack channel |
1003
+ | `SECURITY_JIRA_URL` | Creates Jira tickets for gate failures |
1004
+ | `SECURITY_JIRA_TOKEN` | Jira API token (never logged) |
1005
+ | `SECURITY_JIRA_PROJECT` | Jira project key (default: `SECURITY`) |
1006
+ | `SECURITY_PAGERDUTY_KEY` | Pages on-call when CRITICAL findings are found |
1007
+ | `SECURITY_WEBHOOK_URL` | POST gate results as JSON to any URL |
1008
+
1009
+ ### Live Scanning (optional)
1010
+
1011
+ | Variable | Purpose |
1012
+ | --- | --- |
1013
+ | `SECURITY_STAGING_URL` | Enables live HTTP header and TLS checks against your staging environment |
1014
+ | `SECURITY_AI_ENDPOINT` | Enables live jailbreak, injection, PII, and rate-limit probes against your AI endpoint |
1015
+ | `SECURITY_AUTO_SBOM` | Set `true` to auto-generate a CycloneDX SBOM on each gate run |
1016
+
344
1017
  ---
345
1018
 
346
1019
  ## The 10 Rules That Are Never Broken
347
1020
 
348
- No matter what your AI is asked to do, these rules are enforced without exception:
1021
+ No matter what your AI is asked to build, these are enforced without exception:
349
1022
 
350
- 1. No `0.0.0.0/0` firewall rules -- ever
351
- 2. All internal services talk over private VPC only (no public internet)
352
- 3. Secrets live in a secret manager only -- never in code, env files, or logs
353
- 4. TLS 1.3 for everything in transit -- 1.0 and 1.1 are blocked
354
- 5. Passwords hashed with Argon2id or bcrypt (cost 14+) -- no MD5, no SHA-1
355
- 6. Every API input validated server-side with a schema -- no exceptions
356
- 7. No inline JavaScript -- CSP nonce-based only
357
- 8. Admin interfaces require FIDO2/WebAuthn passkey -- not just a password
358
- 9. Threat model written before building any auth, payment, or AI feature
359
- 10. Zero Trust: every request authenticated and authorized regardless of origin
1023
+ 1. **No `0.0.0.0/0` firewall rules** - ingress and egress must be source-restricted
1024
+ 2. **All internal services over private VPC only** - no public IPs for databases, queues, or internal APIs
1025
+ 3. **Secrets in a secret manager only** - never in code, `.env` files, CI logs, or container images
1026
+ 4. **TLS 1.3 for everything in transit** - TLS 1.0 and 1.1 are explicitly blocked
1027
+ 5. **Passwords hashed with Argon2id or bcrypt (cost 14)** - MD5 and SHA-1 are forbidden
1028
+ 6. **Every API input validated server-side with a schema** - no passing raw request data to business logic
1029
+ 7. **No inline JavaScript** - Content Security Policy is nonce-based only; no `unsafe-inline` or `unsafe-eval`
1030
+ 8. **Admin interfaces require FIDO2/WebAuthn passkey** - TOTP is not acceptable for admin access
1031
+ 9. **Threat model before any auth, payment, or AI feature** - no design-free implementation
1032
+ 10. **Zero Trust: every request authenticated and authorized regardless of origin** - no implicit network trust
360
1033
 
361
1034
  ---
362
1035
 
363
- ## Contributing
1036
+ ## Troubleshooting
364
1037
 
365
- See [CONTRIBUTING.md](CONTRIBUTING.md).
1038
+ ### The `/senior-security-engineer` command isn't available in my editor
1039
+
1040
+ **Cause:** The skill was not installed to `~/.claude/skills/`.
1041
+
1042
+ **Fix:** Re-run the installer:
1043
+
1044
+ ```bash
1045
+ npx -y security-mcp@latest install
1046
+ ```
1047
+
1048
+ Then verify the skill exists:
1049
+
1050
+ ```bash
1051
+ ls ~/.claude/skills/senior-security-engineer/SKILL.md
1052
+ ```
1053
+
1054
+ ### The MCP server doesn't appear as connected
1055
+
1056
+ **Cause:** Config file was not written, or the editor wasn't restarted after config was written.
1057
+
1058
+ **Fix:**
1059
+
1060
+ 1. Check the config file was written (see editor-specific paths in [Manual Configuration](#manual-configuration-any-mcp-editor))
1061
+ 2. Fully restart the editor (quit and reopen, not just reload window)
1062
+ 3. Check Node.js version: `node --version` - must be 20 or higher
366
1063
 
367
- ## Responsible Disclosure
1064
+ ### The CI gate fails with "cannot find module"
368
1065
 
369
- See [SECURITY.md](SECURITY.md).
1066
+ **Cause:** The dist files weren't included in the npm package, or you're referencing a path that doesn't exist.
1067
+
1068
+ **Fix:** Use `npx -y security-mcp@latest ci:pr-gate` which always pulls the latest published version, rather than referencing a local path.
1069
+
1070
+ ### A finding is a false positive
1071
+
1072
+ **Fix:** Add it to `.mcp/exceptions/security-exceptions.json` with a justification, ticket, owner, and expiry date. See [Add a Security Exception](#add-a-security-exception).
1073
+
1074
+ ### The gate is too strict for my current project stage
1075
+
1076
+ **Fix:** Edit `.mcp/policies/security-policy.json` to lower severity thresholds for your current environment. For example, set `dev` environment to only block on `CRITICAL`:
1077
+
1078
+ ```json
1079
+ "environments": {
1080
+ "dev": {
1081
+ "severity_block": ["CRITICAL"],
1082
+ "required_checks": ["secrets_scan"]
1083
+ }
1084
+ }
1085
+ ```
1086
+
1087
+ ### I want to update to the latest version
1088
+
1089
+ ```bash
1090
+ npx -y security-mcp@latest install
1091
+ ```
1092
+
1093
+ This always pulls the latest published version. If you have it globally installed:
1094
+
1095
+ ```bash
1096
+ npm install -g security-mcp@latest
1097
+ ```
1098
+
1099
+ ---
1100
+
1101
+ ## FAQ
1102
+
1103
+ **Q: Does this send my code to any external service?**
1104
+
1105
+ No. The MCP server runs locally as a Node.js process. Your code never leaves your machine. The only external calls made are to the npm registry (to check for updates) and optionally to GitHub (to download skill files) - both only if explicitly permitted. Live CVE/CISA KEV fetches during `/ciso-orchestrator` require your explicit internet permission at runtime.
1106
+
1107
+ **Q: Do I need to know security to use this?**
1108
+
1109
+ No. The tool is designed so that you don't need to understand what OWASP or ATT&CK mean. You describe what you're building, and the security engineer handles the rest.
1110
+
1111
+ **Q: Will it slow down my development?**
1112
+
1113
+ For daily use with `/senior-security-engineer` on recent changes, a typical review takes seconds to a few minutes. The fix is inline - you don't need to context-switch to a separate tool.
1114
+
1115
+ **Q: What if it fixes something I don't want changed?**
1116
+
1117
+ Everything is in your git working tree. Review the diff with `git diff`, revert anything you disagree with (`git checkout -- <file>`), and add a security exception if the finding is a false positive or accepted risk.
1118
+
1119
+ **Q: Can I use this on an existing codebase with lots of issues?**
1120
+
1121
+ Yes. Use `security.generate_policy` to set appropriate thresholds for your current state, add exceptions for known-accepted technical debt, and use the gate's MEDIUM/LOW findings as a backlog rather than blockers.
1122
+
1123
+ **Q: Is this a replacement for a real pentest?**
1124
+
1125
+ No - but it covers the same ground and more, continuously, on every change. Use `/ciso-orchestrator` before major releases to get the depth of a structured security review. For compliance purposes (SOC 2, PCI DSS), the attestation files and compliance reports generated are audit-trail artifacts.
1126
+
1127
+ **Q: What AI models does this work with?**
1128
+
1129
+ security-mcp is model-agnostic - it's an MCP server, not a model. It works with any AI assistant that supports the MCP protocol: Claude (all models), GitHub Copilot, Cursor, Codex, and others.
1130
+
1131
+ **Q: How do I report a vulnerability in security-mcp itself?**
1132
+
1133
+ See [SECURITY.md](SECURITY.md) for the responsible disclosure policy.
1134
+
1135
+ ---
1136
+
1137
+ ## Contributing
1138
+
1139
+ See [CONTRIBUTING.md](CONTRIBUTING.md).
370
1140
 
371
1141
  ## License
372
1142