@integsec/agentic-pentest-proxy 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/README.md +731 -0
  2. package/dist/bin/integsec-agentic-pentest-proxy.d.ts +3 -0
  3. package/dist/bin/integsec-agentic-pentest-proxy.d.ts.map +1 -0
  4. package/dist/bin/integsec-agentic-pentest-proxy.js +51 -0
  5. package/dist/bin/integsec-agentic-pentest-proxy.js.map +1 -0
  6. package/dist/src/audit/azure-monitor.d.ts +22 -0
  7. package/dist/src/audit/azure-monitor.d.ts.map +1 -0
  8. package/dist/src/audit/azure-monitor.js +62 -0
  9. package/dist/src/audit/azure-monitor.js.map +1 -0
  10. package/dist/src/audit/cloudwatch.d.ts +20 -0
  11. package/dist/src/audit/cloudwatch.d.ts.map +1 -0
  12. package/dist/src/audit/cloudwatch.js +89 -0
  13. package/dist/src/audit/cloudwatch.js.map +1 -0
  14. package/dist/src/audit/gcp-logging.d.ts +23 -0
  15. package/dist/src/audit/gcp-logging.d.ts.map +1 -0
  16. package/dist/src/audit/gcp-logging.js +70 -0
  17. package/dist/src/audit/gcp-logging.js.map +1 -0
  18. package/dist/src/audit/index.d.ts +49 -0
  19. package/dist/src/audit/index.d.ts.map +1 -0
  20. package/dist/src/audit/index.js +79 -0
  21. package/dist/src/audit/index.js.map +1 -0
  22. package/dist/src/audit/local.d.ts +25 -0
  23. package/dist/src/audit/local.d.ts.map +1 -0
  24. package/dist/src/audit/local.js +51 -0
  25. package/dist/src/audit/local.js.map +1 -0
  26. package/dist/src/config.d.ts +25 -0
  27. package/dist/src/config.d.ts.map +1 -0
  28. package/dist/src/config.js +26 -0
  29. package/dist/src/config.js.map +1 -0
  30. package/dist/src/dns-resolver.d.ts +21 -0
  31. package/dist/src/dns-resolver.d.ts.map +1 -0
  32. package/dist/src/dns-resolver.js +68 -0
  33. package/dist/src/dns-resolver.js.map +1 -0
  34. package/dist/src/domain-matcher.d.ts +35 -0
  35. package/dist/src/domain-matcher.d.ts.map +1 -0
  36. package/dist/src/domain-matcher.js +97 -0
  37. package/dist/src/domain-matcher.js.map +1 -0
  38. package/dist/src/extractor.d.ts +30 -0
  39. package/dist/src/extractor.d.ts.map +1 -0
  40. package/dist/src/extractor.js +176 -0
  41. package/dist/src/extractor.js.map +1 -0
  42. package/dist/src/index.d.ts +8 -0
  43. package/dist/src/index.d.ts.map +1 -0
  44. package/dist/src/index.js +7 -0
  45. package/dist/src/index.js.map +1 -0
  46. package/dist/src/ip-matcher.d.ts +38 -0
  47. package/dist/src/ip-matcher.d.ts.map +1 -0
  48. package/dist/src/ip-matcher.js +128 -0
  49. package/dist/src/ip-matcher.js.map +1 -0
  50. package/dist/src/manifest-schema.d.ts +77 -0
  51. package/dist/src/manifest-schema.d.ts.map +1 -0
  52. package/dist/src/manifest-schema.js +34 -0
  53. package/dist/src/manifest-schema.js.map +1 -0
  54. package/dist/src/manifest.d.ts +3 -0
  55. package/dist/src/manifest.d.ts.map +1 -0
  56. package/dist/src/manifest.js +115 -0
  57. package/dist/src/manifest.js.map +1 -0
  58. package/dist/src/proxy.d.ts +16 -0
  59. package/dist/src/proxy.d.ts.map +1 -0
  60. package/dist/src/proxy.js +72 -0
  61. package/dist/src/proxy.js.map +1 -0
  62. package/dist/src/sanitizer.d.ts +19 -0
  63. package/dist/src/sanitizer.d.ts.map +1 -0
  64. package/dist/src/sanitizer.js +68 -0
  65. package/dist/src/sanitizer.js.map +1 -0
  66. package/dist/src/technique-checker.d.ts +50 -0
  67. package/dist/src/technique-checker.d.ts.map +1 -0
  68. package/dist/src/technique-checker.js +110 -0
  69. package/dist/src/technique-checker.js.map +1 -0
  70. package/dist/src/transports/http.d.ts +3 -0
  71. package/dist/src/transports/http.d.ts.map +1 -0
  72. package/dist/src/transports/http.js +67 -0
  73. package/dist/src/transports/http.js.map +1 -0
  74. package/dist/src/transports/stdio.d.ts +3 -0
  75. package/dist/src/transports/stdio.d.ts.map +1 -0
  76. package/dist/src/transports/stdio.js +50 -0
  77. package/dist/src/transports/stdio.js.map +1 -0
  78. package/dist/src/types.d.ts +43 -0
  79. package/dist/src/types.d.ts.map +1 -0
  80. package/dist/src/types.js +2 -0
  81. package/dist/src/types.js.map +1 -0
  82. package/dist/src/validator.d.ts +54 -0
  83. package/dist/src/validator.d.ts.map +1 -0
  84. package/dist/src/validator.js +200 -0
  85. package/dist/src/validator.js.map +1 -0
  86. package/examples/claude-desktop-config.json +15 -0
  87. package/examples/scope-manifest.json +18 -0
  88. package/examples/technique-map.json +10 -0
  89. package/package.json +58 -0
