agentsentinel-cli 0.3.0__tar.gz → 0.5.0__tar.gz

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 (26) hide show
  1. agentsentinel_cli-0.5.0/PKG-INFO +342 -0
  2. agentsentinel_cli-0.5.0/README.md +304 -0
  3. agentsentinel_cli-0.5.0/agentsentinel_cli/ai_probe.py +300 -0
  4. agentsentinel_cli-0.5.0/agentsentinel_cli/attacks/__init__.py +5 -0
  5. agentsentinel_cli-0.5.0/agentsentinel_cli/attacks/library.py +438 -0
  6. {agentsentinel_cli-0.3.0 → agentsentinel_cli-0.5.0}/agentsentinel_cli/cli.py +319 -0
  7. agentsentinel_cli-0.5.0/agentsentinel_cli/fingerprint.py +275 -0
  8. agentsentinel_cli-0.5.0/agentsentinel_cli/inspect.py +251 -0
  9. agentsentinel_cli-0.5.0/agentsentinel_cli/inspect_report.py +214 -0
  10. agentsentinel_cli-0.5.0/agentsentinel_cli/probe.py +163 -0
  11. agentsentinel_cli-0.5.0/agentsentinel_cli/probe_report.py +254 -0
  12. agentsentinel_cli-0.5.0/agentsentinel_cli/target.py +164 -0
  13. {agentsentinel_cli-0.3.0 → agentsentinel_cli-0.5.0}/pyproject.toml +17 -2
  14. agentsentinel_cli-0.3.0/PKG-INFO +0 -187
  15. agentsentinel_cli-0.3.0/README.md +0 -158
  16. {agentsentinel_cli-0.3.0 → agentsentinel_cli-0.5.0}/.gitignore +0 -0
  17. {agentsentinel_cli-0.3.0 → agentsentinel_cli-0.5.0}/agentsentinel_cli/__init__.py +0 -0
  18. {agentsentinel_cli-0.3.0 → agentsentinel_cli-0.5.0}/agentsentinel_cli/discover.py +0 -0
  19. {agentsentinel_cli-0.3.0 → agentsentinel_cli-0.5.0}/agentsentinel_cli/discover_report.py +0 -0
  20. {agentsentinel_cli-0.3.0 → agentsentinel_cli-0.5.0}/agentsentinel_cli/frameworks.py +0 -0
  21. {agentsentinel_cli-0.3.0 → agentsentinel_cli-0.5.0}/agentsentinel_cli/mcp_client.py +0 -0
  22. {agentsentinel_cli-0.3.0 → agentsentinel_cli-0.5.0}/agentsentinel_cli/mcp_report.py +0 -0
  23. {agentsentinel_cli-0.3.0 → agentsentinel_cli-0.5.0}/agentsentinel_cli/mcp_rules.py +0 -0
  24. {agentsentinel_cli-0.3.0 → agentsentinel_cli-0.5.0}/agentsentinel_cli/report.py +0 -0
  25. {agentsentinel_cli-0.3.0 → agentsentinel_cli-0.5.0}/agentsentinel_cli/rules.py +0 -0
  26. {agentsentinel_cli-0.3.0 → agentsentinel_cli-0.5.0}/agentsentinel_cli/scanner.py +0 -0
