fullcourtdefense-cli 1.21.13 → 1.21.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,721 +1,721 @@
1
- # FullCourtDefense CLI
2
-
3
- [Full Court Defense](https://fullcourtdefense.ai/) is an AI agent security platform and runtime firewall for teams shipping LLM apps, agentic workflows, MCP tools, and RAG systems. We help builders find and block prompt injection, jailbreaks, data exfiltration, unsafe tool use, and poisoned retrieval content before those failures reach production.
4
-
5
- The FullCourtDefense CLI brings that security workflow to your terminal. It can run hosted CI/CD scans against public agents, or local in-organization scans against private APIs, MCP servers, RAG document corpora, and live RAG services. Local scans execute from your machine or VPN, then send captured content outbound to your Shield for verdicts and saved web reports.
6
-
7
- ## Install
8
-
9
- ```bash
10
- npm install -g fullcourtdefense-cli
11
- # or run directly
12
- npx fullcourtdefense-cli scan
13
- ```
14
-
15
- ## Quick Start (protect this machine)
16
-
17
- One command takes a fresh machine to a verified protected machine: connectivity check, fleet enrollment, MCP gateway wrapping, IDE hooks, terminal guards, discovery upload, and a green/red verification checklist.
18
-
19
- ```bash
20
- # An org admin issues a fleet enrollment token in the web app:
21
- # AI Fleet -> Settings -> Fleet enrollment token
22
-
23
- fullcourtdefense onboard --token <fleet-enrollment-token>
24
- # or: set FCD_ENROLL_TOKEN and run `fullcourtdefense onboard`
25
- ```
26
-
27
- Then restart your AI clients (Cursor, Claude, VS Code, ...) so they pick up the wrapped configs. The machine reports to your org's AI Fleet in monitor-first mode until an admin enables enforcement.
28
-
29
- Onboarding is a resumable local transaction. Its non-secret status journal is
30
- stored at `~/.fullcourtdefense/onboarding.json`; use `--resume` after an
31
- interruption and `--repair` to re-run completed protection installation steps.
32
- Discovery upload and its daily schedule are recorded as optional telemetry,
33
- separate from required protection. Useful MDM options:
34
-
35
- ```bash
36
- fullcourtdefense onboard --dry-run true --json true # preflight + final JSON status
37
- fullcourtdefense onboard --resume # continue a failed transaction
38
- fullcourtdefense onboard --resume --repair # reinstall protection surfaces
39
- fullcourtdefense onboard --schedule false # do not install daily discovery
40
- fullcourtdefense onboard --no-daemon true # do not enable optional self-healing
41
- ```
42
-
43
- Manual step-by-step equivalent:
44
-
45
- ```bash
46
- fullcourtdefense doctor # 1. outbound HTTPS check
47
- fullcourtdefense login --token <fleet-enrollment-token> # 2. enroll (zero paste)
48
- fullcourtdefense install-all # 3. protect every AI client
49
- fullcourtdefense protect-all --dry-run true # 4. verify gateways
50
- ```
51
-
52
- ## Quick Start (scanning)
53
-
54
- ```bash
55
- # Run an in-organization local scan with guided questions
56
- fullcourtdefense scan --local
57
-
58
- # Run a detailed MCP report
59
- fullcourtdefense scan --local --type mcp --mcp-command node --mcp-args ./server.js --mcp-tool all --mode full --format report
60
-
61
- # Hosted CI/CD scan, if using an API key instead of local Shield scan
62
- fullcourtdefense scan --api-key YOUR_KEY --endpoint https://my-agent.com/chat --description "My chatbot"
63
-
64
- # Check remaining credits
65
- fullcourtdefense credits --api-key YOUR_KEY
66
-
67
- # Generate a config file
68
- fullcourtdefense init
69
- ```
70
-
71
- ## Command Guide
72
-
73
- - `fullcourtdefense help` — shows the full onboarding flow and command reference.
74
- - `fullcourtdefense onboard --token <token>` — resumable machine transaction: preflight + login + protection + optional discovery + verification. `--json true` prints final machine-readable status; exits non-zero only when a critical step fails.
75
- - `fullcourtdefense doctor` — confirms outbound HTTPS to FullCourtDefense is open before scanning.
76
- - `fullcourtdefense login --token <token>` — enrolls this machine with a fleet token and saves per-machine Shield credentials (no copy/paste).
77
- - `fullcourtdefense install-all` — wraps every configured MCP server, installs IDE hooks and terminal guards, uploads discovery, schedules daily rescans.
78
- - `fullcourtdefense configure` — legacy/manual setup: saves org API key, Shield ID, Shield key, and API URL to `.fullcourtdefense.yml` (use `login` instead when you have a fleet token).
79
- - `fullcourtdefense scan --local` — runs inside the customer network and asks whether to scan endpoint, MCP, or RAG.
80
- - `fullcourtdefense scan --local --type mcp ...` — launches a local stdio MCP server, calls tools, and sends tool responses to Shield.
81
- - `fullcourtdefense scan --local --type rag ...` — scans local RAG files/directories or a live RAG HTTP service.
82
- - `fullcourtdefense scan --local --type endpoint ...` — scans an internal HTTP/OpenAI-compatible endpoint.
83
- - `fullcourtdefense install-cursor-mcp-gateway ...` — registers the protected MCP gateway in Cursor.
84
- - `fullcourtdefense install-claude-code-mcp-gateway ...` — registers the protected MCP gateway in Claude Code.
85
- - `fullcourtdefense install-claude-desktop-mcp-gateway ...` — registers the protected MCP gateway in Claude Desktop.
86
- - `fullcourtdefense credits` — checks hosted scan credits for CI/CD API-key scans.
87
- - `fullcourtdefense discover` — scans local MCP client configs and reports risk; `--upload` sends desktop inventory to AI Inventory.
88
- - `fullcourtdefense init` — creates a starter config file.
89
-
90
- ## Shadow AI / Desktop Discovery
91
-
92
- Find MCP servers configured on developer machines without reading chat history or spawning stdio servers by default:
93
-
94
- ```bash
95
- # Scan this machine and print results
96
- fullcourtdefense discover
97
-
98
- # JSON output (includes host fingerprint + servers)
99
- fullcourtdefense discover --json
100
-
101
- # Upload to AI Inventory (requires CI/CD API key with audit:write)
102
- fullcourtdefense discover --upload --api-key YOUR_KEY
103
-
104
- # Live-probe HTTP/SSE MCP servers for tools/list (stdio stays config-only)
105
- fullcourtdefense discover --deep
106
-
107
- # Fleet / MDM script — silent upload with user attribution
108
- fullcourtdefense discover --upload --silent --user-email you@company.com --api-key YOUR_KEY
109
-
110
- # Daily automatic scan on this laptop (uses API key from env or ~/.fullcourtdefense.yml)
111
- fullcourtdefense discover --schedule daily --user-email you@company.com
112
-
113
- # Remove daily schedule
114
- fullcourtdefense discover --unschedule true
115
-
116
- # Scan an extra config path
117
- fullcourtdefense discover --path /path/to/mcp.json
118
- ```
119
-
120
- Each upload includes host metadata (`machineId`, `hostname`, `platform`, `user`) so the same MCP server on different laptops appears as separate desktop inventory rows. The CLI is also available as `fcd` or `botguard` after global install.
121
-
122
- ## Config File
123
-
124
- Create a `.fullcourtdefense.yml` to avoid passing flags every time:
125
-
126
- ```yaml
127
- apiKey: ${FULLCOURTDEFENSE_API_KEY}
128
- apiUrl: https://api.fullcourtdefense.ai
129
- shieldId: sh_your_shield_id
130
- # shieldKey: shsk_optional_if_locked
131
- scan:
132
- endpoint: https://my-agent.com/chat
133
- description: "Customer support chatbot"
134
- categories: [jailbreak, prompt_injection, data_extraction]
135
- failThreshold: 80
136
- format: table
137
- ```
138
-
139
- Then just run:
140
-
141
- ```bash
142
- fullcourtdefense scan
143
- ```
144
-
145
- ## Modes
146
-
147
- Hosted scans use a CI/CD API key and scan a public or reachable agent endpoint through the FullCourtDefense backend.
148
-
149
- | Mode | Use When | Behavior |
150
- |---|---|---|
151
- | `--mode sync` | Small hosted scans from CI or a terminal | Waits for the hosted scan result before exiting. |
152
- | `--mode async` | Longer hosted scans | Starts a hosted job, polls until complete, then prints the result. |
153
-
154
- Local scans run from the customer machine or VPN and only send captured text outbound to Shield for verdicts.
155
-
156
- | Mode | Use When | Behavior |
157
- |---|---|---|
158
- | `--mode quick` | Smoke test before a demo or install handoff | Runs a small default attack set. |
159
- | `--mode full` | Real evidence report | Runs the bundled 229+ attack corpus. |
160
- | `--mode targeted` | You know what the agent protects | Runs default plus targeted attacks and appends `--description` as focus context. |
161
- | `--mode deep` | Stress and broad regression testing | Runs the broad corpus plus deeper multi-step/stress cases. |
162
-
163
- ## Full Option Reference
164
-
165
- ### Global
166
-
167
- | Flag | Applies To | Description | Default |
168
- |---|---|---|---|
169
- | `--help`, `-h` | all commands | Show help. | — |
170
- | `--version`, `-v` | all commands | Print package version. | — |
171
- | `--config <path>` | scan/config | Path to `.fullcourtdefense.yml`, `.fullcourtdefense.yaml`, or legacy `.botguard.yml`. | auto-detect |
172
- | `--api-url <url>` | doctor/configure/scan | FullCourtDefense backend URL. | `https://api.fullcourtdefense.ai` |
173
-
174
- ### Shield And Hosted API
175
-
176
- | Flag | Applies To | Description | Default |
177
- |---|---|---|---|
178
- | `--api-key <key>` | hosted scan/credits | Hosted scan API key. Can also use `FULLCOURTDEFENSE_API_KEY` or legacy `BOTGUARD_API_KEY`. | config/env |
179
- | `--shield-id <id>` | local scan | Shield ID from the Shield Integrate tab. Can also use `FULLCOURTDEFENSE_SHIELD_ID`, `FCD_SHIELD_ID`, or `AGENTGUARD_SHIELD_ID`. | config/env/prompt |
180
- | `--shield-key <key>` | local scan | Optional Shield key for locked Shields. Can also use `FULLCOURTDEFENSE_SHIELD_KEY`, `FCD_SHIELD_KEY`, or `AGENTGUARD_SHIELD_KEY`. | config/env/prompt |
181
-
182
- ### Hosted Scan
183
-
184
- | Flag | Applies To | Description | Default |
185
- |---|---|---|---|
186
- | `--endpoint <url>` | hosted scan | Public/reachable AI agent API URL. | config |
187
- | `--description <text>` | hosted scan/local targeted | Agent description. For `--mode targeted`, also used as local focus context. | config |
188
- | `--system-prompt <text-or-path>` | hosted scan | System prompt text or path to a file. | config |
189
- | `--categories <list>` | hosted scan | Comma-separated attack categories. | all |
190
- | `--attack-count <n>` | hosted/local | Limit number of attacks. Useful for smoke tests. | mode default |
191
- | `--webhook-format <fmt>` | hosted scan | Webhook format: `n8n`, `make`, `zapier`, or `custom`. Legacy alias for local request format. | — |
192
-
193
- ### Local Target Selection
194
-
195
- | Flag | Applies To | Description | Default |
196
- |---|---|---|---|
197
- | `--local` | scan | Run from this machine, inside the customer's network/VPN. | false |
198
- | `--type <type>` | local scan | Local target type: `endpoint`, `mcp`, or `rag`. | prompt |
199
-
200
- ### Local HTTP API Endpoint
201
-
202
- | Flag | Applies To | Description | Default |
203
- |---|---|---|---|
204
- | `--endpoint <url>` | `--type endpoint` | Internal HTTP API URL, for example `http://agent.local/chat`. | prompt |
205
- | `--method <GET|POST>` | endpoint/rag-url | HTTP method. | prompt/`POST` |
206
- | `--request-format <fmt>` | endpoint/rag-url | Request body shape: `custom` or `openai`. | prompt/`custom` |
207
- | `--input-field <field>` | endpoint/rag-url | Request field that receives the attack prompt, for example `message`, `query`, `question`, or `input`. | `message` |
208
- | `--output-field <field>` | endpoint/rag-url | Response field containing the bot answer, for example `answer`, `response`, `text`, or `choices.0.message.content`. | auto-detect |
209
- | `--auth-type <type>` | endpoint/rag-url | HTTP auth type: `none`, `bearer`, `basic`, or `api-key`. | `none` |
210
- | `--username <user>` | endpoint/rag-url basic auth | Basic auth username. | prompt |
211
- | `--password <pass>` | endpoint/rag-url basic auth | Basic auth password. | prompt |
212
- | `--token <token>` | endpoint/rag-url bearer auth | Bearer token. | prompt |
213
- | `--api-key-header <header>` | endpoint/rag-url API-key auth | API key header name, for example `X-API-Key`. | `X-API-Key` |
214
- | `--endpoint-api-key <key>` | endpoint/rag-url API-key auth | API key value for the scanned endpoint. | prompt |
215
-
216
- ### MCP
217
-
218
- | Flag | Applies To | Description | Default |
219
- |---|---|---|---|
220
- | `--mcp-command <cmd>` | stdio MCP | Command that starts the MCP server, for example `node`, `python`, or `npx.cmd`. | prompt |
221
- | `--mcp-args <args>` | stdio MCP | Args passed to `--mcp-command`, for example `.\dist\server.js`. JSON array strings are also supported. | empty |
222
- | `--mcp-url <url>` | HTTP/SSE MCP | Already-running MCP URL, for example `https://internal.company.com/mcp`. | prompt |
223
- | `--mcp-transport <t>` | MCP | Transport: `stdio`, `http`, or `sse`. HTTP/SSE can usually be inferred from `--mcp-url`. | inferred |
224
- | `--mcp-tool <tool>` | MCP | Tool to scan, or `all` to scan every listed tool. | `all` when destination is provided |
225
- | `--mcp-tool-args <json>` | MCP | Tool args JSON. Use `{{attack}}` anywhere the current attack prompt should be inserted. | `{}` |
226
- | `--mcp-auth-type <type>` | HTTP/SSE MCP | Auth type: `none`, `bearer`, `basic`, or `api-key`. | `none` |
227
- | `--mcp-token <token>` | HTTP/SSE MCP bearer auth | Bearer token. | prompt |
228
- | `--mcp-username <user>` | HTTP/SSE MCP basic auth | Basic auth username. | prompt |
229
- | `--mcp-password <pass>` | HTTP/SSE MCP basic auth | Basic auth password. | prompt |
230
- | `--mcp-api-key-header <header>` | HTTP/SSE MCP API-key auth | API key header name. | `X-API-Key` |
231
- | `--mcp-api-key <key>` | HTTP/SSE MCP API-key auth | API key value. | prompt |
232
- | `--progress <mode>` | MCP | Console progress: `verbose`, `compact`, or `silent`. | `verbose` |
233
- | `--server-name <name>` | MCP gateway installers | MCP server name to write into the client config. | `agentguard-gateway` |
234
- | `--developer-name <name>` | MCP gateway installers | Runtime identity used for user-scoped Action Policies. Auto-detected from `FCD_DEVELOPER_NAME`, git email, npm username, or OS username. | auto |
235
- | `--agent-name <name>` | MCP gateway installers | Runtime agent name shown in AI Users. Auto-generated from runtime identity plus client, e.g. `boaz.lautman-claude-desktop`. | auto |
236
- | `--scope <scope>` | Claude Code gateway installer | Claude Code MCP scope: `local`, `project`, or `user`. | `local` |
237
- | `--config-path <path>` | Claude Desktop gateway installer | Override path to `claude_desktop_config.json`. | OS default |
238
-
239
- ### RAG
240
-
241
- | Flag | Applies To | Description | Default |
242
- |---|---|---|---|
243
- | `--rag-path <path>` | `--type rag` | Local RAG file or directory to scan as a corpus. Supports `.txt`, `.md`, `.json`, `.csv`, and `.html`. | prompt |
244
- | `--rag-url <url>` | `--type rag` | Live RAG HTTP endpoint to scan like an app. Uses the same HTTP flags as endpoint scans. | — |
245
-
246
- ### Output And CI
247
-
248
- | Flag | Applies To | Description | Default |
249
- |---|---|---|---|
250
- | `--mode <mode>` | scan | Hosted: `sync`, `async`. Local: `quick`, `full`, `targeted`, `deep`. | hosted `sync`, local `quick` |
251
- | `--format <fmt>` | scan | Output: `table`, `summary`, `report`, `full-report`, or `json`. | hosted `table`, local `summary` |
252
- | `--fail-threshold <n>` | scan | Exit with code 1 if score is below this 0-100 threshold. | `0` |
253
-
254
- ## Realistic Command Examples
255
-
256
- ### First-Time Setup
257
-
258
- Run these on the same machine that can reach the customer's private agent, MCP server, or RAG service:
259
-
260
- ```powershell
261
- fullcourtdefense doctor
262
- fullcourtdefense configure
263
- fullcourtdefense scan --local
264
- ```
265
-
266
- Expected `doctor` output:
267
-
268
- ```text
269
- BotGuard outbound diagnostic
270
- Target: https://api.fullcourtdefense.ai
271
-
272
- PASS outbound HTTPS open (200, 487ms)
273
- Checked: https://api.fullcourtdefense.ai/api/health/ping
274
- ```
275
-
276
- ### Hosted CI/CD Scan
277
-
278
- Use hosted scans when the agent endpoint is reachable by FullCourtDefense and you have a CI/CD API key.
279
-
280
- ```powershell
281
- $env:FULLCOURTDEFENSE_API_KEY = "bg_live_..."
282
- fullcourtdefense scan --endpoint "https://support-bot.example.com/chat" --description "Customer support chatbot" --mode sync --format summary --fail-threshold 80
283
- ```
284
-
285
- Async hosted scan for a longer job:
286
-
287
- ```powershell
288
- fullcourtdefense scan --api-key "bg_live_..." --endpoint "https://agent.example.com/chat" --description "Production sales assistant" --mode async --format report
289
- ```
290
-
291
- ### Local Modes
292
-
293
- Use quick mode first:
294
-
295
- ```powershell
296
- fullcourtdefense scan --local --type endpoint --endpoint "http://localhost:3000/chat" --method POST --request-format custom --input-field message --output-field response --mode quick --format report
297
- ```
298
-
299
- Use full mode for evidence:
300
-
301
- ```powershell
302
- fullcourtdefense scan --local --type endpoint --endpoint "http://localhost:3000/chat" --method POST --request-format custom --input-field message --output-field response --mode full --format report
303
- ```
304
-
305
- Use targeted mode when you know the protected domain:
306
-
307
- ```powershell
308
- fullcourtdefense scan --local --type endpoint --endpoint "http://localhost:3000/chat" --method POST --request-format custom --input-field message --output-field response --mode targeted --description "Healthcare support bot with patient records and billing data" --format report
309
- ```
310
-
311
- Use deep mode for broad regression:
312
-
313
- ```powershell
314
- fullcourtdefense scan --local --type endpoint --endpoint "http://localhost:3000/chat" --method POST --request-format custom --input-field message --output-field response --mode deep --format full-report
315
- ```
316
-
317
- ### Local API Endpoint Examples
318
-
319
- Typical Express/FastAPI app:
320
-
321
- ```powershell
322
- fullcourtdefense scan --local --type endpoint --endpoint "http://127.0.0.1:8000/chat" --method POST --request-format custom --input-field message --output-field answer --mode full --format report
323
- ```
324
-
325
- Query-style endpoint:
326
-
327
- ```powershell
328
- fullcourtdefense scan --local --type endpoint --endpoint "http://127.0.0.1:8000/query" --method POST --request-format custom --input-field query --output-field result --mode full --format report
329
- ```
330
-
331
- OpenAI-compatible endpoint:
332
-
333
- ```powershell
334
- fullcourtdefense scan --local --type endpoint --endpoint "http://127.0.0.1:8000/v1/chat/completions" --method POST --request-format openai --mode full --format report
335
- ```
336
-
337
- ### MCP Examples
338
-
339
- Local stdio MCP server built from your repo:
340
-
341
- ```powershell
342
- fullcourtdefense scan --local --type mcp --mcp-command node --mcp-args ".\dist\mcp-server.js" --mcp-tool all --mode full --format report
343
- ```
344
-
345
- Filesystem MCP over `npx.cmd` on Windows:
346
-
347
- ```powershell
348
- fullcourtdefense scan --local --type mcp --mcp-command npx.cmd --mcp-args "-y @modelcontextprotocol/server-filesystem C:\company\docs" --mcp-tool all --mode full --format report
349
- ```
350
-
351
- Single MCP tool with attack inserted into an argument:
352
-
353
- ```powershell
354
- fullcourtdefense scan --local --type mcp --mcp-command node --mcp-args ".\dist\mcp-server.js" --mcp-tool search_docs --mcp-tool-args '{ "query": "{{attack}}", "limit": 5 }' --mode quick --format report
355
- ```
356
-
357
- Already-running HTTP MCP:
358
-
359
- ```powershell
360
- fullcourtdefense scan --local --type mcp --mcp-url "http://127.0.0.1:5066/mcp" --mcp-tool all --mode full --format report
361
- ```
362
-
363
- Secured HTTP MCP:
364
-
365
- ```powershell
366
- fullcourtdefense scan --local --type mcp --mcp-url "https://mcp.internal.company.com/mcp" --mcp-auth-type bearer --mcp-token "mcp_token_..." --mcp-tool all --mode full --format report
367
- ```
368
-
369
- ### MCP Gateway Install Examples
370
-
371
- Use the MCP gateway when you want Cursor, Claude Code, or Claude Desktop tool calls checked against AgentGuard runtime/action policies before they reach the real MCP server.
372
-
373
- Cursor project install:
374
-
375
- ```powershell
376
- fullcourtdefense install-cursor-mcp-gateway --project true --shield-id "sh_..." --shield-key "shsk_..." --mcp-command npm --mcp-args "run mcp"
377
- ```
378
-
379
- Claude Code local install, private to you in the current project:
380
-
381
- ```powershell
382
- fullcourtdefense install-claude-code-mcp-gateway --scope local --shield-id "sh_..." --shield-key "shsk_..." --mcp-command npm --mcp-args "run mcp"
383
- ```
384
-
385
- Claude Code project install, shared through `.mcp.json`:
386
-
387
- ```powershell
388
- fullcourtdefense install-claude-code-mcp-gateway --scope project --shield-id "sh_..." --mcp-command npm --mcp-args "run mcp"
389
- ```
390
-
391
- Claude Desktop install:
392
-
393
- ```powershell
394
- fullcourtdefense install-claude-desktop-mcp-gateway --shield-id "sh_..." --shield-key "shsk_..." --mcp-command npm --mcp-args "run mcp"
395
- ```
396
-
397
- The gateway auto-detects runtime identity when `--developer-name` is omitted. Detection order is `FCD_DEVELOPER_NAME`, `FULLCOURTDEFENSE_DEVELOPER_NAME`, `AGENTGUARD_DEVELOPER_NAME`, `USER_EMAIL`, `git config user.email`, `npm whoami`, then OS username. Use `--developer-name` only when you want to override the detected employee/runtime identity.
398
-
399
- Direct gateway run for debugging:
400
-
401
- ```powershell
402
- fullcourtdefense mcp-gateway --agent-client claude-code --shield-id "sh_..." --mcp-command npm --mcp-args "run mcp"
403
- ```
404
-
405
- ### RAG Examples
406
-
407
- Scan local documents before ingestion:
408
-
409
- ```powershell
410
- fullcourtdefense scan --local --type rag --rag-path "C:\company\kb-docs" --mode full --format report
411
- ```
412
-
413
- Scan one suspicious file:
414
-
415
- ```powershell
416
- fullcourtdefense scan --local --type rag --rag-path ".\docs\release-notes.md" --mode quick --format report
417
- ```
418
-
419
- Scan a live RAG service:
420
-
421
- ```powershell
422
- fullcourtdefense scan --local --type rag --rag-url "http://127.0.0.1:5065/chat" --method POST --request-format custom --input-field message --output-field answer --mode full --format report
423
- ```
424
-
425
- Scan an OpenAI-compatible RAG service:
426
-
427
- ```powershell
428
- fullcourtdefense scan --local --type rag --rag-url "http://127.0.0.1:5065/v1/chat/completions" --method POST --request-format openai --mode full --format report
429
- ```
430
-
431
- ### Auth Examples
432
-
433
- Bearer auth for an internal agent:
434
-
435
- ```powershell
436
- fullcourtdefense scan --local --type endpoint --endpoint "https://agent.internal/chat" --method POST --request-format custom --input-field message --output-field answer --auth-type bearer --token "eyJ..." --mode full --format report
437
- ```
438
-
439
- Basic auth:
440
-
441
- ```powershell
442
- fullcourtdefense scan --local --type endpoint --endpoint "https://agent.internal/chat" --method POST --request-format custom --input-field message --output-field answer --auth-type basic --username "scanner" --password "scanner-password" --mode full --format report
443
- ```
444
-
445
- API key header:
446
-
447
- ```powershell
448
- fullcourtdefense scan --local --type endpoint --endpoint "https://agent.internal/chat" --method POST --request-format custom --input-field message --output-field answer --auth-type api-key --api-key-header X-Internal-Key --endpoint-api-key "internal_key_..." --mode full --format report
449
- ```
450
-
451
- ### CI Gate Examples
452
-
453
- Fail the build if score is below 80:
454
-
455
- ```powershell
456
- fullcourtdefense scan --api-key "$env:FULLCOURTDEFENSE_API_KEY" --endpoint "https://agent.example.com/chat" --description "Production support agent" --mode sync --format summary --fail-threshold 80
457
- ```
458
-
459
- Local CI against a service started earlier in the job:
460
-
461
- ```powershell
462
- fullcourtdefense scan --local --type endpoint --endpoint "http://127.0.0.1:3000/chat" --method POST --request-format custom --input-field message --output-field response --mode quick --format summary --fail-threshold 80
463
- ```
464
-
465
- ## In-Organization Local Scan
466
-
467
- Use local scan when the AI endpoint, MCP server, RAG service, or RAG corpus is only reachable from inside your organization. The CLI executes the local target, then sends the captured content outbound to your FullCourtDefense Shield for the real verdict.
468
-
469
- ```bash
470
- fullcourtdefense scan --local
471
- ```
472
-
473
- On first local scan, the CLI asks for your Shield ID and saves it to `.fullcourtdefense.yml`. You can also pass it directly:
474
-
475
- ```bash
476
- fullcourtdefense scan --local --shield-id sh_your_shield_id
477
- ```
478
-
479
- The CLI asks what to scan:
480
-
481
- - `endpoint` — internal HTTP API or OpenAI-compatible endpoint.
482
- - `mcp` — MCP destination. For stdio MCP, the destination is the command plus args needed to launch the server, for example `node ./mcp-server.js` or `npx.cmd -y @modelcontextprotocol/server-filesystem C:\data`. For an already-running HTTP/HTTPS or legacy SSE MCP server, the destination is `--mcp-url`.
483
- - `rag` — local file/directory of RAG documents/chunks, or a live RAG HTTP endpoint via `--rag-url`.
484
-
485
- ### Recommended Flow
486
-
487
- 1. Run `doctor` first from the customer machine. This confirms outbound HTTPS to FullCourtDefense works before you try a scan.
488
- 2. Run `configure` once. Paste the Shield ID and Shield key from the web app's Shield Integrate tab.
489
- 3. Pick the target type: API endpoint, MCP, RAG corpus, or live RAG service.
490
- 4. Use `--mode quick` for a smoke test, then `--mode full --format report` for evidence and web history.
491
-
492
- ```powershell
493
- fullcourtdefense doctor
494
- fullcourtdefense configure
495
- ```
496
-
497
- With a Shield key configured, local scans are saved to the web Reports history automatically.
498
-
499
- ### API Endpoint Scan
500
-
501
- Use this when the AI agent is a normal HTTP API, for example `/chat`, `/ask`, `/query`, or an OpenAI-compatible `/v1/chat/completions` route.
502
-
503
- For custom JSON APIs, tell the CLI which request field receives the attack prompt and which response field contains the bot answer:
504
-
505
- ```powershell
506
- fullcourtdefense scan --local --type endpoint --endpoint "http://internal-agent.local/chat" --method POST --request-format custom --input-field message --output-field response --mode quick --format report
507
- ```
508
-
509
- Common custom field mappings:
510
-
511
- ```powershell
512
- # Request: { "query": "..." }, response: { "answer": "..." }
513
- fullcourtdefense scan --local --type endpoint --endpoint "http://localhost:8080/query" --method POST --request-format custom --input-field query --output-field answer --mode full --format report
514
-
515
- # GET endpoint: /ask?q=...
516
- fullcourtdefense scan --local --type endpoint --endpoint "http://localhost:8080/ask" --method GET --request-format custom --input-field q --output-field answer --mode quick --format report
517
- ```
518
-
519
- For OpenAI-compatible APIs:
520
-
521
- ```powershell
522
- fullcourtdefense scan --local --type endpoint --endpoint "http://localhost:8080/v1/chat/completions" --method POST --request-format openai --mode full --format report
523
- ```
524
-
525
- Authenticated API examples:
526
-
527
- ```powershell
528
- # Bearer token
529
- fullcourtdefense scan --local --type endpoint --endpoint "https://agent.internal/chat" --method POST --request-format custom --input-field message --output-field response --auth-type bearer --token YOUR_TOKEN --mode full --format report
530
-
531
- # API key header
532
- fullcourtdefense scan --local --type endpoint --endpoint "https://agent.internal/chat" --method POST --request-format custom --input-field message --output-field response --auth-type api-key --api-key-header X-API-Key --endpoint-api-key YOUR_KEY --mode full --format report
533
- ```
534
-
535
- ### MCP Scan
536
-
537
- Use this when the target exposes tools through the Model Context Protocol. The CLI calls the tool with attack prompts, captures the tool response, sends that response to Shield, and saves the report to history.
538
-
539
- For stdio MCP servers:
540
-
541
- ```powershell
542
- fullcourtdefense scan --local --type mcp --mcp-command node --mcp-args ".\dist\server.js" --mcp-tool all --mode full --format report
543
- ```
544
-
545
- For a single stdio tool with fixed args:
546
-
547
- ```powershell
548
- fullcourtdefense scan --local --type mcp --mcp-command node --mcp-args ".\dist\server.js" --mcp-tool search_docs --mcp-tool-args '{ "query": "{{attack}}" }' --mode quick --format report
549
- ```
550
-
551
- For already-running HTTP MCP servers:
552
-
553
- ```powershell
554
- fullcourtdefense scan --local --type mcp --mcp-url "http://mcp.internal.company.com/mcp" --mcp-tool all --mode full --format report
555
- ```
556
-
557
- For secured MCP servers:
558
-
559
- ```powershell
560
- # Bearer auth
561
- fullcourtdefense scan --local --type mcp --mcp-url "https://internal.company.com/mcp" --mcp-auth-type bearer --mcp-token YOUR_TOKEN --mcp-tool all --mode full --format report
562
-
563
- # Basic auth
564
- fullcourtdefense scan --local --type mcp --mcp-url "https://internal.company.com/mcp" --mcp-auth-type basic --mcp-username USER --mcp-password PASS --mcp-tool all --mode full --format report
565
-
566
- # API key header
567
- fullcourtdefense scan --local --type mcp --mcp-url "https://internal.company.com/mcp" --mcp-auth-type api-key --mcp-api-key-header X-API-Key --mcp-api-key YOUR_KEY --mcp-tool all --mode full --format report
568
- ```
569
-
570
- For legacy SSE MCP:
571
-
572
- ```powershell
573
- fullcourtdefense scan --local --type mcp --mcp-transport sse --mcp-url "https://internal.company.com/sse" --mcp-tool all --mode full --format report
574
- ```
575
-
576
- MCP progress controls:
577
-
578
- ```powershell
579
- fullcourtdefense scan --local --type mcp --mcp-url "https://internal.company.com/mcp" --mcp-tool all --mode full --progress verbose --format report
580
- fullcourtdefense scan --local --type mcp --mcp-url "https://internal.company.com/mcp" --mcp-tool all --mode full --progress compact --format summary
581
- ```
582
-
583
- ### RAG Corpus Scan
584
-
585
- Use this when you have local documents or chunks before they are indexed. The CLI reads `.txt`, `.md`, `.json`, `.csv`, and `.html` files, sends chunks to the RAG Shield endpoint, and saves the report as a RAG scan.
586
-
587
- ```powershell
588
- fullcourtdefense scan --local --type rag --rag-path ".\docs" --mode quick --format report
589
- fullcourtdefense scan --local --type rag --rag-path ".\docs" --mode full --format full-report
590
- ```
591
-
592
- Use corpus scan to find poisoned files before ingestion. Use live RAG scan when you need to test the actual retrieval service behavior.
593
-
594
- ### Live RAG Service Scan
595
-
596
- Use this when RAG is a running service, not just files. This is common for retrieval APIs that accept a question and return an answer with retrieved context.
597
-
598
- ```powershell
599
- fullcourtdefense scan --local --type rag --rag-url "http://rag.internal.company.com/chat" --method POST --request-format custom --input-field message --output-field answer --mode quick --format report
600
- ```
601
-
602
- Common live RAG shapes:
603
-
604
- ```powershell
605
- # Request: { "question": "..." }, response: { "answer": "..." }
606
- fullcourtdefense scan --local --type rag --rag-url "http://localhost:5065/chat" --method POST --request-format custom --input-field question --output-field answer --mode full --format report
607
-
608
- # Request: { "query": "..." }, response: { "result": "..." }
609
- fullcourtdefense scan --local --type rag --rag-url "http://localhost:5065/query" --method POST --request-format custom --input-field query --output-field result --mode full --format report
610
-
611
- # OpenAI-compatible RAG endpoint
612
- fullcourtdefense scan --local --type rag --rag-url "http://localhost:5065/v1/chat/completions" --method POST --request-format openai --mode full --format report
613
- ```
614
-
615
- The web report will show `Agent Tested: Local full RAG endpoint scan: ...` and is saved with `scanType: rag`.
616
-
617
- ### Local Demo RAG Server
618
-
619
- This repository includes a deliberately vulnerable RAG service for testing the CLI flow:
620
-
621
- ```powershell
622
- $env:PORT = "5065"
623
- node samples\rag\rag-server.js
624
- ```
625
-
626
- In another terminal:
627
-
628
- ```powershell
629
- fullcourtdefense scan --local --type rag --rag-url "http://127.0.0.1:5065/chat" --method POST --request-format custom --input-field message --output-field answer --mode quick --format report
630
- ```
631
-
632
- The demo should fail because it echoes raw poisoned retrieved context. That is expected and proves the scanner is catching RAG poisoning.
633
-
634
- ### Older Compact Examples
635
-
636
- ```bash
637
- # Internal web API
638
- fullcourtdefense scan --local --type endpoint --endpoint http://internal-agent.local/chat --method POST --shield-id sh_your_shield_id
639
-
640
- # Internal OpenAI-compatible endpoint
641
- fullcourtdefense scan --local --type endpoint --endpoint http://localhost:8080/v1/chat/completions --webhook-format openai --shield-id sh_your_shield_id
642
-
643
- # MCP stdio server
644
- fullcourtdefense scan --local --type mcp --mcp-command node --mcp-args ./dist/index.js --mcp-tool search_docs --mcp-tool-args '{"query":"security policy"}' --shield-id sh_your_shield_id
645
-
646
- # Already-running HTTP or HTTPS MCP server
647
- fullcourtdefense scan --local --type mcp --mcp-url http://mcp.internal.company.com/mcp
648
- fullcourtdefense scan --local --type mcp --mcp-url http://mcp.internal.company.com/mcp --mcp-tool all --mode full --format report --shield-id sh_your_shield_id
649
- fullcourtdefense scan --local --type mcp --mcp-url https://internal.company.com/mcp --mcp-tool all --mode full --format report --shield-id sh_your_shield_id
650
-
651
- # Legacy SSE MCP server
652
- fullcourtdefense scan --local --type mcp --mcp-transport sse --mcp-url https://internal.company.com/sse --mcp-tool all --mode full --format report --shield-id sh_your_shield_id
653
-
654
- # Secured HTTP MCP server with bearer auth
655
- fullcourtdefense scan --local --type mcp --mcp-url https://internal.company.com/mcp --mcp-auth-type bearer --mcp-token YOUR_TOKEN --mcp-tool all --mode full --format report --shield-id sh_your_shield_id
656
-
657
- # Secured HTTP MCP server with basic auth
658
- fullcourtdefense scan --local --type mcp --mcp-url https://internal.company.com/mcp --mcp-auth-type basic --mcp-username USER --mcp-password PASS --mcp-tool all --mode full --format report --shield-id sh_your_shield_id
659
-
660
- # Secured HTTP MCP server with API-key auth
661
- fullcourtdefense scan --local --type mcp --mcp-url https://internal.company.com/mcp --mcp-auth-type api-key --mcp-api-key-header X-API-Key --mcp-api-key YOUR_KEY --mcp-tool all --mode full --format report --shield-id sh_your_shield_id
662
-
663
- # MCP full scan: all tools x bundled 229+ web attacks
664
- fullcourtdefense scan --local --type mcp --mcp-command node --mcp-args ./dist/index.js --mcp-tool all --mode full --shield-id sh_your_shield_id
665
-
666
- # MCP smoke test with same full corpus, limited to 10 attacks per tool
667
- fullcourtdefense scan --local --type mcp --mcp-command node --mcp-args ./dist/index.js --mcp-tool all --mode full --attack-count 10 --shield-id sh_your_shield_id
668
-
669
- # MCP evidence report: includes each attack sent, captured tool response, and Shield verdict
670
- fullcourtdefense scan --local --type mcp --mcp-command node --mcp-args ./dist/index.js --mcp-tool all --mode full --attack-count 10 --format report --shield-id sh_your_shield_id
671
-
672
- # MCP full scan with per-attack live progress
673
- fullcourtdefense scan --local --type mcp --mcp-url https://internal.company.com/mcp --mcp-tool all --mode full --progress verbose --format report --shield-id sh_your_shield_id
674
-
675
- # RAG documents
676
- fullcourtdefense scan --local --type rag --rag-path ./docs --format table --shield-id sh_your_shield_id
677
-
678
- # Live RAG HTTP service
679
- fullcourtdefense scan --local --type rag --rag-url http://rag.internal.company.com/chat --method POST --request-format custom --input-field message --output-field answer --mode full --format report --shield-id sh_your_shield_id
680
- ```
681
-
682
- Local scans run from the machine executing the CLI, so they can reach private/VPN/internal targets without opening inbound firewall access. The only required network path is outbound HTTPS to your FullCourtDefense backend. With a Shield key configured, the CLI saves the completed scan into the same web Reports history used by hosted scans. The web report keeps every test row with bounded evidence text; use `--format report` or `--format json` locally for the full raw evidence artifact.
683
-
684
- When an MCP destination is provided (`--mcp-url` or `--mcp-command`), the CLI defaults to a full all-tools report scan with per-attack live progress. Use `--progress compact` for shorter logs, or `--progress silent` for CI logs.
685
-
686
- ## Outbound Diagnostic
687
-
688
- Use `doctor` before local scans to confirm the customer environment can reach the FullCourtDefense backend over outbound HTTPS:
689
-
690
- ```bash
691
- fullcourtdefense doctor
692
- fullcourtdefense doctor --api-url https://api.fullcourtdefense.ai
693
- ```
694
-
695
- It checks `GET /api/health/ping` and reports whether outbound TCP 443/HTTPS is open.
696
-
697
- ## CI/CD Usage
698
-
699
- The CLI returns exit code 1 when the score is below `--fail-threshold`, making it CI-friendly:
700
-
701
- ```bash
702
- fullcourtdefense scan --fail-threshold 80 --format summary
703
- ```
704
-
705
- For GitHub Actions, use [botguardai/security-scan](https://github.com/botguardai/security-scan) which wraps this CLI with PR comments and check status.
706
-
707
- ## Get Your API Key
708
-
709
- 1. Sign up at [fullcourtdefense.ai](https://fullcourtdefense.ai)
710
- 2. Go to **Account > API Keys**
711
- 3. Create a CI/CD key
712
-
713
- ## Related
714
-
715
- - [BotGuard](https://fullcourtdefense.ai) — Automated red-teaming & real-time firewall for AI agents
716
- - [GitHub Action](https://github.com/botguardai/security-scan) — CI/CD security scanning
717
- - [Attack Library](https://github.com/botguardai/llm-attacks) — 229+ open-source LLM attack templates
718
-
719
- ## License
720
-
721
- MIT
1
+ # FullCourtDefense CLI
2
+
3
+ [Full Court Defense](https://fullcourtdefense.ai/) is an AI agent security platform and runtime firewall for teams shipping LLM apps, agentic workflows, MCP tools, and RAG systems. We help builders find and block prompt injection, jailbreaks, data exfiltration, unsafe tool use, and poisoned retrieval content before those failures reach production.
4
+
5
+ The FullCourtDefense CLI brings that security workflow to your terminal. It can run hosted CI/CD scans against public agents, or local in-organization scans against private APIs, MCP servers, RAG document corpora, and live RAG services. Local scans execute from your machine or VPN, then send captured content outbound to your Shield for verdicts and saved web reports.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install -g fullcourtdefense-cli
11
+ # or run directly
12
+ npx fullcourtdefense-cli scan
13
+ ```
14
+
15
+ ## Quick Start (protect this machine)
16
+
17
+ One command takes a fresh machine to a verified protected machine: connectivity check, fleet enrollment, MCP gateway wrapping, IDE hooks, terminal guards, discovery upload, and a green/red verification checklist.
18
+
19
+ ```bash
20
+ # An org admin issues a fleet enrollment token in the web app:
21
+ # AI Fleet -> Settings -> Fleet enrollment token
22
+
23
+ fullcourtdefense onboard --token <fleet-enrollment-token>
24
+ # or: set FCD_ENROLL_TOKEN and run `fullcourtdefense onboard`
25
+ ```
26
+
27
+ Then restart your AI clients (Cursor, Claude, VS Code, ...) so they pick up the wrapped configs. The machine reports to your org's AI Fleet in monitor-first mode until an admin enables enforcement.
28
+
29
+ Onboarding is a resumable local transaction. Its non-secret status journal is
30
+ stored at `~/.fullcourtdefense/onboarding.json`; use `--resume` after an
31
+ interruption and `--repair` to re-run completed protection installation steps.
32
+ Discovery upload and its daily schedule are recorded as optional telemetry,
33
+ separate from required protection. Useful MDM options:
34
+
35
+ ```bash
36
+ fullcourtdefense onboard --dry-run true --json true # preflight + final JSON status
37
+ fullcourtdefense onboard --resume # continue a failed transaction
38
+ fullcourtdefense onboard --resume --repair # reinstall protection surfaces
39
+ fullcourtdefense onboard --schedule false # do not install daily discovery
40
+ fullcourtdefense onboard --no-daemon true # do not enable optional self-healing
41
+ ```
42
+
43
+ Manual step-by-step equivalent:
44
+
45
+ ```bash
46
+ fullcourtdefense doctor # 1. outbound HTTPS check
47
+ fullcourtdefense login --token <fleet-enrollment-token> # 2. enroll (zero paste)
48
+ fullcourtdefense install-all # 3. protect every AI client
49
+ fullcourtdefense protect-all --dry-run true # 4. verify gateways
50
+ ```
51
+
52
+ ## Quick Start (scanning)
53
+
54
+ ```bash
55
+ # Run an in-organization local scan with guided questions
56
+ fullcourtdefense scan --local
57
+
58
+ # Run a detailed MCP report
59
+ fullcourtdefense scan --local --type mcp --mcp-command node --mcp-args ./server.js --mcp-tool all --mode full --format report
60
+
61
+ # Hosted CI/CD scan, if using an API key instead of local Shield scan
62
+ fullcourtdefense scan --api-key YOUR_KEY --endpoint https://my-agent.com/chat --description "My chatbot"
63
+
64
+ # Check remaining credits
65
+ fullcourtdefense credits --api-key YOUR_KEY
66
+
67
+ # Generate a config file
68
+ fullcourtdefense init
69
+ ```
70
+
71
+ ## Command Guide
72
+
73
+ - `fullcourtdefense help` — shows the full onboarding flow and command reference.
74
+ - `fullcourtdefense onboard --token <token>` — resumable machine transaction: preflight + login + protection + optional discovery + verification. `--json true` prints final machine-readable status; exits non-zero only when a critical step fails.
75
+ - `fullcourtdefense doctor` — confirms outbound HTTPS to FullCourtDefense is open before scanning.
76
+ - `fullcourtdefense login --token <token>` — enrolls this machine with a fleet token and saves per-machine Shield credentials (no copy/paste).
77
+ - `fullcourtdefense install-all` — wraps every configured MCP server, installs IDE hooks and terminal guards, uploads discovery, schedules daily rescans.
78
+ - `fullcourtdefense configure` — legacy/manual setup: saves org API key, Shield ID, Shield key, and API URL to `.fullcourtdefense.yml` (use `login` instead when you have a fleet token).
79
+ - `fullcourtdefense scan --local` — runs inside the customer network and asks whether to scan endpoint, MCP, or RAG.
80
+ - `fullcourtdefense scan --local --type mcp ...` — launches a local stdio MCP server, calls tools, and sends tool responses to Shield.
81
+ - `fullcourtdefense scan --local --type rag ...` — scans local RAG files/directories or a live RAG HTTP service.
82
+ - `fullcourtdefense scan --local --type endpoint ...` — scans an internal HTTP/OpenAI-compatible endpoint.
83
+ - `fullcourtdefense install-cursor-mcp-gateway ...` — registers the protected MCP gateway in Cursor.
84
+ - `fullcourtdefense install-claude-code-mcp-gateway ...` — registers the protected MCP gateway in Claude Code.
85
+ - `fullcourtdefense install-claude-desktop-mcp-gateway ...` — registers the protected MCP gateway in Claude Desktop.
86
+ - `fullcourtdefense credits` — checks hosted scan credits for CI/CD API-key scans.
87
+ - `fullcourtdefense discover` — scans local MCP client configs and reports risk; `--upload` sends desktop inventory to AI Inventory.
88
+ - `fullcourtdefense init` — creates a starter config file.
89
+
90
+ ## Shadow AI / Desktop Discovery
91
+
92
+ Find MCP servers configured on developer machines without reading chat history or spawning stdio servers by default:
93
+
94
+ ```bash
95
+ # Scan this machine and print results
96
+ fullcourtdefense discover
97
+
98
+ # JSON output (includes host fingerprint + servers)
99
+ fullcourtdefense discover --json
100
+
101
+ # Upload to AI Inventory (requires CI/CD API key with audit:write)
102
+ fullcourtdefense discover --upload --api-key YOUR_KEY
103
+
104
+ # Live-probe HTTP/SSE MCP servers for tools/list (stdio stays config-only)
105
+ fullcourtdefense discover --deep
106
+
107
+ # Fleet / MDM script — silent upload with user attribution
108
+ fullcourtdefense discover --upload --silent --user-email you@company.com --api-key YOUR_KEY
109
+
110
+ # Daily automatic scan on this laptop (uses API key from env or ~/.fullcourtdefense.yml)
111
+ fullcourtdefense discover --schedule daily --user-email you@company.com
112
+
113
+ # Remove daily schedule
114
+ fullcourtdefense discover --unschedule true
115
+
116
+ # Scan an extra config path
117
+ fullcourtdefense discover --path /path/to/mcp.json
118
+ ```
119
+
120
+ Each upload includes host metadata (`machineId`, `hostname`, `platform`, `user`) so the same MCP server on different laptops appears as separate desktop inventory rows. The CLI is also available as `fcd` or `botguard` after global install.
121
+
122
+ ## Config File
123
+
124
+ Create a `.fullcourtdefense.yml` to avoid passing flags every time:
125
+
126
+ ```yaml
127
+ apiKey: ${FULLCOURTDEFENSE_API_KEY}
128
+ apiUrl: https://api.fullcourtdefense.ai
129
+ shieldId: sh_your_shield_id
130
+ # shieldKey: shsk_optional_if_locked
131
+ scan:
132
+ endpoint: https://my-agent.com/chat
133
+ description: "Customer support chatbot"
134
+ categories: [jailbreak, prompt_injection, data_extraction]
135
+ failThreshold: 80
136
+ format: table
137
+ ```
138
+
139
+ Then just run:
140
+
141
+ ```bash
142
+ fullcourtdefense scan
143
+ ```
144
+
145
+ ## Modes
146
+
147
+ Hosted scans use a CI/CD API key and scan a public or reachable agent endpoint through the FullCourtDefense backend.
148
+
149
+ | Mode | Use When | Behavior |
150
+ |---|---|---|
151
+ | `--mode sync` | Small hosted scans from CI or a terminal | Waits for the hosted scan result before exiting. |
152
+ | `--mode async` | Longer hosted scans | Starts a hosted job, polls until complete, then prints the result. |
153
+
154
+ Local scans run from the customer machine or VPN and only send captured text outbound to Shield for verdicts.
155
+
156
+ | Mode | Use When | Behavior |
157
+ |---|---|---|
158
+ | `--mode quick` | Smoke test before a demo or install handoff | Runs a small default attack set. |
159
+ | `--mode full` | Real evidence report | Runs the bundled 229+ attack corpus. |
160
+ | `--mode targeted` | You know what the agent protects | Runs default plus targeted attacks and appends `--description` as focus context. |
161
+ | `--mode deep` | Stress and broad regression testing | Runs the broad corpus plus deeper multi-step/stress cases. |
162
+
163
+ ## Full Option Reference
164
+
165
+ ### Global
166
+
167
+ | Flag | Applies To | Description | Default |
168
+ |---|---|---|---|
169
+ | `--help`, `-h` | all commands | Show help. | — |
170
+ | `--version`, `-v` | all commands | Print package version. | — |
171
+ | `--config <path>` | scan/config | Path to `.fullcourtdefense.yml`, `.fullcourtdefense.yaml`, or legacy `.botguard.yml`. | auto-detect |
172
+ | `--api-url <url>` | doctor/configure/scan | FullCourtDefense backend URL. | `https://api.fullcourtdefense.ai` |
173
+
174
+ ### Shield And Hosted API
175
+
176
+ | Flag | Applies To | Description | Default |
177
+ |---|---|---|---|
178
+ | `--api-key <key>` | hosted scan/credits | Hosted scan API key. Can also use `FULLCOURTDEFENSE_API_KEY` or legacy `BOTGUARD_API_KEY`. | config/env |
179
+ | `--shield-id <id>` | local scan | Shield ID from the Shield Integrate tab. Can also use `FULLCOURTDEFENSE_SHIELD_ID`, `FCD_SHIELD_ID`, or `AGENTGUARD_SHIELD_ID`. | config/env/prompt |
180
+ | `--shield-key <key>` | local scan | Optional Shield key for locked Shields. Can also use `FULLCOURTDEFENSE_SHIELD_KEY`, `FCD_SHIELD_KEY`, or `AGENTGUARD_SHIELD_KEY`. | config/env/prompt |
181
+
182
+ ### Hosted Scan
183
+
184
+ | Flag | Applies To | Description | Default |
185
+ |---|---|---|---|
186
+ | `--endpoint <url>` | hosted scan | Public/reachable AI agent API URL. | config |
187
+ | `--description <text>` | hosted scan/local targeted | Agent description. For `--mode targeted`, also used as local focus context. | config |
188
+ | `--system-prompt <text-or-path>` | hosted scan | System prompt text or path to a file. | config |
189
+ | `--categories <list>` | hosted scan | Comma-separated attack categories. | all |
190
+ | `--attack-count <n>` | hosted/local | Limit number of attacks. Useful for smoke tests. | mode default |
191
+ | `--webhook-format <fmt>` | hosted scan | Webhook format: `n8n`, `make`, `zapier`, or `custom`. Legacy alias for local request format. | — |
192
+
193
+ ### Local Target Selection
194
+
195
+ | Flag | Applies To | Description | Default |
196
+ |---|---|---|---|
197
+ | `--local` | scan | Run from this machine, inside the customer's network/VPN. | false |
198
+ | `--type <type>` | local scan | Local target type: `endpoint`, `mcp`, or `rag`. | prompt |
199
+
200
+ ### Local HTTP API Endpoint
201
+
202
+ | Flag | Applies To | Description | Default |
203
+ |---|---|---|---|
204
+ | `--endpoint <url>` | `--type endpoint` | Internal HTTP API URL, for example `http://agent.local/chat`. | prompt |
205
+ | `--method <GET|POST>` | endpoint/rag-url | HTTP method. | prompt/`POST` |
206
+ | `--request-format <fmt>` | endpoint/rag-url | Request body shape: `custom` or `openai`. | prompt/`custom` |
207
+ | `--input-field <field>` | endpoint/rag-url | Request field that receives the attack prompt, for example `message`, `query`, `question`, or `input`. | `message` |
208
+ | `--output-field <field>` | endpoint/rag-url | Response field containing the bot answer, for example `answer`, `response`, `text`, or `choices.0.message.content`. | auto-detect |
209
+ | `--auth-type <type>` | endpoint/rag-url | HTTP auth type: `none`, `bearer`, `basic`, or `api-key`. | `none` |
210
+ | `--username <user>` | endpoint/rag-url basic auth | Basic auth username. | prompt |
211
+ | `--password <pass>` | endpoint/rag-url basic auth | Basic auth password. | prompt |
212
+ | `--token <token>` | endpoint/rag-url bearer auth | Bearer token. | prompt |
213
+ | `--api-key-header <header>` | endpoint/rag-url API-key auth | API key header name, for example `X-API-Key`. | `X-API-Key` |
214
+ | `--endpoint-api-key <key>` | endpoint/rag-url API-key auth | API key value for the scanned endpoint. | prompt |
215
+
216
+ ### MCP
217
+
218
+ | Flag | Applies To | Description | Default |
219
+ |---|---|---|---|
220
+ | `--mcp-command <cmd>` | stdio MCP | Command that starts the MCP server, for example `node`, `python`, or `npx.cmd`. | prompt |
221
+ | `--mcp-args <args>` | stdio MCP | Args passed to `--mcp-command`, for example `.\dist\server.js`. JSON array strings are also supported. | empty |
222
+ | `--mcp-url <url>` | HTTP/SSE MCP | Already-running MCP URL, for example `https://internal.company.com/mcp`. | prompt |
223
+ | `--mcp-transport <t>` | MCP | Transport: `stdio`, `http`, or `sse`. HTTP/SSE can usually be inferred from `--mcp-url`. | inferred |
224
+ | `--mcp-tool <tool>` | MCP | Tool to scan, or `all` to scan every listed tool. | `all` when destination is provided |
225
+ | `--mcp-tool-args <json>` | MCP | Tool args JSON. Use `{{attack}}` anywhere the current attack prompt should be inserted. | `{}` |
226
+ | `--mcp-auth-type <type>` | HTTP/SSE MCP | Auth type: `none`, `bearer`, `basic`, or `api-key`. | `none` |
227
+ | `--mcp-token <token>` | HTTP/SSE MCP bearer auth | Bearer token. | prompt |
228
+ | `--mcp-username <user>` | HTTP/SSE MCP basic auth | Basic auth username. | prompt |
229
+ | `--mcp-password <pass>` | HTTP/SSE MCP basic auth | Basic auth password. | prompt |
230
+ | `--mcp-api-key-header <header>` | HTTP/SSE MCP API-key auth | API key header name. | `X-API-Key` |
231
+ | `--mcp-api-key <key>` | HTTP/SSE MCP API-key auth | API key value. | prompt |
232
+ | `--progress <mode>` | MCP | Console progress: `verbose`, `compact`, or `silent`. | `verbose` |
233
+ | `--server-name <name>` | MCP gateway installers | MCP server name to write into the client config. | `agentguard-gateway` |
234
+ | `--developer-name <name>` | MCP gateway installers | Runtime identity used for user-scoped Action Policies. Auto-detected from `FCD_DEVELOPER_NAME`, git email, npm username, or OS username. | auto |
235
+ | `--agent-name <name>` | MCP gateway installers | Runtime agent name shown in AI Users. Auto-generated from runtime identity plus client, e.g. `boaz.lautman-claude-desktop`. | auto |
236
+ | `--scope <scope>` | Claude Code gateway installer | Claude Code MCP scope: `local`, `project`, or `user`. | `local` |
237
+ | `--config-path <path>` | Claude Desktop gateway installer | Override path to `claude_desktop_config.json`. | OS default |
238
+
239
+ ### RAG
240
+
241
+ | Flag | Applies To | Description | Default |
242
+ |---|---|---|---|
243
+ | `--rag-path <path>` | `--type rag` | Local RAG file or directory to scan as a corpus. Supports `.txt`, `.md`, `.json`, `.csv`, and `.html`. | prompt |
244
+ | `--rag-url <url>` | `--type rag` | Live RAG HTTP endpoint to scan like an app. Uses the same HTTP flags as endpoint scans. | — |
245
+
246
+ ### Output And CI
247
+
248
+ | Flag | Applies To | Description | Default |
249
+ |---|---|---|---|
250
+ | `--mode <mode>` | scan | Hosted: `sync`, `async`. Local: `quick`, `full`, `targeted`, `deep`. | hosted `sync`, local `quick` |
251
+ | `--format <fmt>` | scan | Output: `table`, `summary`, `report`, `full-report`, or `json`. | hosted `table`, local `summary` |
252
+ | `--fail-threshold <n>` | scan | Exit with code 1 if score is below this 0-100 threshold. | `0` |
253
+
254
+ ## Realistic Command Examples
255
+
256
+ ### First-Time Setup
257
+
258
+ Run these on the same machine that can reach the customer's private agent, MCP server, or RAG service:
259
+
260
+ ```powershell
261
+ fullcourtdefense doctor
262
+ fullcourtdefense configure
263
+ fullcourtdefense scan --local
264
+ ```
265
+
266
+ Expected `doctor` output:
267
+
268
+ ```text
269
+ BotGuard outbound diagnostic
270
+ Target: https://api.fullcourtdefense.ai
271
+
272
+ PASS outbound HTTPS open (200, 487ms)
273
+ Checked: https://api.fullcourtdefense.ai/api/health/ping
274
+ ```
275
+
276
+ ### Hosted CI/CD Scan
277
+
278
+ Use hosted scans when the agent endpoint is reachable by FullCourtDefense and you have a CI/CD API key.
279
+
280
+ ```powershell
281
+ $env:FULLCOURTDEFENSE_API_KEY = "bg_live_..."
282
+ fullcourtdefense scan --endpoint "https://support-bot.example.com/chat" --description "Customer support chatbot" --mode sync --format summary --fail-threshold 80
283
+ ```
284
+
285
+ Async hosted scan for a longer job:
286
+
287
+ ```powershell
288
+ fullcourtdefense scan --api-key "bg_live_..." --endpoint "https://agent.example.com/chat" --description "Production sales assistant" --mode async --format report
289
+ ```
290
+
291
+ ### Local Modes
292
+
293
+ Use quick mode first:
294
+
295
+ ```powershell
296
+ fullcourtdefense scan --local --type endpoint --endpoint "http://localhost:3000/chat" --method POST --request-format custom --input-field message --output-field response --mode quick --format report
297
+ ```
298
+
299
+ Use full mode for evidence:
300
+
301
+ ```powershell
302
+ fullcourtdefense scan --local --type endpoint --endpoint "http://localhost:3000/chat" --method POST --request-format custom --input-field message --output-field response --mode full --format report
303
+ ```
304
+
305
+ Use targeted mode when you know the protected domain:
306
+
307
+ ```powershell
308
+ fullcourtdefense scan --local --type endpoint --endpoint "http://localhost:3000/chat" --method POST --request-format custom --input-field message --output-field response --mode targeted --description "Healthcare support bot with patient records and billing data" --format report
309
+ ```
310
+
311
+ Use deep mode for broad regression:
312
+
313
+ ```powershell
314
+ fullcourtdefense scan --local --type endpoint --endpoint "http://localhost:3000/chat" --method POST --request-format custom --input-field message --output-field response --mode deep --format full-report
315
+ ```
316
+
317
+ ### Local API Endpoint Examples
318
+
319
+ Typical Express/FastAPI app:
320
+
321
+ ```powershell
322
+ fullcourtdefense scan --local --type endpoint --endpoint "http://127.0.0.1:8000/chat" --method POST --request-format custom --input-field message --output-field answer --mode full --format report
323
+ ```
324
+
325
+ Query-style endpoint:
326
+
327
+ ```powershell
328
+ fullcourtdefense scan --local --type endpoint --endpoint "http://127.0.0.1:8000/query" --method POST --request-format custom --input-field query --output-field result --mode full --format report
329
+ ```
330
+
331
+ OpenAI-compatible endpoint:
332
+
333
+ ```powershell
334
+ fullcourtdefense scan --local --type endpoint --endpoint "http://127.0.0.1:8000/v1/chat/completions" --method POST --request-format openai --mode full --format report
335
+ ```
336
+
337
+ ### MCP Examples
338
+
339
+ Local stdio MCP server built from your repo:
340
+
341
+ ```powershell
342
+ fullcourtdefense scan --local --type mcp --mcp-command node --mcp-args ".\dist\mcp-server.js" --mcp-tool all --mode full --format report
343
+ ```
344
+
345
+ Filesystem MCP over `npx.cmd` on Windows:
346
+
347
+ ```powershell
348
+ fullcourtdefense scan --local --type mcp --mcp-command npx.cmd --mcp-args "-y @modelcontextprotocol/server-filesystem C:\company\docs" --mcp-tool all --mode full --format report
349
+ ```
350
+
351
+ Single MCP tool with attack inserted into an argument:
352
+
353
+ ```powershell
354
+ fullcourtdefense scan --local --type mcp --mcp-command node --mcp-args ".\dist\mcp-server.js" --mcp-tool search_docs --mcp-tool-args '{ "query": "{{attack}}", "limit": 5 }' --mode quick --format report
355
+ ```
356
+
357
+ Already-running HTTP MCP:
358
+
359
+ ```powershell
360
+ fullcourtdefense scan --local --type mcp --mcp-url "http://127.0.0.1:5066/mcp" --mcp-tool all --mode full --format report
361
+ ```
362
+
363
+ Secured HTTP MCP:
364
+
365
+ ```powershell
366
+ fullcourtdefense scan --local --type mcp --mcp-url "https://mcp.internal.company.com/mcp" --mcp-auth-type bearer --mcp-token "mcp_token_..." --mcp-tool all --mode full --format report
367
+ ```
368
+
369
+ ### MCP Gateway Install Examples
370
+
371
+ Use the MCP gateway when you want Cursor, Claude Code, or Claude Desktop tool calls checked against AgentGuard runtime/action policies before they reach the real MCP server.
372
+
373
+ Cursor project install:
374
+
375
+ ```powershell
376
+ fullcourtdefense install-cursor-mcp-gateway --project true --shield-id "sh_..." --shield-key "shsk_..." --mcp-command npm --mcp-args "run mcp"
377
+ ```
378
+
379
+ Claude Code local install, private to you in the current project:
380
+
381
+ ```powershell
382
+ fullcourtdefense install-claude-code-mcp-gateway --scope local --shield-id "sh_..." --shield-key "shsk_..." --mcp-command npm --mcp-args "run mcp"
383
+ ```
384
+
385
+ Claude Code project install, shared through `.mcp.json`:
386
+
387
+ ```powershell
388
+ fullcourtdefense install-claude-code-mcp-gateway --scope project --shield-id "sh_..." --mcp-command npm --mcp-args "run mcp"
389
+ ```
390
+
391
+ Claude Desktop install:
392
+
393
+ ```powershell
394
+ fullcourtdefense install-claude-desktop-mcp-gateway --shield-id "sh_..." --shield-key "shsk_..." --mcp-command npm --mcp-args "run mcp"
395
+ ```
396
+
397
+ The gateway auto-detects runtime identity when `--developer-name` is omitted. Detection order is `FCD_DEVELOPER_NAME`, `FULLCOURTDEFENSE_DEVELOPER_NAME`, `AGENTGUARD_DEVELOPER_NAME`, `USER_EMAIL`, `git config user.email`, `npm whoami`, then OS username. Use `--developer-name` only when you want to override the detected employee/runtime identity.
398
+
399
+ Direct gateway run for debugging:
400
+
401
+ ```powershell
402
+ fullcourtdefense mcp-gateway --agent-client claude-code --shield-id "sh_..." --mcp-command npm --mcp-args "run mcp"
403
+ ```
404
+
405
+ ### RAG Examples
406
+
407
+ Scan local documents before ingestion:
408
+
409
+ ```powershell
410
+ fullcourtdefense scan --local --type rag --rag-path "C:\company\kb-docs" --mode full --format report
411
+ ```
412
+
413
+ Scan one suspicious file:
414
+
415
+ ```powershell
416
+ fullcourtdefense scan --local --type rag --rag-path ".\docs\release-notes.md" --mode quick --format report
417
+ ```
418
+
419
+ Scan a live RAG service:
420
+
421
+ ```powershell
422
+ fullcourtdefense scan --local --type rag --rag-url "http://127.0.0.1:5065/chat" --method POST --request-format custom --input-field message --output-field answer --mode full --format report
423
+ ```
424
+
425
+ Scan an OpenAI-compatible RAG service:
426
+
427
+ ```powershell
428
+ fullcourtdefense scan --local --type rag --rag-url "http://127.0.0.1:5065/v1/chat/completions" --method POST --request-format openai --mode full --format report
429
+ ```
430
+
431
+ ### Auth Examples
432
+
433
+ Bearer auth for an internal agent:
434
+
435
+ ```powershell
436
+ fullcourtdefense scan --local --type endpoint --endpoint "https://agent.internal/chat" --method POST --request-format custom --input-field message --output-field answer --auth-type bearer --token "eyJ..." --mode full --format report
437
+ ```
438
+
439
+ Basic auth:
440
+
441
+ ```powershell
442
+ fullcourtdefense scan --local --type endpoint --endpoint "https://agent.internal/chat" --method POST --request-format custom --input-field message --output-field answer --auth-type basic --username "scanner" --password "scanner-password" --mode full --format report
443
+ ```
444
+
445
+ API key header:
446
+
447
+ ```powershell
448
+ fullcourtdefense scan --local --type endpoint --endpoint "https://agent.internal/chat" --method POST --request-format custom --input-field message --output-field answer --auth-type api-key --api-key-header X-Internal-Key --endpoint-api-key "internal_key_..." --mode full --format report
449
+ ```
450
+
451
+ ### CI Gate Examples
452
+
453
+ Fail the build if score is below 80:
454
+
455
+ ```powershell
456
+ fullcourtdefense scan --api-key "$env:FULLCOURTDEFENSE_API_KEY" --endpoint "https://agent.example.com/chat" --description "Production support agent" --mode sync --format summary --fail-threshold 80
457
+ ```
458
+
459
+ Local CI against a service started earlier in the job:
460
+
461
+ ```powershell
462
+ fullcourtdefense scan --local --type endpoint --endpoint "http://127.0.0.1:3000/chat" --method POST --request-format custom --input-field message --output-field response --mode quick --format summary --fail-threshold 80
463
+ ```
464
+
465
+ ## In-Organization Local Scan
466
+
467
+ Use local scan when the AI endpoint, MCP server, RAG service, or RAG corpus is only reachable from inside your organization. The CLI executes the local target, then sends the captured content outbound to your FullCourtDefense Shield for the real verdict.
468
+
469
+ ```bash
470
+ fullcourtdefense scan --local
471
+ ```
472
+
473
+ On first local scan, the CLI asks for your Shield ID and saves it to `.fullcourtdefense.yml`. You can also pass it directly:
474
+
475
+ ```bash
476
+ fullcourtdefense scan --local --shield-id sh_your_shield_id
477
+ ```
478
+
479
+ The CLI asks what to scan:
480
+
481
+ - `endpoint` — internal HTTP API or OpenAI-compatible endpoint.
482
+ - `mcp` — MCP destination. For stdio MCP, the destination is the command plus args needed to launch the server, for example `node ./mcp-server.js` or `npx.cmd -y @modelcontextprotocol/server-filesystem C:\data`. For an already-running HTTP/HTTPS or legacy SSE MCP server, the destination is `--mcp-url`.
483
+ - `rag` — local file/directory of RAG documents/chunks, or a live RAG HTTP endpoint via `--rag-url`.
484
+
485
+ ### Recommended Flow
486
+
487
+ 1. Run `doctor` first from the customer machine. This confirms outbound HTTPS to FullCourtDefense works before you try a scan.
488
+ 2. Run `configure` once. Paste the Shield ID and Shield key from the web app's Shield Integrate tab.
489
+ 3. Pick the target type: API endpoint, MCP, RAG corpus, or live RAG service.
490
+ 4. Use `--mode quick` for a smoke test, then `--mode full --format report` for evidence and web history.
491
+
492
+ ```powershell
493
+ fullcourtdefense doctor
494
+ fullcourtdefense configure
495
+ ```
496
+
497
+ With a Shield key configured, local scans are saved to the web Reports history automatically.
498
+
499
+ ### API Endpoint Scan
500
+
501
+ Use this when the AI agent is a normal HTTP API, for example `/chat`, `/ask`, `/query`, or an OpenAI-compatible `/v1/chat/completions` route.
502
+
503
+ For custom JSON APIs, tell the CLI which request field receives the attack prompt and which response field contains the bot answer:
504
+
505
+ ```powershell
506
+ fullcourtdefense scan --local --type endpoint --endpoint "http://internal-agent.local/chat" --method POST --request-format custom --input-field message --output-field response --mode quick --format report
507
+ ```
508
+
509
+ Common custom field mappings:
510
+
511
+ ```powershell
512
+ # Request: { "query": "..." }, response: { "answer": "..." }
513
+ fullcourtdefense scan --local --type endpoint --endpoint "http://localhost:8080/query" --method POST --request-format custom --input-field query --output-field answer --mode full --format report
514
+
515
+ # GET endpoint: /ask?q=...
516
+ fullcourtdefense scan --local --type endpoint --endpoint "http://localhost:8080/ask" --method GET --request-format custom --input-field q --output-field answer --mode quick --format report
517
+ ```
518
+
519
+ For OpenAI-compatible APIs:
520
+
521
+ ```powershell
522
+ fullcourtdefense scan --local --type endpoint --endpoint "http://localhost:8080/v1/chat/completions" --method POST --request-format openai --mode full --format report
523
+ ```
524
+
525
+ Authenticated API examples:
526
+
527
+ ```powershell
528
+ # Bearer token
529
+ fullcourtdefense scan --local --type endpoint --endpoint "https://agent.internal/chat" --method POST --request-format custom --input-field message --output-field response --auth-type bearer --token YOUR_TOKEN --mode full --format report
530
+
531
+ # API key header
532
+ fullcourtdefense scan --local --type endpoint --endpoint "https://agent.internal/chat" --method POST --request-format custom --input-field message --output-field response --auth-type api-key --api-key-header X-API-Key --endpoint-api-key YOUR_KEY --mode full --format report
533
+ ```
534
+
535
+ ### MCP Scan
536
+
537
+ Use this when the target exposes tools through the Model Context Protocol. The CLI calls the tool with attack prompts, captures the tool response, sends that response to Shield, and saves the report to history.
538
+
539
+ For stdio MCP servers:
540
+
541
+ ```powershell
542
+ fullcourtdefense scan --local --type mcp --mcp-command node --mcp-args ".\dist\server.js" --mcp-tool all --mode full --format report
543
+ ```
544
+
545
+ For a single stdio tool with fixed args:
546
+
547
+ ```powershell
548
+ fullcourtdefense scan --local --type mcp --mcp-command node --mcp-args ".\dist\server.js" --mcp-tool search_docs --mcp-tool-args '{ "query": "{{attack}}" }' --mode quick --format report
549
+ ```
550
+
551
+ For already-running HTTP MCP servers:
552
+
553
+ ```powershell
554
+ fullcourtdefense scan --local --type mcp --mcp-url "http://mcp.internal.company.com/mcp" --mcp-tool all --mode full --format report
555
+ ```
556
+
557
+ For secured MCP servers:
558
+
559
+ ```powershell
560
+ # Bearer auth
561
+ fullcourtdefense scan --local --type mcp --mcp-url "https://internal.company.com/mcp" --mcp-auth-type bearer --mcp-token YOUR_TOKEN --mcp-tool all --mode full --format report
562
+
563
+ # Basic auth
564
+ fullcourtdefense scan --local --type mcp --mcp-url "https://internal.company.com/mcp" --mcp-auth-type basic --mcp-username USER --mcp-password PASS --mcp-tool all --mode full --format report
565
+
566
+ # API key header
567
+ fullcourtdefense scan --local --type mcp --mcp-url "https://internal.company.com/mcp" --mcp-auth-type api-key --mcp-api-key-header X-API-Key --mcp-api-key YOUR_KEY --mcp-tool all --mode full --format report
568
+ ```
569
+
570
+ For legacy SSE MCP:
571
+
572
+ ```powershell
573
+ fullcourtdefense scan --local --type mcp --mcp-transport sse --mcp-url "https://internal.company.com/sse" --mcp-tool all --mode full --format report
574
+ ```
575
+
576
+ MCP progress controls:
577
+
578
+ ```powershell
579
+ fullcourtdefense scan --local --type mcp --mcp-url "https://internal.company.com/mcp" --mcp-tool all --mode full --progress verbose --format report
580
+ fullcourtdefense scan --local --type mcp --mcp-url "https://internal.company.com/mcp" --mcp-tool all --mode full --progress compact --format summary
581
+ ```
582
+
583
+ ### RAG Corpus Scan
584
+
585
+ Use this when you have local documents or chunks before they are indexed. The CLI reads `.txt`, `.md`, `.json`, `.csv`, and `.html` files, sends chunks to the RAG Shield endpoint, and saves the report as a RAG scan.
586
+
587
+ ```powershell
588
+ fullcourtdefense scan --local --type rag --rag-path ".\docs" --mode quick --format report
589
+ fullcourtdefense scan --local --type rag --rag-path ".\docs" --mode full --format full-report
590
+ ```
591
+
592
+ Use corpus scan to find poisoned files before ingestion. Use live RAG scan when you need to test the actual retrieval service behavior.
593
+
594
+ ### Live RAG Service Scan
595
+
596
+ Use this when RAG is a running service, not just files. This is common for retrieval APIs that accept a question and return an answer with retrieved context.
597
+
598
+ ```powershell
599
+ fullcourtdefense scan --local --type rag --rag-url "http://rag.internal.company.com/chat" --method POST --request-format custom --input-field message --output-field answer --mode quick --format report
600
+ ```
601
+
602
+ Common live RAG shapes:
603
+
604
+ ```powershell
605
+ # Request: { "question": "..." }, response: { "answer": "..." }
606
+ fullcourtdefense scan --local --type rag --rag-url "http://localhost:5065/chat" --method POST --request-format custom --input-field question --output-field answer --mode full --format report
607
+
608
+ # Request: { "query": "..." }, response: { "result": "..." }
609
+ fullcourtdefense scan --local --type rag --rag-url "http://localhost:5065/query" --method POST --request-format custom --input-field query --output-field result --mode full --format report
610
+
611
+ # OpenAI-compatible RAG endpoint
612
+ fullcourtdefense scan --local --type rag --rag-url "http://localhost:5065/v1/chat/completions" --method POST --request-format openai --mode full --format report
613
+ ```
614
+
615
+ The web report will show `Agent Tested: Local full RAG endpoint scan: ...` and is saved with `scanType: rag`.
616
+
617
+ ### Local Demo RAG Server
618
+
619
+ This repository includes a deliberately vulnerable RAG service for testing the CLI flow:
620
+
621
+ ```powershell
622
+ $env:PORT = "5065"
623
+ node samples\rag\rag-server.js
624
+ ```
625
+
626
+ In another terminal:
627
+
628
+ ```powershell
629
+ fullcourtdefense scan --local --type rag --rag-url "http://127.0.0.1:5065/chat" --method POST --request-format custom --input-field message --output-field answer --mode quick --format report
630
+ ```
631
+
632
+ The demo should fail because it echoes raw poisoned retrieved context. That is expected and proves the scanner is catching RAG poisoning.
633
+
634
+ ### Older Compact Examples
635
+
636
+ ```bash
637
+ # Internal web API
638
+ fullcourtdefense scan --local --type endpoint --endpoint http://internal-agent.local/chat --method POST --shield-id sh_your_shield_id
639
+
640
+ # Internal OpenAI-compatible endpoint
641
+ fullcourtdefense scan --local --type endpoint --endpoint http://localhost:8080/v1/chat/completions --webhook-format openai --shield-id sh_your_shield_id
642
+
643
+ # MCP stdio server
644
+ fullcourtdefense scan --local --type mcp --mcp-command node --mcp-args ./dist/index.js --mcp-tool search_docs --mcp-tool-args '{"query":"security policy"}' --shield-id sh_your_shield_id
645
+
646
+ # Already-running HTTP or HTTPS MCP server
647
+ fullcourtdefense scan --local --type mcp --mcp-url http://mcp.internal.company.com/mcp
648
+ fullcourtdefense scan --local --type mcp --mcp-url http://mcp.internal.company.com/mcp --mcp-tool all --mode full --format report --shield-id sh_your_shield_id
649
+ fullcourtdefense scan --local --type mcp --mcp-url https://internal.company.com/mcp --mcp-tool all --mode full --format report --shield-id sh_your_shield_id
650
+
651
+ # Legacy SSE MCP server
652
+ fullcourtdefense scan --local --type mcp --mcp-transport sse --mcp-url https://internal.company.com/sse --mcp-tool all --mode full --format report --shield-id sh_your_shield_id
653
+
654
+ # Secured HTTP MCP server with bearer auth
655
+ fullcourtdefense scan --local --type mcp --mcp-url https://internal.company.com/mcp --mcp-auth-type bearer --mcp-token YOUR_TOKEN --mcp-tool all --mode full --format report --shield-id sh_your_shield_id
656
+
657
+ # Secured HTTP MCP server with basic auth
658
+ fullcourtdefense scan --local --type mcp --mcp-url https://internal.company.com/mcp --mcp-auth-type basic --mcp-username USER --mcp-password PASS --mcp-tool all --mode full --format report --shield-id sh_your_shield_id
659
+
660
+ # Secured HTTP MCP server with API-key auth
661
+ fullcourtdefense scan --local --type mcp --mcp-url https://internal.company.com/mcp --mcp-auth-type api-key --mcp-api-key-header X-API-Key --mcp-api-key YOUR_KEY --mcp-tool all --mode full --format report --shield-id sh_your_shield_id
662
+
663
+ # MCP full scan: all tools x bundled 229+ web attacks
664
+ fullcourtdefense scan --local --type mcp --mcp-command node --mcp-args ./dist/index.js --mcp-tool all --mode full --shield-id sh_your_shield_id
665
+
666
+ # MCP smoke test with same full corpus, limited to 10 attacks per tool
667
+ fullcourtdefense scan --local --type mcp --mcp-command node --mcp-args ./dist/index.js --mcp-tool all --mode full --attack-count 10 --shield-id sh_your_shield_id
668
+
669
+ # MCP evidence report: includes each attack sent, captured tool response, and Shield verdict
670
+ fullcourtdefense scan --local --type mcp --mcp-command node --mcp-args ./dist/index.js --mcp-tool all --mode full --attack-count 10 --format report --shield-id sh_your_shield_id
671
+
672
+ # MCP full scan with per-attack live progress
673
+ fullcourtdefense scan --local --type mcp --mcp-url https://internal.company.com/mcp --mcp-tool all --mode full --progress verbose --format report --shield-id sh_your_shield_id
674
+
675
+ # RAG documents
676
+ fullcourtdefense scan --local --type rag --rag-path ./docs --format table --shield-id sh_your_shield_id
677
+
678
+ # Live RAG HTTP service
679
+ fullcourtdefense scan --local --type rag --rag-url http://rag.internal.company.com/chat --method POST --request-format custom --input-field message --output-field answer --mode full --format report --shield-id sh_your_shield_id
680
+ ```
681
+
682
+ Local scans run from the machine executing the CLI, so they can reach private/VPN/internal targets without opening inbound firewall access. The only required network path is outbound HTTPS to your FullCourtDefense backend. With a Shield key configured, the CLI saves the completed scan into the same web Reports history used by hosted scans. The web report keeps every test row with bounded evidence text; use `--format report` or `--format json` locally for the full raw evidence artifact.
683
+
684
+ When an MCP destination is provided (`--mcp-url` or `--mcp-command`), the CLI defaults to a full all-tools report scan with per-attack live progress. Use `--progress compact` for shorter logs, or `--progress silent` for CI logs.
685
+
686
+ ## Outbound Diagnostic
687
+
688
+ Use `doctor` before local scans to confirm the customer environment can reach the FullCourtDefense backend over outbound HTTPS:
689
+
690
+ ```bash
691
+ fullcourtdefense doctor
692
+ fullcourtdefense doctor --api-url https://api.fullcourtdefense.ai
693
+ ```
694
+
695
+ It checks `GET /api/health/ping` and reports whether outbound TCP 443/HTTPS is open.
696
+
697
+ ## CI/CD Usage
698
+
699
+ The CLI returns exit code 1 when the score is below `--fail-threshold`, making it CI-friendly:
700
+
701
+ ```bash
702
+ fullcourtdefense scan --fail-threshold 80 --format summary
703
+ ```
704
+
705
+ For GitHub Actions, use [botguardai/security-scan](https://github.com/botguardai/security-scan) which wraps this CLI with PR comments and check status.
706
+
707
+ ## Get Your API Key
708
+
709
+ 1. Sign up at [fullcourtdefense.ai](https://fullcourtdefense.ai)
710
+ 2. Go to **Account > API Keys**
711
+ 3. Create a CI/CD key
712
+
713
+ ## Related
714
+
715
+ - [BotGuard](https://fullcourtdefense.ai) — Automated red-teaming & real-time firewall for AI agents
716
+ - [GitHub Action](https://github.com/botguardai/security-scan) — CI/CD security scanning
717
+ - [Attack Library](https://github.com/botguardai/llm-attacks) — 229+ open-source LLM attack templates
718
+
719
+ ## License
720
+
721
+ MIT