package/README.md ADDED
@@ -0,0 +1,731 @@
1
+ # IntegSec Agentic Pentest MCP Proxy
2
+
3
+ **Scope enforcement proxy for AI-driven penetration testing.**
4
+
5
+ The IntegSec Agentic Pentest MCP Proxy sits between an AI agent (Claude, GPT, etc.) and an MCP tool server (Kali MCP, Nuclei MCP, [TurboPentest](https://turbopentest.com), etc.), intercepting every tool call and validating it against a scope manifest before it reaches the upstream server. Out-of-scope targets, banned techniques, and expired engagement windows are blocked in real time with a full audit trail.
6
+
7
+ Built by **[IntegSec](https://integsec.com)** — offensive cybersecurity testing and threat simulation for modern organizations moving at AI speed.
8
+
9
+ ```
10
+ ┌──────────┐ JSON-RPC ┌─────────────────────┐ JSON-RPC ┌──────────────┐
11
+ │ AI Agent │ ──────────────────▶│ IntegSec Agentic │ ──────────────────▶│ Upstream MCP │
12
+ │ (Claude) │ ◀──────────────────│ Pentest MCP Proxy │ ◀──────────────────│ (Kali / │
13
+ └──────────┘ allow / block │ audit) │ forwarded │ TurboPentest)│
14
+ └─────────────────────┘ └──────────────┘
15
+
16
+
17
+ ┌───────────┐
18
+ │ Audit Log │
19
+ │ (JSONL / │
20
+ │ Cloud) │
21
+ └───────────┘
22
+ ```
23
+
24
+ > **Using AI agents for pentesting?** [TurboPentest](https://turbopentest.com) delivers agentic penetration testing powered by Claude — 15 orchestrated security tools, OWASP Top 10 coverage, results in under 4 hours, blockchain-attested reports. Starting at $99/domain. Pair it with this proxy for scope-safe autonomous testing.
25
+
26
+ ---
27
+
28
+ ## Table of Contents
29
+
30
+ - [Why This Exists](#why-this-exists)
31
+ - [Features](#features)
32
+ - [Quick Start](#quick-start)
33
+ - [Installation](#installation)
34
+ - [Configuration](#configuration)
35
+ - [Scope Manifest](#scope-manifest)
36
+ - [Environment Variables](#environment-variables)
37
+ - [Technique Mappings](#technique-mappings)
38
+ - [Usage](#usage)
39
+ - [CLI](#cli)
40
+ - [Claude Desktop Integration](#claude-desktop-integration)
41
+ - [Claude Code Integration](#claude-code-integration)
42
+ - [Docker](#docker)
43
+ - [HTTP Mode](#http-mode)
44
+ - [How Validation Works](#how-validation-works)
45
+ - [Audit Logging](#audit-logging)
46
+ - [Examples](#examples)
47
+ - [Contributing](#contributing)
48
+ - [Architecture](#architecture)
49
+ - [Development Setup](#development-setup)
50
+ - [Project Structure](#project-structure)
51
+ - [Testing](#testing)
52
+ - [Adding a New Audit Backend](#adding-a-new-audit-backend)
53
+ - [Adding Tool Extraction Support](#adding-tool-extraction-support)
54
+ - [Code Style](#code-style)
55
+ - [Roadmap](#roadmap)
56
+ - [About IntegSec](#about-integsec)
57
+ - [License](#license)
58
+
59
+ ---
60
+
61
+ ## Why This Exists
62
+
63
+ AI agents equipped with offensive security tools (nmap, sqlmap, Metasploit, etc.) can cause serious harm if they stray outside an authorized engagement scope. A misconfigured prompt or hallucinated target can turn a legitimate pentest into an unauthorized attack.
64
+
65
+ The IntegSec Agentic Pentest MCP Proxy solves this by enforcing scope at the protocol layer — not at the prompt layer. Every tool invocation is validated against a cryptographically-loadable scope manifest before it reaches the upstream MCP server. If the target, technique, or timing is wrong, the call is blocked and logged.
66
+
67
+ **No prompt engineering. No honor system. Enforcement.**
68
+
69
+ This is the same scope enforcement philosophy behind [IntegSec's](https://integsec.com) human-expert-led penetration testing services — applied to autonomous AI agents.
70
+
71
+ ---
72
+
73
+ ## Features
74
+
75
+ - **8-step validation pipeline** — technique check, time window, target extraction, DNS resolution, exclusion check, authorization check, default deny
76
+ - **Fail-closed design** — DNS failures, unknown targets, and expired windows all result in blocks
77
+ - **19 tool extractors + smart fallback** — built-in parameter extraction for nmap, sqlmap, burp, curl, metasploit, nuclei, gobuster, ffuf, nikto, and more, with generic fallback for unknown tools
78
+ - **Wildcard domain matching** — `*.acme.com` matches `app.acme.com` but not `deep.sub.acme.com`
79
+ - **CIDR + IPv6 support** — authorize by IP range, detect RFC-1918 private ranges and cloud metadata endpoints
80
+ - **DNS caching with TTL** — parallel A+AAAA resolution with in-flight deduplication
81
+ - **Technique blocking** — categorize tools into `dos`, `destructive`, `social_engineering`, etc., with custom mappings
82
+ - **Parameter sanitization** — passwords, tokens, API keys, and secrets are redacted before logging
83
+ - **Multi-backend audit logging** — local JSONL, AWS CloudWatch, Azure Monitor, GCP Cloud Logging
84
+ - **Two transport modes** — stdio (child process) and HTTP (reverse proxy)
85
+ - **Cloud-native manifest loading** — load scope from file, env var, AWS Secrets Manager, Azure Key Vault, or GCP Secret Manager
86
+ - **Docker-ready** — multi-stage build, runs as non-root user
87
+ - **Zero runtime config files** — everything via environment variables
88
+
89
+ ---
90
+
91
+ ## Quick Start
92
+
93
+ ```bash
94
+ # Install
95
+ npm install -g @integsec/agentic-pentest-proxy
96
+
97
+ # Create a scope manifest
98
+ cat > scope.json << 'EOF'
99
+ {
100
+ "engagement_id": "ENG-2025-0042",
101
+ "client": "Acme Corp",
102
+ "operator": "operator@yourfirm.com",
103
+ "authorized_targets": {
104
+ "ip_ranges": ["10.10.10.0/24"],
105
+ "domains": ["*.acme.com"],
106
+ "urls": [],
107
+ "cloud_accounts": []
108
+ },
109
+ "excluded_targets": ["hr.acme.com"],
110
+ "authorized_techniques": ["recon", "web_app"],
111
+ "excluded_techniques": ["dos", "destructive", "social_engineering"],
112
+ "engagement_window": {
113
+ "start": "2026-03-27T08:00:00Z",
114
+ "end": "2026-04-10T17:00:00Z"
115
+ }
116
+ }
117
+ EOF
118
+
119
+ # Run the proxy (stdio mode, wrapping kali-mcp)
120
+ SCOPE_MANIFEST_PATH=./scope.json \
121
+ UPSTREAM_MCP_COMMAND=npx \
122
+ UPSTREAM_MCP_ARGS="-y,@anthropic/kali-mcp" \
123
+ integsec-agentic-pentest-proxy
124
+ ```
125
+
126
+ The proxy will intercept all tool calls, validate targets against scope.json, and log decisions to `./audit/`.
127
+
128
+ ---
129
+
130
+ ## Installation
131
+
132
+ ### npm (global)
133
+
134
+ ```bash
135
+ npm install -g @integsec/agentic-pentest-proxy
136
+ ```
137
+
138
+ ### npm (project-local)
139
+
140
+ ```bash
141
+ npm install @integsec/agentic-pentest-proxy
142
+ ```
143
+
144
+ ### From source
145
+
146
+ ```bash
147
+ git clone https://github.com/integsec/agentic-pentest-mcp-proxy.git
148
+ cd agentic-pentest-mcp-proxy
149
+ npm install
150
+ npm run build
151
+ ```
152
+
153
+ ### Docker
154
+
155
+ ```bash
156
+ docker build -t integsec-agentic-pentest-proxy .
157
+ docker run --rm \
158
+ -e SCOPE_MANIFEST_PATH=/scope.json \
159
+ -e MCP_TRANSPORT=sse \
160
+ -e UPSTREAM_MCP_URL=http://host.docker.internal:8080 \
161
+ -e PROXY_PORT=9090 \
162
+ -v ./scope.json:/scope.json:ro \
163
+ -p 9090:9090 \
164
+ integsec-agentic-pentest-proxy
165
+ ```
166
+
167
+ ---
168
+
169
+ ## Configuration
170
+
171
+ ### Scope Manifest
172
+
173
+ The scope manifest defines the boundaries of a penetration testing engagement. It is validated against a strict Zod schema on load.
174
+
175
+ ```jsonc
176
+ {
177
+ // Unique engagement identifier — used in audit log filenames
178
+ "engagement_id": "ENG-2025-0142",
179
+
180
+ // Client and operator for audit attribution
181
+ "client": "Acme Corp",
182
+ "operator": "operator@integsec.com",
183
+
184
+ // What the AI agent IS allowed to target
185
+ "authorized_targets": {
186
+ "ip_ranges": ["10.10.10.0/24", "203.0.113.0/28"],
187
+ "domains": ["*.acme.com", "acme-staging.example.com"],
188
+ "urls": ["https://app.acme.com", "https://api.acme.com"],
189
+ "cloud_accounts": ["aws:123456789012"]
190
+ },
191
+
192
+ // Override: these are NEVER allowed even if they match above
193
+ "excluded_targets": ["203.0.113.5", "hr.acme.com"],
194
+
195
+ // Technique categories (for reference / future enforcement)
196
+ "authorized_techniques": ["recon", "web_app", "api_testing"],
197
+
198
+ // Tool categories that are always blocked
199
+ "excluded_techniques": ["dos", "destructive", "social_engineering"],
200
+
201
+ // Time window — calls outside this range are blocked
202
+ "engagement_window": {
203
+ "start": "2026-03-26T08:00:00Z",
204
+ "end": "2026-04-09T17:00:00Z"
205
+ }
206
+ }
207
+ ```
208
+
209
+ **Loading priority:** The proxy checks these sources in order and uses the first one found:
210
+
211
+ 1. `SCOPE_MANIFEST_JSON` — inline JSON in env var
212
+ 2. `SCOPE_MANIFEST_PATH` — path to a local JSON file
213
+ 3. `SCOPE_MANIFEST_SECRET_ARN` — AWS Secrets Manager
214
+ 4. `SCOPE_MANIFEST_KEYVAULT_URI` — Azure Key Vault
215
+ 5. `SCOPE_MANIFEST_GCP_SECRET` — GCP Secret Manager
216
+
217
+ ### Environment Variables
218
+
219
+ | Variable | Default | Description |
220
+ |----------|---------|-------------|
221
+ | **Manifest (one required)** | | |
222
+ | `SCOPE_MANIFEST_PATH` | — | Path to scope manifest JSON file |
223
+ | `SCOPE_MANIFEST_JSON` | — | Inline scope manifest JSON string |
224
+ | `SCOPE_MANIFEST_SECRET_ARN` | — | AWS Secrets Manager ARN |
225
+ | `SCOPE_MANIFEST_KEYVAULT_URI` | — | Azure Key Vault secret URI |
226
+ | `SCOPE_MANIFEST_GCP_SECRET` | — | GCP Secret Manager resource name |
227
+ | **Transport** | | |
228
+ | `MCP_TRANSPORT` | `stdio` | Transport mode: `stdio` or `sse` |
229
+ | `UPSTREAM_MCP_COMMAND` | — | Command to spawn upstream MCP (stdio mode) |
230
+ | `UPSTREAM_MCP_ARGS` | — | Comma-separated args for upstream command |
231
+ | `UPSTREAM_MCP_URL` | — | Upstream MCP HTTP URL (HTTP mode) |
232
+ | `PROXY_PORT` | `9090` | HTTP listen port (HTTP mode) |
233
+ | **Audit** | | |
234
+ | `AUDIT_LOG_PATH` | `./audit/` | Directory for local JSONL audit logs |
235
+ | `AWS_LOG_GROUP` | — | AWS CloudWatch log group name |
236
+ | `AWS_REGION` | — | AWS region for CloudWatch |
237
+ | `AZURE_LOG_WORKSPACE_ID` | — | Azure Log Analytics workspace ID |
238
+ | `AZURE_DCR_IMMUTABLE_ID` | — | Azure Data Collection Rule immutable ID |
239
+ | `AZURE_DCR_STREAM_NAME` | `Custom-MCPProxyAudit_CL` | Azure DCR stream name |
240
+ | `GOOGLE_CLOUD_PROJECT` | — | GCP project ID for Cloud Logging |
241
+ | **Tuning** | | |
242
+ | `TECHNIQUE_MAP_PATH` | — | Path to custom technique mappings JSON |
243
+ | `DNS_CACHE_TTL` | `60` | DNS cache TTL in seconds |
244
+ | `LOG_LEVEL` | `INFO` | Log verbosity |
245
+ | `PROXY_VERSION` | `0.1.0` | Version string in audit entries |
246
+
247
+ See [`.env.example`](.env.example) for a complete template.
248
+
249
+ ### Technique Mappings
250
+
251
+ The proxy ships with built-in technique categories (`dos`, `destructive`, `social_engineering`). You can extend these with a custom mapping file:
252
+
253
+ ```json
254
+ {
255
+ "wireless": {
256
+ "exact": ["aircrack-ng", "wifite", "kismet"],
257
+ "patterns": ["wifi", "wireless"]
258
+ },
259
+ "physical": {
260
+ "exact": ["lockpick_sim"],
261
+ "patterns": ["physical"]
262
+ }
263
+ }
264
+ ```
265
+
266
+ Point `TECHNIQUE_MAP_PATH` at this file. Custom mappings are merged with built-in ones — they don't replace them.
267
+
268
+ ---
269
+
270
+ ## Usage
271
+
272
+ ### CLI
273
+
274
+ ```bash
275
+ # stdio mode — wrap any MCP server
276
+ SCOPE_MANIFEST_PATH=./scope.json \
277
+ UPSTREAM_MCP_COMMAND=npx \
278
+ UPSTREAM_MCP_ARGS="-y,@anthropic/kali-mcp" \
279
+ integsec-agentic-pentest-proxy
280
+
281
+ # HTTP mode — reverse proxy to a running MCP server
282
+ SCOPE_MANIFEST_PATH=./scope.json \
283
+ MCP_TRANSPORT=sse \
284
+ UPSTREAM_MCP_URL=http://localhost:8080 \
285
+ PROXY_PORT=9090 \
286
+ integsec-agentic-pentest-proxy
287
+ ```
288
+
289
+ ### Claude Desktop Integration
290
+
291
+ Add to your Claude Desktop `claude_desktop_config.json`:
292
+
293
+ ```json
294
+ {
295
+ "mcpServers": {
296
+ "kali-mcp-scoped": {
297
+ "command": "npx",
298
+ "args": ["-y", "@integsec/agentic-pentest-proxy"],
299
+ "env": {
300
+ "SCOPE_MANIFEST_PATH": "/path/to/scope.json",
301
+ "MCP_TRANSPORT": "stdio",
302
+ "UPSTREAM_MCP_COMMAND": "npx",
303
+ "UPSTREAM_MCP_ARGS": "-y,@anthropic/kali-mcp",
304
+ "AUDIT_LOG_PATH": "./audit/"
305
+ }
306
+ }
307
+ }
308
+ }
309
+ ```
310
+
311
+ ### Claude Code Integration
312
+
313
+ Add to your `.mcp.json` or project settings:
314
+
315
+ ```json
316
+ {
317
+ "mcpServers": {
318
+ "kali-scoped": {
319
+ "command": "npx",
320
+ "args": ["-y", "@integsec/agentic-pentest-proxy"],
321
+ "env": {
322
+ "SCOPE_MANIFEST_PATH": "./scope.json",
323
+ "UPSTREAM_MCP_COMMAND": "npx",
324
+ "UPSTREAM_MCP_ARGS": "-y,@anthropic/kali-mcp"
325
+ }
326
+ }
327
+ }
328
+ }
329
+ ```
330
+
331
+ ### Docker
332
+
333
+ ```bash
334
+ # HTTP mode
335
+ docker run --rm \
336
+ -e SCOPE_MANIFEST_PATH=/scope.json \
337
+ -e MCP_TRANSPORT=sse \
338
+ -e UPSTREAM_MCP_URL=http://host.docker.internal:8080 \
339
+ -e PROXY_PORT=9090 \
340
+ -v ./scope.json:/scope.json:ro \
341
+ -v ./audit:/app/audit \
342
+ -p 9090:9090 \
343
+ integsec-agentic-pentest-proxy
344
+
345
+ # With AWS CloudWatch
346
+ docker run --rm \
347
+ -e SCOPE_MANIFEST_SECRET_ARN=arn:aws:secretsmanager:us-east-1:123456789012:secret:scope \
348
+ -e MCP_TRANSPORT=sse \
349
+ -e UPSTREAM_MCP_URL=http://host.docker.internal:8080 \
350
+ -e AWS_LOG_GROUP=/integsec/mcp-proxy \
351
+ -e AWS_REGION=us-east-1 \
352
+ -p 9090:9090 \
353
+ integsec-agentic-pentest-proxy
354
+ ```
355
+
356
+ ---
357
+
358
+ ## How Validation Works
359
+
360
+ Every `tools/call` JSON-RPC message passes through an 8-step validation pipeline:
361
+
362
+ ```
363
+ 1. TECHNIQUE CHECK ──▶ Is the tool in an excluded_techniques category?
364
+ │ YES → BLOCKED_TECHNIQUE
365
+
366
+ 2. TIME WINDOW ──────▶ Is current time within engagement_window?
367
+ │ NO → BLOCKED_OUTSIDE_WINDOW
368
+
369
+ 3. TARGET EXTRACTION ▶ Extract hostname/IP from tool parameters
370
+ │ (19 tool-specific extractors + fallback params)
371
+
372
+ 4. NO TARGET? ───────▶ No target-like parameter found?
373
+ │ YES → ALLOWED_NO_TARGET
374
+
375
+ 5. DNS RESOLUTION ───▶ Resolve hostname to A + AAAA records
376
+ │ NXDOMAIN → BLOCKED_DNS_FAILED
377
+
378
+ 6. EXCLUSION CHECK ──▶ Does target match excluded_targets?
379
+ │ YES → BLOCKED_EXCLUDED_TARGET
380
+
381
+ 7. AUTHORIZATION ────▶ Does target match authorized_targets?
382
+ │ YES → ALLOWED
383
+
384
+ 8. DEFAULT DENY ─────▶ BLOCKED_NOT_IN_SCOPE
385
+ ```
386
+
387
+ **Key design decisions:**
388
+ - **Exclusions beat authorizations.** If `hr.acme.com` is in `excluded_targets`, it's blocked even if `*.acme.com` is authorized.
389
+ - **DNS failures are blocks.** If the proxy can't resolve a hostname, it won't forward the call. Fail closed.
390
+ - **Private IPs require explicit authorization.** RFC-1918 ranges and cloud metadata endpoints (169.254.169.254) are only allowed if they appear in `authorized_targets.ip_ranges`.
391
+ - **No target = allowed.** Tools that don't operate on network targets (e.g., `list_tools`, `get_version`) pass through.
392
+
393
+ ---
394
+
395
+ ## Audit Logging
396
+
397
+ Every validation decision produces an audit entry:
398
+
399
+ ```json
400
+ {
401
+ "timestamp": "2026-03-27T14:32:01.000Z",
402
+ "engagement_id": "ENG-2025-0142",
403
+ "client": "Acme Corp",
404
+ "operator": "operator@integsec.com",
405
+ "tool_name": "nmap_scan",
406
+ "tool_parameters": { "target": "10.10.10.5", "flags": "[REDACTED]" },
407
+ "extracted_target": "10.10.10.5",
408
+ "resolved_ips": ["10.10.10.5"],
409
+ "decision": "ALLOWED",
410
+ "decision_reason": "Target 10.10.10.5 matches authorized IP range 10.10.10.0/24",
411
+ "matched_scope_item": "10.10.10.0/24",
412
+ "duration_ms": 2,
413
+ "proxy_version": "0.1.0"
414
+ }
415
+ ```
416
+
417
+ ### Backends
418
+
419
+ | Backend | Config | Format |
420
+ |---------|--------|--------|
421
+ | **Local** (always active) | `AUDIT_LOG_PATH` | JSONL files: `{engagement_id}.jsonl` |
422
+ | **AWS CloudWatch** | `AWS_LOG_GROUP` + `AWS_REGION` | Log events in `{engagement_id}/{date}` stream |
423
+ | **Azure Monitor** | `AZURE_LOG_WORKSPACE_ID` + `AZURE_DCR_IMMUTABLE_ID` | Logs Ingestion API via Data Collection Rules |
424
+ | **GCP Cloud Logging** | `GOOGLE_CLOUD_PROJECT` | Cloud Logging entries with severity mapping |
425
+
426
+ Multiple backends can be active simultaneously. Entries are buffered and flushed every 5 seconds. Backend failures are isolated — a CloudWatch error won't affect local logging.
427
+
428
+ ### Decision Types
429
+
430
+ | Decision | Meaning |
431
+ |----------|---------|
432
+ | `ALLOWED` | Target matches an authorized scope item |
433
+ | `ALLOWED_NO_TARGET` | Tool has no network target parameter |
434
+ | `BLOCKED_TECHNIQUE` | Tool belongs to an excluded technique category |
435
+ | `BLOCKED_OUTSIDE_WINDOW` | Current time is outside the engagement window |
436
+ | `BLOCKED_EXCLUDED_TARGET` | Target is explicitly excluded |
437
+ | `BLOCKED_NOT_IN_SCOPE` | Target doesn't match any authorized scope item |
438
+ | `BLOCKED_DNS_FAILED` | DNS resolution returned no addresses |
439
+
440
+ ---
441
+
442
+ ## Examples
443
+
444
+ See the [`examples/`](examples/) directory for:
445
+
446
+ - **[`scope-manifest.json`](examples/scope-manifest.json)** — a real-world scope manifest
447
+ - **[`claude-desktop-config.json`](examples/claude-desktop-config.json)** — Claude Desktop integration config
448
+ - **[`technique-map.json`](examples/technique-map.json)** — custom technique category mappings
449
+
450
+ ---
451
+
452
+ ## Contributing
453
+
454
+ Contributions are welcome. The IntegSec Agentic Pentest MCP Proxy is an open-source project under the MIT license.
455
+
456
+ ### Architecture
457
+
458
+ ```
459
+ bin/
460
+ integsec-agentic-pentest-proxy.ts CLI entry point — loads config, manifest, starts transport
461
+
462
+ src/
463
+ proxy.ts ScopeEnforcementProxy — core orchestrator
464
+ validator.ts ScopeValidator — 8-step validation pipeline
465
+ extractor.ts Target extraction from tool parameters (19 tools + fallback)
466
+ domain-matcher.ts Wildcard and exact domain matching
467
+ ip-matcher.ts CIDR matching, RFC-1918 detection
468
+ dns-resolver.ts Caching DNS resolver with deduplication
469
+ technique-checker.ts Tool → technique category mapping
470
+ sanitizer.ts Parameter redaction for audit logs
471
+ manifest.ts Manifest loading (file, env, AWS, Azure, GCP)
472
+ manifest-schema.ts Zod schema for scope manifest
473
+ config.ts Environment variable loader
474
+ types.ts TypeScript type definitions
475
+
476
+ audit/
477
+ index.ts AuditLogger facade — manages multiple backends
478
+ local.ts Local JSONL file logger
479
+ cloudwatch.ts AWS CloudWatch backend
480
+ azure-monitor.ts Azure Monitor backend
481
+ gcp-logging.ts GCP Cloud Logging backend
482
+
483
+ transports/
484
+ stdio.ts stdio transport — spawns upstream as child process
485
+ http.ts HTTP reverse proxy transport
486
+ ```
487
+
488
+ ### Development Setup
489
+
490
+ ```bash
491
+ # Clone the repo
492
+ git clone https://github.com/integsec/agentic-pentest-mcp-proxy.git
493
+ cd agentic-pentest-mcp-proxy
494
+
495
+ # Install dependencies
496
+ npm install
497
+
498
+ # Build
499
+ npm run build
500
+
501
+ # Run tests
502
+ npm test
503
+
504
+ # Watch mode (rebuild on change)
505
+ npm run dev
506
+
507
+ # Type check without emitting
508
+ npm run lint
509
+ ```
510
+
511
+ **Requirements:**
512
+ - Node.js >= 20.0.0
513
+ - npm >= 9
514
+
515
+ ### Project Structure
516
+
517
+ The codebase follows these principles:
518
+
519
+ - **Pure TypeScript, ES modules** — no CommonJS, no bundler
520
+ - **Zod for runtime validation** — all external data is schema-validated
521
+ - **Fail-closed security** — when in doubt, block
522
+ - **Isolated backends** — failures in one audit backend never affect others
523
+ - **No classes where functions suffice** — classes only for stateful components (DnsResolver, AuditLogger, ScopeEnforcementProxy)
524
+ - **No external HTTP framework** — uses Node.js built-in `http` module for the HTTP transport
525
+
526
+ ### Testing
527
+
528
+ Tests use [Vitest](https://vitest.dev/) and are organized into unit and integration suites.
529
+
530
+ ```bash
531
+ # Run all tests
532
+ npm test
533
+
534
+ # Run tests in watch mode
535
+ npm run test:watch
536
+
537
+ # Run a specific test file
538
+ npx vitest run tests/unit/validator.test.ts
539
+ ```
540
+
541
+ **Test structure:**
542
+
543
+ ```
544
+ tests/
545
+ unit/
546
+ validator.test.ts Validation pipeline (comprehensive)
547
+ extractor.test.ts Target extraction for 19 tools + fallback
548
+ domain-matcher.test.ts Domain pattern matching
549
+ ip-matcher.test.ts CIDR and private IP detection
550
+ dns-resolver.test.ts DNS caching and deduplication
551
+ manifest-schema.test.ts Scope manifest schema validation
552
+ manifest.test.ts Manifest loading from all sources
553
+ technique-checker.test.ts Technique categorization
554
+ sanitizer.test.ts Parameter redaction
555
+ audit-local.test.ts Local audit file writing
556
+ smoke.test.ts Module import sanity check
557
+ integration/
558
+ proxy.test.ts Full message flow through proxy
559
+ fixtures/
560
+ scope-valid.json Valid scope manifest
561
+ scope-expired.json Expired scope manifest
562
+ tool-calls.json Sample JSON-RPC messages
563
+ ```
564
+
565
+ **Writing tests:**
566
+ - Every new module should have a corresponding test file in `tests/unit/`
567
+ - Use the fixtures in `tests/fixtures/` for scope manifests and tool call payloads
568
+ - Mock DNS and cloud SDKs in unit tests; integration tests use the full proxy
569
+ - Aim for edge cases: invalid inputs, boundary conditions, Unicode domains, IPv6, etc.
570
+
571
+ ### Adding a New Audit Backend
572
+
573
+ 1. Create `src/audit/your-backend.ts` implementing the `AuditBackend` interface:
574
+ ```typescript
575
+ export interface AuditBackend {
576
+ name: string;
577
+ write(entries: AuditEntry[]): Promise<void>;
578
+ }
579
+ ```
580
+ 2. Add it to the AuditLogger in `bin/integsec-agentic-pentest-proxy.ts` when the relevant env vars are set.
581
+ 3. Add a unit test in `tests/unit/audit-your-backend.test.ts`.
582
+ 4. Document the env vars in this README and `.env.example`.
583
+
584
+ ### Adding Tool Extraction Support
585
+
586
+ To add target extraction for a new tool, edit `src/extractor.ts`:
587
+
588
+ 1. Add the tool name to the `TOOL_MAPPINGS` array with its target parameter name(s).
589
+ 2. If the tool uses a non-standard parameter format, add a case to the extraction logic.
590
+ 3. Add test cases in `tests/unit/extractor.test.ts`.
591
+
592
+ ### Code Style
593
+
594
+ - TypeScript strict mode
595
+ - No `any` types — use `unknown` and narrow
596
+ - Explicit return types on exported functions
597
+ - No default exports — use named exports
598
+ - Keep functions small and focused
599
+ - Security-sensitive code gets extra test coverage
600
+
601
+ ---
602
+
603
+ ## Roadmap
604
+
605
+ The following is the planned development roadmap for the IntegSec Agentic Pentest MCP Proxy. Items are grouped by phase and roughly ordered by priority within each phase.
606
+
607
+ ### Phase 1 — Core Hardening (v0.2)
608
+
609
+ - [ ] **Signed scope manifests** — Ed25519 signatures on manifests to prevent tampering, with key pinning
610
+ - [ ] **Manifest hot-reload** — watch manifest file for changes and reload without restart
611
+ - [ ] **Scope manifest v2 schema** — add per-tool overrides, port ranges, protocol restrictions, and path-level URL scoping
612
+ - [ ] **Rate limiting** — per-tool and per-target rate limits to prevent runaway agents
613
+ - [ ] **Metrics endpoint** — Prometheus `/metrics` with counters for allowed/blocked decisions, latency histograms
614
+ - [ ] **WebSocket transport** — support MCP over WebSocket for persistent connections
615
+ - [ ] **Plugin system for validators** — allow custom validation steps via a plugin interface
616
+
617
+ ### Phase 2 — Interception & Manipulation Engine (v0.3)
618
+
619
+ > Burp Suite-style interception, inspection, and modification of MCP tool calls in real time.
620
+
621
+ - [ ] **Intercept mode** — pause tool calls before forwarding, allowing human review and approval
622
+ - [ ] **Request modification** — edit tool parameters before forwarding (e.g., add `--safe-mode` flags, restrict scan intensity)
623
+ - [ ] **Response modification** — filter or transform upstream responses before they reach the AI agent
624
+ - [ ] **Replay engine** — capture and replay tool call sequences for testing and training
625
+ - [ ] **Match & replace rules** — regex-based rules to automatically rewrite parameters (e.g., replace hostnames, inject headers)
626
+ - [ ] **Breakpoints** — conditional breakpoints on tool name, target, technique, or parameter patterns
627
+ - [ ] **Interception history** — searchable log of all intercepted, modified, forwarded, and dropped messages
628
+ - [ ] **Scope diff viewer** — visual diff showing what the agent requested vs. what was actually forwarded
629
+ - [ ] **Redirection engine** — reroute tool calls to alternative targets (e.g., redirect production targets to staging, honeypots, or simulation environments)
630
+ - [ ] **Upstream multiplexing** — forward a single tool call to multiple upstream servers simultaneously for comparison or redundancy
631
+
632
+ ### Phase 3 — Terminal UI (v0.4)
633
+
634
+ > A real-time terminal dashboard for monitoring and controlling the proxy from the command line.
635
+
636
+ - [ ] **Live decision feed** — streaming view of ALLOWED/BLOCKED decisions as they happen
637
+ - [ ] **Scope summary panel** — display active engagement info, authorized targets, and time window countdown
638
+ - [ ] **Audit log viewer** — browse and filter audit entries with keyboard navigation
639
+ - [ ] **Intercept queue** — review, approve, modify, or drop pending intercepted tool calls from the TUI
640
+ - [ ] **Target heatmap** — ASCII visualization of which targets are being hit and how often
641
+ - [ ] **Technique breakdown** — live stats on tool categories being used
642
+ - [ ] **Session management** — start, pause, resume, and terminate proxy sessions
643
+ - [ ] **Keyboard shortcuts** — vim-style bindings for rapid navigation
644
+ - [ ] **Multi-pane layout** — configurable split views (decisions + audit + intercept queue)
645
+ - [ ] **Dark/light themes** — because terminal aesthetics matter
646
+
647
+ ### Phase 4 — Web GUI (v0.5)
648
+
649
+ > Full-featured browser-based interface for teams, with collaboration features.
650
+
651
+ - [ ] **Dashboard** — real-time overview of active engagements, decision rates, and alerts
652
+ - [ ] **Scope manifest editor** — visual editor with validation, preview, and version history
653
+ - [ ] **Audit explorer** — filterable, sortable table of all audit entries with export (CSV, JSON)
654
+ - [ ] **Intercept workspace** — browser-based intercept, modify, and forward interface with syntax highlighting
655
+ - [ ] **Request/response inspector** — detailed view of tool call parameters, extracted targets, DNS results, and validation steps
656
+ - [ ] **Engagement timeline** — chronological visualization of all tool calls with scope boundary overlay
657
+ - [ ] **Team collaboration** — multi-user access with role-based permissions (operator, reviewer, read-only)
658
+ - [ ] **Engagement management** — create, clone, archive, and compare scope manifests across engagements
659
+ - [ ] **Alert rules** — configurable notifications (email, Slack, webhook) on scope violations or anomalous patterns
660
+ - [ ] **Report generation** — exportable engagement summary with decision statistics, target coverage, and compliance evidence
661
+ - [ ] **API** — REST/GraphQL API for programmatic access to all GUI features
662
+
663
+ ### Phase 5 — Offensive Security MCP Marketplace (v1.0)
664
+
665
+ > A curated registry of offensive security MCP servers, each with scope enforcement metadata.
666
+
667
+ - [ ] **Server registry** — searchable catalog of offensive security MCP servers (recon, exploitation, post-exploitation, reporting)
668
+ - [ ] **Scope profiles** — each server publishes a scope profile declaring what targets/techniques it can affect
669
+ - [ ] **One-click install** — install and configure MCP servers with automatic scope proxy wrapping
670
+ - [ ] **Compatibility matrix** — which servers work with which AI agents (Claude, GPT, local LLMs)
671
+ - [ ] **Community submissions** — submit and review MCP servers with quality ratings and security audits
672
+ - [ ] **Technique taxonomy** — standardized technique categories (aligned with MITRE ATT&CK) for cross-server filtering
673
+ - [ ] **Composite workflows** — chain multiple MCP servers into multi-stage attack workflows with per-stage scope constraints
674
+ - [ ] **Sandboxed preview** — try MCP servers against a built-in vulnerable target before deploying
675
+ - [ ] **License and compliance metadata** — track licensing, data handling, and compliance requirements per server
676
+ - [ ] **Version management** — pin server versions, get update notifications, and review changelogs
677
+
678
+ ### Phase 6 — Enterprise & Ecosystem (v1.x)
679
+
680
+ - [ ] **SSO/OIDC integration** — enterprise authentication for the GUI and API
681
+ - [ ] **Centralized policy server** — manage scope manifests across multiple proxies from a single control plane
682
+ - [ ] **SIEM integration** — forward audit logs to Splunk, Elastic, Sentinel, etc.
683
+ - [ ] **Compliance reporting** — automated reports for PCI-DSS, SOC 2, ISO 27001, and CREST engagement evidence
684
+ - [ ] **Agent behavior analytics** — ML-based detection of anomalous agent behavior (target drift, technique escalation)
685
+ - [ ] **Multi-agent support** — scope enforcement across multiple concurrent AI agents with shared state
686
+ - [ ] **Engagement templates** — pre-built scope manifests for common engagement types (web app, internal network, cloud, API)
687
+ - [ ] **SDK / library mode** — import scope validation as a library into custom agent frameworks without running a proxy
688
+ - [ ] **CI/CD integration** — validate scope manifests in CI pipelines, run automated scope compliance checks
689
+
690
+ ### Future Explorations
691
+
692
+ - **MCP-native protocol extensions** — propose scope enforcement as a first-class MCP protocol feature
693
+ - **Hardware security module (HSM) support** — store manifest signing keys in HSMs
694
+ - **Air-gapped mode** — offline operation with pre-loaded manifests and local-only audit
695
+ - **Agent scoring** — track per-agent compliance rates and generate trust scores over time
696
+
697
+ ---
698
+
699
+ ## About IntegSec
700
+
701
+ **[IntegSec](https://integsec.com)** delivers human-expert-led agentic penetration testing for modern organizations moving at AI speed. We combine seasoned offensive security professionals with autonomous AI agents to find real vulnerabilities — not just scan results.
702
+
703
+ ### Our Services
704
+
705
+ - **[Pentest as a Service (PTaaS)](https://integsec.com/become-unbreachable)** — continuous human-led penetration testing for web apps, networks, APIs, and cloud environments
706
+ - **[Adversary Simulation & Red Teaming](https://integsec.com/redteaming)** — real-world attack simulations to evaluate your security posture
707
+ - **LLM Red Teaming** — security testing for AI/LLM applications
708
+ - **OWASP Reviews** — structured assessments aligned with OWASP Testing Guides
709
+ - **Offensive Cybersecurity Training** — level up your team's security skills
710
+
711
+ ### TurboPentest
712
+
713
+ **[TurboPentest](https://turbopentest.com)** is our agentic penetration testing platform. Paladin AI agents powered by Claude orchestrate 15 professional security tools — Nmap, OWASP ZAP, Nuclei, Nikto, Subfinder, FFUF, OpenVAS, Semgrep, and more — to deliver comprehensive security assessments in under 4 hours.
714
+
715
+ - OWASP Top 10 coverage with validated exploits, not just potential findings
716
+ - Black box and white box testing with GitHub integration
717
+ - Blockchain-attested reports (SHA-256 hashed, anchored to Base L2)
718
+ - CI/CD, VS Code, and Burp Suite Pro integrations
719
+ - **Starting at $99/domain** — [try it now](https://turbopentest.com)
720
+
721
+ > **Need human expertise + AI speed?** [Contact IntegSec](https://integsec.com) for expert-led pentesting backed by the same AI agents that power TurboPentest.
722
+
723
+ ---
724
+
725
+ ## License
726
+
727
+ MIT License. See [LICENSE](LICENSE) for details.
728
+
729
+ ---
730
+
731
+ Built by **[IntegSec](https://integsec.com)** | **[TurboPentest](https://turbopentest.com)** | [GitHub](https://github.com/integsec) | [Twitter](https://x.com/integ_sec)