To keep an AI pentest agent in scope, do two things. Give it the scope before it acts, and check every command at a place the model cannot argue with. CommentLLM's agent kit does the first with an MCP server that Claude Code, Codex CLI and opencode can load. Its engagement keys do the second at the API.
The kit is live as of 27 November 2026 and included with every account.
The short version:
- One MCP endpoint, three tools.
engagement_scopereturns the rules of engagement.check_targetsays whether a host, address or URL is in scope.record_findingadds a finding to the engagement's record. - It runs nothing. It is not a server of scanners. It tells your agent what it may touch, and the tools your agent already has do the work.
- The same key. The endpoint takes your CommentLLM API key. There is nothing to install and nothing extra to pay.
- The check still happens at the API. Under an engagement that blocks, if the model asks for a command outside the scope anyway, the gateway does not deliver it.
Why an AI pentest agent needs the scope up front
An engagement key already holds an agent to its scope: every tool call the model asks for is checked before your agent receives it. But a check alone teaches the agent its limits one refusal at a time. It plans a scan of a host it was never allowed to touch, the call is refused, and the turn is spent.
A person on a penetration test reads the rules of engagement first. The agent kit lets an agent do the same:
| Without the kit | With the kit |
|---|---|
| The agent learns the scope when a call is refused. | The agent reads the scope before its first command. |
| A refused call ends the turn. | The agent asks about a target first and gets an answer it can act on. |
| The record shows what was blocked. | The record also lists the findings, each tied to the time it was recorded. |
What the three tools answer
| Tool | Takes | Answers |
|---|---|---|
engagement_scope |
Nothing | The engagement's name and dates, the authorized targets, the exclusions, the other allowed hosts, whether a call outside scope is blocked or only recorded, and what the gateway's check reads and does not read. |
check_target |
One host name, IP address, range, URL or host:port per call |
Whether it is in scope, and why not when it is not. |
record_finding |
A severity (critical, high, medium, low or info) and the finding's text |
The finding's number and the SHA-256 digest of its text. |
A key that is not bound to an engagement gets an answer that says so from each tool, not an error.
Set it up
1. Create an engagement and a key for it. In the console, open Policies, then Scope, and add an engagement with the client, the dates, the targets and what is excluded. Create a key on the engagement's page. Engagement keys explains each field.
2. Put the key where your agent reads it. Every file below reads the key from COMMENTLLM_API_KEY.
export COMMENTLLM_API_KEY="cllm_..."
3. Connect your agent to the endpoint. It is https://api.commentllm.com/v1/mcp.
Claude Code reads .mcp.json in the project folder:
{
"mcpServers": {
"commentllm": {
"type": "http",
"url": "https://api.commentllm.com/v1/mcp",
"headers": {
"Authorization": "Bearer ${COMMENTLLM_API_KEY}"
},
"alwaysLoad": true
}
}
}
Codex CLI reads ~/.codex/config.toml. Add:
[mcp_servers.commentllm]
url = "https://api.commentllm.com/v1/mcp"
bearer_token_env_var = "COMMENTLLM_API_KEY"
opencode reads opencode.json. Merge in the mcp block:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"servers": {
"commentllm": {
"type": "remote",
"url": "https://api.commentllm.com/v1/mcp",
"oauth": false,
"codemode": false,
"headers": {
"Authorization": "Bearer {env:COMMENTLLM_API_KEY}"
}
}
}
}
}
The same three files are served at /kit/claude-code.mcp.json, /kit/codex-config.toml and /kit/opencode.json. Each agent's model settings are in its own guide: Claude Code, Codex CLI and opencode.
Two things to know about Claude Code:
- It does not send
ANTHROPIC_AUTH_TOKENto an MCP server, so setCOMMENTLLM_API_KEYto the same key. alwaysLoadputs the three tools in front of the model from the first request. Without it Claude Code keeps an MCP server's tools behind its tool search, and the model has to search for a tool before it can call it.
And one about opencode: codemode: false keeps the tools on the model's own tool list. Under opencode's Code Mode the model reaches tools through code it writes, and the gateway reads that code like any other command, the address it asks about included.
Keep the server's name, commentllm, as the files have it. The gateway recognizes the kit's tools by the names agents give them under that name.
4. Give the agent its rules. Add rules-of-engagement.md to the file your agent reads at the start of a session: AGENTS.md for Codex CLI and opencode, CLAUDE.md for Claude Code. It tells the agent to read the scope first, to check a target before any network action, and to record a finding when it confirms one.
What your agent sees
The examples use a sample engagement that authorizes *.acme.example, 10.20.0.0/16 and api.partner.example:443, excludes payments.acme.example and allows github.com.
Asked about an address inside the scope, check_target says so:
10.20.3.4 is in scope for the engagement "Acme external".
Asked about one outside it, it gives the sentence a refused tool call carries, and says what to do:
203.0.113.9 is not in scope for the engagement "Acme external". Do not send traffic to it.
The other answers follow the engagement's lists:
| Asked about | Answer |
|---|---|
https://payments.acme.example/pay |
Excluded from the engagement. |
http://api.partner.example/ |
In scope, but not on port 80. It is authorized on port 443 only. |
api.partner.example |
In scope on port 443 only. A command that writes the host with another port, as host:port or in a URL, is still refused. |
10.20.3.4 203.0.113.9 |
Not one target. The agent is told to ask once for each. |
github.com |
One of the other allowed hosts. It may be reached, but it is not a target to test. |
localhost |
This machine. The scope check never reads it. |
Each answer is JSON whose first field is a one-line summary, so a model reads the verdict first and a script can read the fields.
How it fits with the check at the API
The tools inform. The gateway decides. The answer comes from the code that checks tool calls: the same reading of the text and the same matching. The tool is never more lenient than the gateway: if the gateway would refuse a command that carries the same text, the tool says no, with the sentence the refused command would carry. If the model is told no and asks for the command anyway, the command is still not delivered.
Asking is not acting. A call to check_target names an address, and the gateway reads every tool call. So that the question is not itself refused, a call to one of the kit's own tools is set aside and counted apart. This applies only to a tool named as an agent names the kit's tool under the server name commentllm, offered once in the request with the kit's own description, word for word, and called with only the tool's own arguments. Every other call is read as before.
It answers for names the gateway cannot read. The gateway reads a bare host name only when it is unambiguous, so that it does not mistake code for hosts. A name such as db01.corp.internal in a command is not read. Asked about directly, it is judged, and the answer says that the gateway would not have stopped a call that names it that way.
Findings your client can check
When the agent confirms a finding, it calls record_finding with a severity and the finding's full text. CommentLLM works out the SHA-256 digest of the text, stores the time, the severity and the digest, and lets the text go. The agent gets the finding's number and digest back and saves them with its own copy of the text.
When you close the engagement, the list of findings is sealed with the rest of the record. Your client drops the record on commentllm.com/verify and pastes a finding, or chooses the file your agent saved it in. The page hashes the text in the browser and says whether it is in the record and when it was recorded:
- A match shows that this exact text was recorded at that time and has not changed since.
- No match means this text, character for character, was not recorded in this engagement. A copy taken from a formatted report can differ in its quotes, spaces or line breaks, so check the file your agent saved.
CommentLLM never stores the text. It passes through the gateway like the rest of the conversation, and the verify page never sends it anywhere. A match does not show that the finding is true. It shows that it was written down when the record says it was.
What we tested
On 27 November 2026 we ran each agent in a sandbox against a build of the gateway, with a scripted model so that the tool calls were known in advance.
| Agent | Version | MCP revision it used |
|---|---|---|
| Claude Code | 2.1.332 | 2026-07-28 |
| Codex CLI | 0.172.0 | 2025-06-18 |
| opencode | 1.19.6 | 2025-11-25 |
The current revision of the Model Context Protocol, 2026-07-28, dropped the opening handshake. Claude Code already speaks it. Codex CLI and opencode still open with a handshake. The endpoint answers all three.
| What the scripted model did | Result with each of the three agents |
|---|---|
| Read the scope, checked an address inside it, ran a command that names it | The scope and the answer reached the model, and the command ran |
| Checked an address outside the scope | The answer arrived. Nothing was logged as blocked |
| Checked an excluded URL and a bare internal name | Both answers arrived |
| Was told no, then asked for the command anyway | The gateway did not deliver the command |
| The same under an engagement that only records | The command was delivered and logged as flagged |
| Read the scope with a key that has no engagement | The answer said the key is not bound |
| Recorded a finding whose text names a host outside the scope | The call was not held to the scope, and the agent got the finding's number and digest back. The stored row held the time, the severity and the digest, and not the text |
| Recorded a finding with a key that has no engagement | The answer said there is no record to add it to |
Then, on the live service, we connected each agent to https://api.commentllm.com/v1/mcp with the three files exactly as commentllm.com serves them under /kit/, on a real model through the API. Each agent found the two scope tools, called engagement_scope and check_target, and passed the answers on word for word. That run used a key with no engagement, so the answers said so. The scope answers for a bound key, shown above, come from the same code and from the sandbox runs.
What it does not do
- It runs no tools. It is not a server of scanners or exploits. Use it beside the tools your agent already has.
- It does not stop anything by itself. The engagement key does that, at the API. A key without an engagement gets answers that say there is no scope to read.
- It cannot see every way a target is named. The gateway's check reads IP addresses, URLs and unambiguous host names. A name after
@, as inssh root@host, is checked only against the exclusions. A script the agent wrote earlier and now runs by its file name is not read. - Your own policies still apply. If your organization runs its own scope policy on requests, it reads the kit's answers like any other text. An answer that names an excluded address will block the next request.
- A finding's digest is not the finding. CommentLLM cannot give you the text back. Keep your copy.
- It is not your authorization. You still need the signed rules of engagement.
Questions
Is there an MCP server for AI pentesting?
Several MCP servers wrap scanners and other tools. CommentLLM's does something else: it gives an AI pentest agent the scope of the engagement its API key is bound to, answers whether a host, address or URL is in scope, and records findings in the engagement's record. It runs no tools. It is at https://api.commentllm.com/v1/mcp and takes a CommentLLM API key.
Does it work with Claude Code, Codex CLI and opencode?
Yes. On 27 November 2026 we ran Claude Code 2.1.332, Codex CLI 0.172.0 and opencode 1.19.6 against it in a sandbox. Each agent read the scope, asked about targets inside and outside it, and recorded a finding. The configuration file for each agent is in the guide and at commentllm.com/kit.
Which version of the Model Context Protocol does it speak?
The endpoint answers clients on revisions 2026-07-28, 2025-11-25 and 2025-06-18 over Streamable HTTP. Revision 2026-07-28 has no opening handshake, and the two older ones do. It keeps nothing between requests.
What happens if the agent ignores the answer?
The gateway checks every tool call the model asks for under an engagement key, whether or not the agent asked first. A call that names an address outside the scope is not delivered, unless the engagement is set to record only.
Does CommentLLM store my findings?
No. For each finding it stores the time, the severity and the SHA-256 digest of the text. The text is not stored. A digest does not reveal a text unless the text is short or predictable enough to guess, and anyone who holds the exact text can confirm that it matches.
Does the check tool store the addresses I ask about?
No. A target arrives in the request and leaves in the answer. Nothing about it is stored or logged.
Does the agent kit cost extra?
No. The endpoint is included with every account and its calls are free. A key can make 300 requests a minute to it, and an organization's keys together 1,500, counted apart from your organization's request limit.
Do I still need written authorization?
Yes. The kit tells an agent what an engagement authorizes. It does not replace the signed rules of engagement, and CommentLLM's acceptable use policy allows only work you are authorized to do.