@@ -0,0 +1,342 @@
1
+ Metadata-Version: 2.4
2
+ Name: agentsentinel-cli
3
+ Version: 0.5.0
4
+ Summary: Security scanner, red-team tool, and agent intelligence CLI — inspect, probe, MCP audit, and discovery for AI agents
5
+ Project-URL: Homepage, https://github.com/jaydenaung/agentsentinel
6
+ Project-URL: Repository, https://github.com/jaydenaung/agentsentinel
7
+ License: Apache-2.0
8
+ Keywords: agent-security,ai-security,cli,devsecops,discovery,langchain,llm,mcp,openai,scanner
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Environment :: Console
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Topic :: Security
14
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
15
+ Requires-Python: >=3.10
16
+ Requires-Dist: click>=8.0.0
17
+ Requires-Dist: rich>=13.0.0
18
+ Provides-Extra: ai-probe
19
+ Requires-Dist: anthropic>=0.50.0; extra == 'ai-probe'
20
+ Requires-Dist: httpx>=0.24.0; extra == 'ai-probe'
21
+ Provides-Extra: all
22
+ Requires-Dist: anthropic>=0.50.0; extra == 'all'
23
+ Requires-Dist: httpx>=0.24.0; extra == 'all'
24
+ Requires-Dist: psutil>=5.9.0; extra == 'all'
25
+ Provides-Extra: connect
26
+ Requires-Dist: httpx>=0.24.0; extra == 'connect'
27
+ Provides-Extra: discover
28
+ Requires-Dist: httpx>=0.24.0; extra == 'discover'
29
+ Requires-Dist: psutil>=5.9.0; extra == 'discover'
30
+ Provides-Extra: inspect
31
+ Requires-Dist: anthropic>=0.50.0; extra == 'inspect'
32
+ Requires-Dist: httpx>=0.24.0; extra == 'inspect'
33
+ Provides-Extra: mcp
34
+ Requires-Dist: httpx>=0.24.0; extra == 'mcp'
35
+ Provides-Extra: probe
36
+ Requires-Dist: httpx>=0.24.0; extra == 'probe'
37
+ Description-Content-Type: text/markdown
38
+
39
+ # agentsentinel-cli
40
+
41
+ Security scanner, red-team tool, and MCP auditor for AI agents. No server, no Docker, no setup.
42
+
43
+ ```bash
44
+ pipx install "agentsentinel-cli[all]"
45
+ sentinel inspect my_agent.py # what is this agent? plain English
46
+ sentinel scan my_agent.py # posture audit
47
+ sentinel probe http://localhost:3000 # 42-payload attack battery
48
+ sentinel ai-probe http://localhost:3000 # Claude-driven autonomous red-team
49
+ sentinel mcp scan http://localhost:3001 # MCP server security audit
50
+ ```
51
+
52
+ ---
53
+
54
+ ## Install
55
+
56
+ ```bash
57
+ # Recommended — isolated, no venv required
58
+ pipx install "agentsentinel-cli[all]"
59
+
60
+ # Or with pip
61
+ pip install agentsentinel-cli # sentinel scan (zero deps)
62
+
63
+ pip install "agentsentinel-cli[discover]" # + sentinel discover
64
+ pip install "agentsentinel-cli[mcp]" # + sentinel mcp scan
65
+ pip install "agentsentinel-cli[probe]" # + sentinel probe
66
+ pip install "agentsentinel-cli[ai-probe]" # + sentinel ai-probe (needs ANTHROPIC_API_KEY)
67
+ pip install "agentsentinel-cli[all]" # everything
68
+ ```
69
+
70
+ ---
71
+
72
+ ## Three security dimensions
73
+
74
+ | Dimension | Command | What it does |
75
+ |-----------|---------|--------------|
76
+ | **Intelligence** — what is it? | `sentinel inspect` | Fingerprint, plain English summary, data flows, trust score |
77
+ | **Posture** — what can it do? | `sentinel scan` | Static AST analysis, 12 rules, CI gate |
78
+ | **Posture** — what's running? | `sentinel discover` | Find unknown agents in processes, containers, subnets |
79
+ | **Posture** — MCP exposure? | `sentinel mcp scan` | Enumerate and audit any MCP server |
80
+ | **Vulnerability** — static | `sentinel probe` | 42-payload attack battery, no API key required |
81
+ | **Vulnerability** — AI-driven | `sentinel ai-probe` | Claude Opus as autonomous red-team agent |
82
+
83
+ ---
84
+
85
+ ## Commands
86
+
87
+ ### `sentinel inspect` — what is this agent?
88
+
89
+ Answers the question every security team asks first: *"What does this thing actually do?"*
90
+ Fingerprints the agent's framework, model, deployment, and cloud provider. Infers data
91
+ flows from tool analysis. With `ANTHROPIC_API_KEY` set, generates a plain English
92
+ description using Claude.
93
+
94
+ ```bash
95
+ # Inspect a single file
96
+ sentinel inspect my_agent.py
97
+
98
+ # Inspect all agents in a directory
99
+ sentinel inspect ./agents/
100
+
101
+ # Inspect a live HTTP endpoint
102
+ sentinel inspect http://localhost:3000
103
+
104
+ # JSON output (for SIEM or dashboards)
105
+ sentinel inspect my_agent.py --format json
106
+
107
+ # Skip AI summary (no API key needed)
108
+ sentinel inspect my_agent.py --no-ai
109
+ ```
110
+
111
+ **What it surfaces:**
112
+
113
+ | Section | Details |
114
+ |---------|---------|
115
+ | **Function** | Plain English: what the agent does, what it accesses, key risk |
116
+ | **Fingerprint** | Framework, model, Python version, deployment, cloud, system prompt |
117
+ | **Capabilities** | All tools with scope, category, and severity rating |
118
+ | **Data flows** | Where data comes from and where it goes |
119
+ | **Findings** | Posture rule violations (same engine as `sentinel scan`) |
120
+ | **Trust score** | 0–100 composite score with status label |
121
+
122
+ Works on file paths without any API key. Claude summary auto-activates when
123
+ `ANTHROPIC_API_KEY` is present.
124
+
125
+ ---
126
+
127
+ ### `sentinel scan` — audit an agent file
128
+
129
+ Detects exfiltration paths, dangerous grants, hardcoded credentials, and more
130
+ from static analysis of Python agent files.
131
+
132
+ ```bash
133
+ # Scan a single file
134
+ sentinel scan my_agent.py
135
+
136
+ # Scan a directory recursively
137
+ sentinel scan ./agents/
138
+
139
+ # Fail with exit code 1 if CRITICAL findings exist (for CI)
140
+ sentinel scan my_agent.py --fail-on CRITICAL
141
+
142
+ # JSON output (for piping into other tools)
143
+ sentinel scan my_agent.py --format json
144
+
145
+ # Include live behavior data from a running AgentSentinel instance
146
+ sentinel scan my_agent.py --connect http://localhost:9000
147
+ ```
148
+
149
+ **What it detects:**
150
+
151
+ | Rule | Severity | Description |
152
+ |------|----------|-------------|
153
+ | `EXFILTRATION_PATH` | CRITICAL | Agent holds internal-read AND external-write grants |
154
+ | `CODE_EXECUTION_GRANT` | CRITICAL | Agent holds bash/exec/shell grants |
155
+ | `HARDCODED_CREDENTIALS` | CRITICAL | API keys or secrets hardcoded in source |
156
+ | `SECRETS_ACCESS_GRANT` | HIGH | Agent holds runtime access to vaults or tokens |
157
+ | `PROMPT_INJECTION_VECTOR` | HIGH | Agent reads from web AND holds write grants |
158
+ | `LATERAL_MOVEMENT_PATH` | HIGH | Admin/IAM grants combined with infrastructure grants |
159
+ | `UNBOUNDED_FILE_ACCESS` | HIGH | Filesystem write grants with no scoped description |
160
+ | `PRIVILEGE_EXCESS` | HIGH | Write grants on a read-only described agent |
161
+ | `DANGEROUS_GRANTS` | HIGH | Agent holds dangerous tool grants |
162
+ | `TOOL_SPRAWL` | MEDIUM | Too many tools across too many categories |
163
+ | `UNDESCRIBED_WRITE_AGENT` | MEDIUM | Write grants with no agent description |
164
+ | `MISSING_RATE_LIMIT` | LOW | Dangerous grants without rate limit configuration |
165
+
166
+ ---
167
+
168
+ ### `sentinel probe` — static red-team battery
169
+
170
+ Fires 42 attack payloads across 5 categories against any HTTP agent endpoint.
171
+ No API key required. Ideal for CI/CD gates and quick sanity checks.
172
+
173
+ ```bash
174
+ # Run all 42 attacks
175
+ sentinel probe http://localhost:3000
176
+
177
+ # Run specific attack categories
178
+ sentinel probe http://localhost:3000 --attacks injection,jailbreak
179
+
180
+ # Custom field names (auto-detected by default)
181
+ sentinel probe http://localhost:3000 --input-field query --output-field answer
182
+
183
+ # Add auth header
184
+ sentinel probe http://localhost:3000 --auth-header "Authorization: Bearer token"
185
+
186
+ # JSON output
187
+ sentinel probe http://localhost:3000 --format json
188
+
189
+ # Fail CI if hit rate exceeds threshold
190
+ sentinel probe http://localhost:3000 --fail-on 0.1
191
+ ```
192
+
193
+ **Attack categories:**
194
+
195
+ | Category | Payloads | Description |
196
+ |----------|----------|-------------|
197
+ | `injection` | 10 | Classic prompt override, authority injection, nested context |
198
+ | `jailbreak` | 12 | DAN, persona adoption, fictional framing, developer mode |
199
+ | `extraction` | 8 | System prompt leakage, verbatim repeat, sentence completion |
200
+ | `encoding` | 6 | Base64, ROT13, unicode homoglyph, whitespace injection |
201
+ | `context` | 6 | Few-shot manipulation, false anchoring, semantic satiation |
202
+
203
+ Auto-detects OpenAI-compatible (`/v1/chat/completions`) vs custom field format on first request.
204
+
205
+ ---
206
+
207
+ ### `sentinel ai-probe` — Claude-driven autonomous red-team
208
+
209
+ Unleashes Claude Opus as an autonomous security researcher against your agent endpoint.
210
+ Claude forms its own threat model, crafts targeted attacks, escalates on partial success,
211
+ and documents findings with OWASP LLM Top 10 mappings.
212
+
213
+ ```bash
214
+ # Requires ANTHROPIC_API_KEY in environment
215
+ export ANTHROPIC_API_KEY=sk-ant-...
216
+
217
+ # Run with default settings (20 probes)
218
+ sentinel ai-probe http://localhost:3000
219
+
220
+ # Provide agent context for better targeting
221
+ sentinel ai-probe http://localhost:3000 \
222
+ --context "Customer service chatbot for a fintech company"
223
+
224
+ # Increase probe depth
225
+ sentinel ai-probe http://localhost:3000 --max-probes 50
226
+
227
+ # JSON output for downstream tooling
228
+ sentinel ai-probe http://localhost:3000 --format json
229
+ ```
230
+
231
+ Claude autonomously executes a 5-phase methodology: Reconnaissance → Threat Modelling →
232
+ Targeted Attacks → Escalation → Documentation. Every finding includes severity, OWASP
233
+ category, and evidence.
234
+
235
+ ---
236
+
237
+ ### `sentinel mcp scan` — audit an MCP server
238
+
239
+ Connects to any MCP server, enumerates all exposed tools, and checks for
240
+ authentication gaps, exfiltration paths, code execution exposure, and input
241
+ validation weaknesses.
242
+
243
+ ```bash
244
+ # Scan an HTTP MCP server
245
+ sentinel mcp scan http://localhost:3001
246
+
247
+ # Scan with authentication
248
+ sentinel mcp scan http://localhost:3001 --auth-header "Authorization: Bearer token"
249
+
250
+ # Scan a stdio-transport server (launch as subprocess)
251
+ sentinel mcp scan --stdio "python my_mcp_server.py"
252
+
253
+ # JSON output for CI pipelines
254
+ sentinel mcp scan http://localhost:3001 --format json
255
+
256
+ # Fail CI on CRITICAL findings
257
+ sentinel mcp scan http://localhost:3001 --fail-on CRITICAL
258
+ ```
259
+
260
+ **What it detects:**
261
+
262
+ | Rule | Severity | Description |
263
+ |------|----------|-------------|
264
+ | `NO_AUTH` | CRITICAL | Server accepts tool enumeration with no credentials (HTTP) |
265
+ | `UNAUTH_DANGEROUS_EXEC` | CRITICAL | Dangerous tools callable without authentication (HTTP) |
266
+ | `EXFILTRATION_PATH` | CRITICAL | Server exposes internal-read AND external-write tools |
267
+ | `CODE_EXECUTION_TOOL` | CRITICAL | Server exposes code execution tools |
268
+ | `UNBOUNDED_INPUT` | HIGH | Tools accept unconstrained string inputs — injection surface |
269
+ | `TOOL_SPRAWL` | MEDIUM | Excessive tool count or category breadth |
270
+ | `VAGUE_TOOL_DESCRIPTIONS` | MEDIUM | Short/missing descriptions expand injection surface |
271
+ | `MISSING_RATE_LIMIT` | LOW | Dangerous tools present with no visible rate limiting |
272
+
273
+ See [`docs/mcp-scan-testing.md`](../docs/mcp-scan-testing.md) for test server examples
274
+ that trigger every finding.
275
+
276
+ ---
277
+
278
+ ### `sentinel discover` — find AI agents in your environment
279
+
280
+ ```bash
281
+ sentinel discover # scan processes + network
282
+ sentinel discover --docker # include Docker containers
283
+ sentinel discover --path ./agents # scan a source directory
284
+ sentinel discover --subnet 10.0.0.0/24 # scan an internal subnet
285
+ sentinel discover --format json # machine-readable output
286
+ ```
287
+
288
+ ---
289
+
290
+ ## OWASP LLM Top 10 coverage
291
+
292
+ | OWASP LLM | sentinel command |
293
+ |-----------|-----------------|
294
+ | LLM01 Prompt Injection | `sentinel probe`, `sentinel ai-probe` |
295
+ | LLM02 Sensitive Info Disclosure | `sentinel probe` (extraction category) |
296
+ | LLM06 Excessive Agency | `sentinel scan`, `sentinel discover` |
297
+ | LLM07 System Prompt Leakage | `sentinel probe` (extraction), `sentinel ai-probe` |
298
+ | LLM08 Vector/Embedding Weaknesses | `sentinel mcp scan` |
299
+
300
+ ---
301
+
302
+ ## CI/CD integration
303
+
304
+ ```yaml
305
+ # .github/workflows/security.yml
306
+ - name: Audit agent posture
307
+ run: |
308
+ pip install agentsentinel-cli
309
+ sentinel scan ./agents/ --fail-on CRITICAL
310
+
311
+ - name: Probe agent endpoint
312
+ run: |
313
+ pip install "agentsentinel-cli[probe]"
314
+ sentinel probe http://localhost:3000 --fail-on 0.2
315
+
316
+ - name: Audit MCP server
317
+ run: |
318
+ pip install "agentsentinel-cli[mcp]"
319
+ sentinel mcp scan http://localhost:3001 --fail-on CRITICAL
320
+ ```
321
+
322
+ ---
323
+
324
+ ## Tool detection (`sentinel scan`)
325
+
326
+ The scanner detects tools defined via:
327
+ - `@tool` decorator (LangChain)
328
+ - `@SentinelTool` decorator (AgentSentinel middleware)
329
+ - `BaseTool` / `StructuredTool` subclasses
330
+ - `Tool(name=...)` and `StructuredTool(name=...)` instantiations
331
+
332
+ ---
333
+
334
+ ## Requirements
335
+
336
+ - Python 3.10+
337
+ - No API key required for `sentinel scan`, `sentinel inspect --no-ai`, `sentinel probe`
338
+ - `ANTHROPIC_API_KEY` required for AI summary (`sentinel inspect`), `sentinel ai-probe`
339
+ - `httpx` required for live endpoint inspection: `pip install "agentsentinel-cli[inspect]"`
340
+ - `httpx` required for HTTP MCP scanning: `pip install "agentsentinel-cli[mcp]"`
341
+ - `psutil` + `httpx` required for `sentinel discover`: `pip install "agentsentinel-cli[discover]"`
342
+ - `httpx` + `anthropic` required for `sentinel ai-probe`: `pip install "agentsentinel-cli[ai-probe]"`
@@ -0,0 +1,304 @@
1
+ # agentsentinel-cli
2
+
3
+ Security scanner, red-team tool, and MCP auditor for AI agents. No server, no Docker, no setup.
4
+
5
+ ```bash
6
+ pipx install "agentsentinel-cli[all]"
7
+ sentinel inspect my_agent.py # what is this agent? plain English
8
+ sentinel scan my_agent.py # posture audit
9
+ sentinel probe http://localhost:3000 # 42-payload attack battery
10
+ sentinel ai-probe http://localhost:3000 # Claude-driven autonomous red-team
11
+ sentinel mcp scan http://localhost:3001 # MCP server security audit
12
+ ```
13
+
14
+ ---
15
+
16
+ ## Install
17
+
18
+ ```bash
19
+ # Recommended — isolated, no venv required
20
+ pipx install "agentsentinel-cli[all]"
21
+
22
+ # Or with pip
23
+ pip install agentsentinel-cli # sentinel scan (zero deps)
24
+
25
+ pip install "agentsentinel-cli[discover]" # + sentinel discover
26
+ pip install "agentsentinel-cli[mcp]" # + sentinel mcp scan
27
+ pip install "agentsentinel-cli[probe]" # + sentinel probe
28
+ pip install "agentsentinel-cli[ai-probe]" # + sentinel ai-probe (needs ANTHROPIC_API_KEY)
29
+ pip install "agentsentinel-cli[all]" # everything
30
+ ```
31
+
32
+ ---
33
+
34
+ ## Three security dimensions
35
+
36
+ | Dimension | Command | What it does |
37
+ |-----------|---------|--------------|
38
+ | **Intelligence** — what is it? | `sentinel inspect` | Fingerprint, plain English summary, data flows, trust score |
39
+ | **Posture** — what can it do? | `sentinel scan` | Static AST analysis, 12 rules, CI gate |
40
+ | **Posture** — what's running? | `sentinel discover` | Find unknown agents in processes, containers, subnets |
41
+ | **Posture** — MCP exposure? | `sentinel mcp scan` | Enumerate and audit any MCP server |
42
+ | **Vulnerability** — static | `sentinel probe` | 42-payload attack battery, no API key required |
43
+ | **Vulnerability** — AI-driven | `sentinel ai-probe` | Claude Opus as autonomous red-team agent |
44
+
45
+ ---
46
+
47
+ ## Commands
48
+
49
+ ### `sentinel inspect` — what is this agent?
50
+
51
+ Answers the question every security team asks first: *"What does this thing actually do?"*
52
+ Fingerprints the agent's framework, model, deployment, and cloud provider. Infers data
53
+ flows from tool analysis. With `ANTHROPIC_API_KEY` set, generates a plain English
54
+ description using Claude.
55
+
56
+ ```bash
57
+ # Inspect a single file
58
+ sentinel inspect my_agent.py
59
+
60
+ # Inspect all agents in a directory
61
+ sentinel inspect ./agents/
62
+
63
+ # Inspect a live HTTP endpoint
64
+ sentinel inspect http://localhost:3000
65
+
66
+ # JSON output (for SIEM or dashboards)
67
+ sentinel inspect my_agent.py --format json
68
+
69
+ # Skip AI summary (no API key needed)
70
+ sentinel inspect my_agent.py --no-ai
71
+ ```
72
+
73
+ **What it surfaces:**
74
+
75
+ | Section | Details |
76
+ |---------|---------|
77
+ | **Function** | Plain English: what the agent does, what it accesses, key risk |
78
+ | **Fingerprint** | Framework, model, Python version, deployment, cloud, system prompt |
79
+ | **Capabilities** | All tools with scope, category, and severity rating |
80
+ | **Data flows** | Where data comes from and where it goes |
81
+ | **Findings** | Posture rule violations (same engine as `sentinel scan`) |
82
+ | **Trust score** | 0–100 composite score with status label |
83
+
84
+ Works on file paths without any API key. Claude summary auto-activates when
85
+ `ANTHROPIC_API_KEY` is present.
86
+
87
+ ---
88
+
89
+ ### `sentinel scan` — audit an agent file
90
+
91
+ Detects exfiltration paths, dangerous grants, hardcoded credentials, and more
92
+ from static analysis of Python agent files.
93
+
94
+ ```bash
95
+ # Scan a single file
96
+ sentinel scan my_agent.py
97
+
98
+ # Scan a directory recursively
99
+ sentinel scan ./agents/
100
+
101
+ # Fail with exit code 1 if CRITICAL findings exist (for CI)
102
+ sentinel scan my_agent.py --fail-on CRITICAL
103
+
104
+ # JSON output (for piping into other tools)
105
+ sentinel scan my_agent.py --format json
106
+
107
+ # Include live behavior data from a running AgentSentinel instance
108
+ sentinel scan my_agent.py --connect http://localhost:9000
109
+ ```
110
+
111
+ **What it detects:**
112
+
113
+ | Rule | Severity | Description |
114
+ |------|----------|-------------|
115
+ | `EXFILTRATION_PATH` | CRITICAL | Agent holds internal-read AND external-write grants |
116
+ | `CODE_EXECUTION_GRANT` | CRITICAL | Agent holds bash/exec/shell grants |
117
+ | `HARDCODED_CREDENTIALS` | CRITICAL | API keys or secrets hardcoded in source |
118
+ | `SECRETS_ACCESS_GRANT` | HIGH | Agent holds runtime access to vaults or tokens |
119
+ | `PROMPT_INJECTION_VECTOR` | HIGH | Agent reads from web AND holds write grants |
120
+ | `LATERAL_MOVEMENT_PATH` | HIGH | Admin/IAM grants combined with infrastructure grants |
121
+ | `UNBOUNDED_FILE_ACCESS` | HIGH | Filesystem write grants with no scoped description |
122
+ | `PRIVILEGE_EXCESS` | HIGH | Write grants on a read-only described agent |
123
+ | `DANGEROUS_GRANTS` | HIGH | Agent holds dangerous tool grants |
124
+ | `TOOL_SPRAWL` | MEDIUM | Too many tools across too many categories |
125
+ | `UNDESCRIBED_WRITE_AGENT` | MEDIUM | Write grants with no agent description |
126
+ | `MISSING_RATE_LIMIT` | LOW | Dangerous grants without rate limit configuration |
127
+
128
+ ---
129
+
130
+ ### `sentinel probe` — static red-team battery
131
+
132
+ Fires 42 attack payloads across 5 categories against any HTTP agent endpoint.
133
+ No API key required. Ideal for CI/CD gates and quick sanity checks.
134
+
135
+ ```bash
136
+ # Run all 42 attacks
137
+ sentinel probe http://localhost:3000
138
+
139
+ # Run specific attack categories
140
+ sentinel probe http://localhost:3000 --attacks injection,jailbreak
141
+
142
+ # Custom field names (auto-detected by default)
143
+ sentinel probe http://localhost:3000 --input-field query --output-field answer
144
+
145
+ # Add auth header
146
+ sentinel probe http://localhost:3000 --auth-header "Authorization: Bearer token"
147
+
148
+ # JSON output
149
+ sentinel probe http://localhost:3000 --format json
150
+
151
+ # Fail CI if hit rate exceeds threshold
152
+ sentinel probe http://localhost:3000 --fail-on 0.1
153
+ ```
154
+
155
+ **Attack categories:**
156
+
157
+ | Category | Payloads | Description |
158
+ |----------|----------|-------------|
159
+ | `injection` | 10 | Classic prompt override, authority injection, nested context |
160
+ | `jailbreak` | 12 | DAN, persona adoption, fictional framing, developer mode |
161
+ | `extraction` | 8 | System prompt leakage, verbatim repeat, sentence completion |
162
+ | `encoding` | 6 | Base64, ROT13, unicode homoglyph, whitespace injection |
163
+ | `context` | 6 | Few-shot manipulation, false anchoring, semantic satiation |
164
+
165
+ Auto-detects OpenAI-compatible (`/v1/chat/completions`) vs custom field format on first request.
166
+
167
+ ---
168
+
169
+ ### `sentinel ai-probe` — Claude-driven autonomous red-team
170
+
171
+ Unleashes Claude Opus as an autonomous security researcher against your agent endpoint.
172
+ Claude forms its own threat model, crafts targeted attacks, escalates on partial success,
173
+ and documents findings with OWASP LLM Top 10 mappings.
174
+
175
+ ```bash
176
+ # Requires ANTHROPIC_API_KEY in environment
177
+ export ANTHROPIC_API_KEY=sk-ant-...
178
+
179
+ # Run with default settings (20 probes)
180
+ sentinel ai-probe http://localhost:3000
181
+
182
+ # Provide agent context for better targeting
183
+ sentinel ai-probe http://localhost:3000 \
184
+ --context "Customer service chatbot for a fintech company"
185
+
186
+ # Increase probe depth
187
+ sentinel ai-probe http://localhost:3000 --max-probes 50
188
+
189
+ # JSON output for downstream tooling
190
+ sentinel ai-probe http://localhost:3000 --format json
191
+ ```
192
+
193
+ Claude autonomously executes a 5-phase methodology: Reconnaissance → Threat Modelling →
194
+ Targeted Attacks → Escalation → Documentation. Every finding includes severity, OWASP
195
+ category, and evidence.
196
+
197
+ ---
198
+
199
+ ### `sentinel mcp scan` — audit an MCP server
200
+
201
+ Connects to any MCP server, enumerates all exposed tools, and checks for
202
+ authentication gaps, exfiltration paths, code execution exposure, and input
203
+ validation weaknesses.
204
+
205
+ ```bash
206
+ # Scan an HTTP MCP server
207
+ sentinel mcp scan http://localhost:3001
208
+
209
+ # Scan with authentication
210
+ sentinel mcp scan http://localhost:3001 --auth-header "Authorization: Bearer token"
211
+
212
+ # Scan a stdio-transport server (launch as subprocess)
213
+ sentinel mcp scan --stdio "python my_mcp_server.py"
214
+
215
+ # JSON output for CI pipelines
216
+ sentinel mcp scan http://localhost:3001 --format json
217
+
218
+ # Fail CI on CRITICAL findings
219
+ sentinel mcp scan http://localhost:3001 --fail-on CRITICAL
220
+ ```
221
+
222
+ **What it detects:**
223
+
224
+ | Rule | Severity | Description |
225
+ |------|----------|-------------|
226
+ | `NO_AUTH` | CRITICAL | Server accepts tool enumeration with no credentials (HTTP) |
227
+ | `UNAUTH_DANGEROUS_EXEC` | CRITICAL | Dangerous tools callable without authentication (HTTP) |
228
+ | `EXFILTRATION_PATH` | CRITICAL | Server exposes internal-read AND external-write tools |
229
+ | `CODE_EXECUTION_TOOL` | CRITICAL | Server exposes code execution tools |
230
+ | `UNBOUNDED_INPUT` | HIGH | Tools accept unconstrained string inputs — injection surface |
231
+ | `TOOL_SPRAWL` | MEDIUM | Excessive tool count or category breadth |
232
+ | `VAGUE_TOOL_DESCRIPTIONS` | MEDIUM | Short/missing descriptions expand injection surface |
233
+ | `MISSING_RATE_LIMIT` | LOW | Dangerous tools present with no visible rate limiting |
234
+
235
+ See [`docs/mcp-scan-testing.md`](../docs/mcp-scan-testing.md) for test server examples
236
+ that trigger every finding.
237
+
238
+ ---
239
+
240
+ ### `sentinel discover` — find AI agents in your environment
241
+
242
+ ```bash
243
+ sentinel discover # scan processes + network
244
+ sentinel discover --docker # include Docker containers
245
+ sentinel discover --path ./agents # scan a source directory
246
+ sentinel discover --subnet 10.0.0.0/24 # scan an internal subnet
247
+ sentinel discover --format json # machine-readable output
248
+ ```
249
+
250
+ ---
251
+
252
+ ## OWASP LLM Top 10 coverage
253
+
254
+ | OWASP LLM | sentinel command |
255
+ |-----------|-----------------|
256
+ | LLM01 Prompt Injection | `sentinel probe`, `sentinel ai-probe` |
257
+ | LLM02 Sensitive Info Disclosure | `sentinel probe` (extraction category) |
258
+ | LLM06 Excessive Agency | `sentinel scan`, `sentinel discover` |
259
+ | LLM07 System Prompt Leakage | `sentinel probe` (extraction), `sentinel ai-probe` |
260
+ | LLM08 Vector/Embedding Weaknesses | `sentinel mcp scan` |
261
+
262
+ ---
263
+
264
+ ## CI/CD integration
265
+
266
+ ```yaml
267
+ # .github/workflows/security.yml
268
+ - name: Audit agent posture
269
+ run: |
270
+ pip install agentsentinel-cli
271
+ sentinel scan ./agents/ --fail-on CRITICAL
272
+
273
+ - name: Probe agent endpoint
274
+ run: |
275
+ pip install "agentsentinel-cli[probe]"
276
+ sentinel probe http://localhost:3000 --fail-on 0.2
277
+
278
+ - name: Audit MCP server
279
+ run: |
280
+ pip install "agentsentinel-cli[mcp]"
281
+ sentinel mcp scan http://localhost:3001 --fail-on CRITICAL
282
+ ```
283
+
284
+ ---
285
+
286
+ ## Tool detection (`sentinel scan`)
287
+
288
+ The scanner detects tools defined via:
289
+ - `@tool` decorator (LangChain)
290
+ - `@SentinelTool` decorator (AgentSentinel middleware)
291
+ - `BaseTool` / `StructuredTool` subclasses
292
+ - `Tool(name=...)` and `StructuredTool(name=...)` instantiations
293
+
294
+ ---
295
+
296
+ ## Requirements
297
+
298
+ - Python 3.10+
299
+ - No API key required for `sentinel scan`, `sentinel inspect --no-ai`, `sentinel probe`
300
+ - `ANTHROPIC_API_KEY` required for AI summary (`sentinel inspect`), `sentinel ai-probe`
301
+ - `httpx` required for live endpoint inspection: `pip install "agentsentinel-cli[inspect]"`
302
+ - `httpx` required for HTTP MCP scanning: `pip install "agentsentinel-cli[mcp]"`
303
+ - `psutil` + `httpx` required for `sentinel discover`: `pip install "agentsentinel-cli[discover]"`
304
+ - `httpx` + `anthropic` required for `sentinel ai-probe`: `pip install "agentsentinel-cli[ai-probe]"`