Act b3: an allow-list of tool names
In this act you point the agent at Cloudflare’s per-endpoint server and write the security engineer’s constraint as an allow-list: six tool names that read the Workers and their deployments, and every other tool of 3,053 refused. You will see the logs tool refused by name, and you will see why the plain “allowed” task is only half done.
Where we are in the story
Section titled “Where we are in the story”Act b2 kept the logs and the attendee data of the workshop progress tracker safe by refusing execute, and in doing so refused the work the team wanted done too. The developer still wants the agent to list the Workers and check the deployment of box-poc-workshop. The security engineer agrees, as long as the agent cannot read the logs or the attendee registry, and cannot deploy or delete. With one tool per operation (The per-endpoint catalog), those are separate names.
Your files at this point
packs = ["@box/base"]policies = ["no-remote-execute.dw"]
[project]access = "read"
[storage]directories = ["config", "tmp"]
[agent]command = ["${{ home }}/.local/bin/claude", { slot = "agent-args" }]
[agent.env]CLAUDE_CONFIG_DIR = "${{ storage.config }}"CLAUDE_CODE_TMPDIR = "${{ storage.tmp }}"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC = "1"DISABLE_AUTOUPDATER = "1"
[egress.anthropic]destinations = ["api.anthropic.com"]secret.ref = "env://ANTHROPIC_API_KEY"secret.header = "x-api-key"secret.phantom_prefix = "sk-ant-"
[mcp.cloudflare]type = "http"destinations = ["mcp.cloudflare.com"]secret.ref = "env://CLOUDFLARE_MCP_TOKEN"// The security engineer's first constraint on the workshop app: the agent may not read// the Worker's logs or the attendee data. Cloudflare's execute tool could do both, out of// Box's sight, so it is refused by name.@id("no_hidden_api_calls")@description("Cloudflare's execute tool runs its script on Cloudflare's side, where Box cannot see which API calls it makes. Use a tool whose calls Box can decide.")forbid (principal, action == cloudflare::Action::"execute", resource);{ "mcpServers": { "cloudflare": { "type": "http", "url": "https://mcp.cloudflare.com/mcp", "headers": { "Authorization": "Bearer ${CLOUDFLARE_MCP_TOKEN}" } } }}Act b3: an allow-list of tool names. A tool on the allow-list is permitted and reaches the Cloudflare API. The logs tool, o11y_telemetry_query, is not on the list and is refused.
Text description of the diagram
Stage 4 of 5.
Pieces in the picture:
- the macOS keychain, which holds the three secrets; the developer reads them into shell variables
- the developer's terminal
- Claude Code, the agent
- the contained filesystem view: only the paths the profile grants exist for the agent
- the box CLI and Box Core, which build the box and run its trusted process
- stand-in secrets: the agent gets placeholders, the real values stay in the trusted process
- the egress gateway, which every network request from the box goes through
- the MCP broker, which starts local MCP servers and decides their calls
- the staged tool catalog: Box types each tool from the server's tools/list before the agent may call it (new at this stage)
- the policy engine, which reads the Cedar and Dogwood policy files
- the records: every decision, written where the agent cannot reach
- the Anthropic API
- Cloudflare's MCP server (changed at this stage: it now runs in per-endpoint mode)
- the Cloudflare API
- the sample app: the Worker box-poc-workshop with its D1 database, KV namespace and Workers Logs; the logs and the database hold attendee names and email addresses
- Boundaries: the box, agent's sandbox, trusted process.
The path of act b3:
- Cloudflare's MCP server runs in per-endpoint mode: one tool per API operation.
- The gateway stages the server's tools/list as a catalog, and the policy engine gets a typed schema for each tool before the agent may call it.
- Each tool call is decided by its tool name. A tool on the allow-list is permitted and reaches the Cloudflare API.
- The logs tool is not on the allow-list. Its call is refused at the gateway and recorded.
Outcome: A tool on the allow-list is permitted and reaches the Cloudflare API. The logs tool, o11y_telemetry_query, is not on the list and is refused.
New on the path: the egress gateway stages the server’s 3,053 tools as a catalog, and the policy engine decides each tool call by its name. A listed tool reaches the Cloudflare API; the logs tool does not.
Switch the server and wait for it
Section titled “Switch the server and wait for it”What we add. A new file in the workspace, a copy of the code-mode file with one changed line: the address ends in ?codemode=false.
{ "mcpServers": { "cloudflare": { "type": "http", "url": "https://mcp.cloudflare.com/mcp?codemode=false", "headers": { "Authorization": "Bearer ${CLOUDFLARE_MCP_TOKEN}" } } }}The profile does not change for this. destinations names a host, and Box matches an MCP server by its host and ignores the path and the query.
What we add. Nothing to the files. The free check changes two Claude Code flags for Part 4.
The run.
What this doesStarts the box, lets Claude Code connect the per-endpoint server, and stops at the first model call. Nothing is billed.
ANTHROPIC_API_KEY=sk-ant-preflight-invalid-key box run ws --no-banner -- --setting-sources "" --strict-mcp-config --mcp-config cloudflare-per-endpoint.json --tools ToolSearch --allowedTools mcp__cloudflare,ToolSearch --model claude-sonnet-5-5 --max-turns 1 -p "Say hello." --output-format stream-json --verbose < /dev/null > check.jsonl--setting-sources ""--bare from here on: --bare also removes ToolSearch.--mcp-config cloudflare-per-endpoint.json--tools ToolSearchToolSearch, so Claude Code sends the tool names and loads a definition only when the model asks for it. Without tool search the first request would be about 2.2 million tokens, over the model’s limit of 1,000,000.--allowedTools mcp__cloudflare,ToolSearchToolSearch, so the headless run never stops to ask.(the rest)run ws --no-banner --, --strict-mcp-config, --model claude-sonnet-5-5, --max-turns 1, -p "Say hello.", --output-format stream-json --verbose, < /dev/null and > check.jsonl are as in the free check of act b2.What we see. The run takes far longer than any before it, and the agent gets no Cloudflare tools. The first line of check.jsonl says the server is still pending, and Claude Code has one tool, ToolSearch. In the history (box runs history <box ID>), the last rows include the tools/list request, and no Cloudflare tool call comes after it:
"name":"cloudflare","status":"pending"permit mcp:call cloudflare/tools/list mcp_cloudflare_callBox held the reply while it staged 3,053 tools; Claude Code’s start timeout (30 seconds by default) ran out first. box run returned only after staging ended: 150 seconds of wall time for an agent that gave up after about 30. The terminal also printed the per-tool warning, a per-tool rule never loaded for ["cloudflare"]. That is no_hidden_api_calls: this catalog has no tool called execute.
What we add. One line in the agent’s environment: Claude Code’s MCP start timeout, in milliseconds.
packs = ["@box/base"]policies = ["no-remote-execute.dw"]
[project]access = "read"
[storage]directories = ["config", "tmp"]
[agent]command = ["${{ home }}/.local/bin/claude", { slot = "agent-args" }]
[agent.env]CLAUDE_CONFIG_DIR = "${{ storage.config }}"CLAUDE_CODE_TMPDIR = "${{ storage.tmp }}"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC = "1"DISABLE_AUTOUPDATER = "1"MCP_TIMEOUT = "300000"
[egress.anthropic]destinations = ["api.anthropic.com"]secret.ref = "env://ANTHROPIC_API_KEY"secret.header = "x-api-key"secret.phantom_prefix = "sk-ant-"
[mcp.cloudflare]type = "http"destinations = ["mcp.cloudflare.com"]secret.ref = "env://CLOUDFLARE_MCP_TOKEN"The run. The same free check as in iteration 2.
What we see. The server connects, with 3,053 Cloudflare tools plus ToolSearch (3,054 in all):
"name":"cloudflare","status":"connected"The per-tool warning is printed again, because no_hidden_api_calls is still listed. In the measured check the hand-over (from tools/list to Claude Code’s next request) took 162.8 seconds and the run 167 seconds. Once the rule was removed (iteration 4) it took 70.4 seconds. Whether the rule that never loaded caused the extra time was not checked: one run each.
Write the allow-list
Section titled “Write the allow-list”What we add. A new policy file in place of no-remote-execute.dw, which this catalog makes pointless (there is no execute here). Change line 2 of profile.toml:
packs = ["@box/base"]policies = ["operate-tools.dw"]The old file can stay on disk; it is no longer listed. Then create $HOME/box-ws/profiles/ws/operate-tools.dw. Build it in this order:
- The comment states the constraint in the story’s words and names the tools it keeps out:
o11y_telemetry_query(the Worker’s logs),d1_query(the attendee registry), and every deploy or delete tool. - The id and the description:
operate_tools_only, and a reason the agent can act on. - The effect and scope:
forbidonBox::Action::"mcp:call", the decision every MCP request gets. Not a per-tool action: a rule onmcp:callcan be checked before the catalog is staged, so it loads when the box starts. when: the rule is about the cloudflare server, and only about tool calls (method == "tools/call"). Listing the tools (tools/list) must stay permitted, or the agent gets no tools at all.unless: the exception, “a tool call whose tool is one of these six”.context.input has toolcomes first becausetoolis optional in anmcp:call, and Box refuses to load a rule that reads an optional field without testing it..containstests whether the list holds the tool name. This page useshasandunlessonly as far as this rule needs them; Rules on a tool’s arguments, two pages on, introduces them in full.
// The security engineer's constraint, written for the one-tool-per-operation server: the agent// may run only the tools that read the Workers and their deployments. Every other tool of the// 3,053 is refused, among them o11y_telemetry_query (the Worker's logs, which hold attendee// names and emails), d1_query (the attendee registry) and every deploy or delete tool.@id("operate_tools_only")@description("Only the tools that read the Workers and their deployments may run. The Worker's logs and the attendee data hold names and emails, and the agent may not deploy or delete.")forbid (principal, action == Box::Action::"mcp:call", resource)when { context.input.server == "cloudflare" && context.input.method == "tools/call" }unless { context.input has tool && [ "workers_legacy_scripts_list", "workers_legacy_scripts_get", "workers_legacy_scripts_scriptAndVersionSettings_get", "workers_legacy_scripts_content_get", "workers_legacy_scripts_versions_list", "workers_deployments_list" ].contains(context.input.tool)};The six tools read the Worker list, one Worker, its settings, its code, its versions and its deployments. All six names are in the catalog Claude Code received (checked against the tool list in the free check’s first line), as are workers_list, workers_get, o11y_telemetry_query and d1_query.
The run. box profile show ws passes. Then the same free check as in iteration 2.
What we see. The server connects with 3,053 tools, and no warning is printed. The hand-over took 70.4 seconds and the run 73 seconds in the measured check.
"name":"cloudflare","status":"connected"Run the act
Section titled “Run the act”What this doesStarts Claude Code in the box with the per-endpoint server, asking you before any tool that is not pre-approved.
box run ws -- --setting-sources "" --strict-mcp-config --mcp-config cloudflare-per-endpoint.json --tools ToolSearch --allowedTools mcp__cloudflare,ToolSearch --model claude-sonnet-5-5 --max-turns 12 --permission-mode manual--max-turns 12ToolSearch takes a turn of its own.--permission-mode manual(the rest)--no-banner, so Box’s activity line shows under Claude Code.The minute of staging happens behind Claude Code’s prompt. Whether a task typed during that minute runs without the Cloudflare tools was not checked; wait a minute before you type. Interactive mode was not checked for this act.
What this doesRuns one task in the box and writes Claude Code's event stream to a file.
box run ws --no-banner -- --setting-sources "" --strict-mcp-config --mcp-config cloudflare-per-endpoint.json --tools ToolSearch --allowedTools mcp__cloudflare,ToolSearch --model claude-sonnet-5-5 --max-turns 12 --max-budget-usd 0.25 -p "Show me the last hour of logs for the Cloudflare Worker box-poc-workshop on account 0123456789abcdef0123456789abcdef." --output-format stream-json --verbose < /dev/null > act-b3-logs.jsonl--max-budget-usd 0.25-p "..."act-b3-logs.jsonl, act-b3-allowed.jsonl and act-b3-steer.jsonl.(the rest)--max-turns 12.Show me the last hour of logs for the Cloudflare Worker box-poc-workshop on account 0123456789abcdef0123456789abcdef.
List the Workers on Cloudflare account 0123456789abcdef0123456789abcdef and summarise the current deployment of the Worker box-poc-workshop.
Using only the workers_deployments_list tool of the cloudflare MCP server, list the deployments of the Worker box-poc-workshop on account 0123456789abcdef0123456789abcdef.
What you see
Section titled “What you see”The decisions below were measured on an earlier local build (pkg), with the kit’s version of this rule: the same six tools under the id logstools_vendor_allowlist. With your file the RULE column reads operate_tools_only (inferred from the rule’s id: your file was run as a paid run on pkg-fix, but the decisions of those runs were not recorded in the notes). Time column, net:connect rows and the gateway’s http:request rows are left out.
The logs task: refused by name
Section titled “The logs task: refused by name”permit mcp:call cloudflare/tools/list mcp_cloudflare_callpermit mcp:call cloudflare/resources/list mcp_cloudflare_calldeny mcp:call cloudflare/o11y_telemetry_query logstools_vendor_allowlistThe model loaded o11y_telemetry_query with ToolSearch, called it, and got the refusal. The shape of the refusal text was measured with the kit’s rule.
mcp:call gate (server "cloudflare" method "tools/call"): policy denied this operation on 'cloudflare/o11y_telemetry_query' [policy: operate_tools_only]: Only the tools that read the Workers and their deployments may run. The Worker's logs and the attendee data hold names and emails, and the agent may not deploy or delete.The answer said it could not get the logs, that this was a policy block and not a missing permission, and that it did not try other tools. It then listed ways to get the logs outside the box (npx wrangler tail, the Cloudflare dashboard), and suggested adding o11y_telemetry_query to the policy.
The allowed task: half done
Section titled “The allowed task: half done”deny mcp:call cloudflare/workers_list logstools_vendor_allowlistpermit mcp:call cloudflare/workers_deployments_list mcp_cloudflare_callThe model loaded three tools with ToolSearch: workers_list, workers_deployments_list and workers_get. It called workers_list for the Worker list, which is refused, and workers_deployments_list, which runs. The answer: the Worker list was blocked, and here is the current deployment of box-poc-workshop (one version at 100 percent, created 2026-11-14 14:17 UTC, four deployments in all). It said it had not tried another tool to get around the block, “such as the legacy scripts listing”.
This is the honest result of a tool-name allow-list. Cloudflare’s API has two operations that list Workers: the older one, behind workers_legacy_scripts_list, which is on the list, and a newer one, behind workers_list, which is not. The model picked the newer one. An allow-list of names must name every tool a model might pick for the same job. The security engineer chose six tools from the operations the team agreed on; the model chose a seventh.
The steering sentence: done
Section titled “The steering sentence: done”permit mcp:call cloudflare/workers_deployments_list mcp_cloudflare_callTold which tool to use, the model loaded only workers_deployments_list and called it once. The call was permitted and the answer listed the four deployments of box-poc-workshop, newest first. The steering sentence is the one the kit’s runbook gives; whether the measured run typed exactly this sentence is not recorded.
The two seats
Section titled “The two seats”The policy now sees which operation the agent asks for, and refuses the logs by name before the request reaches Cloudflare. A new tool in the catalog is refused until someone lists it. But the allow-list is only as good as its names: the model reached for workers_list, which the security engineer did not think of. And an allowed tool’s answer is not checked: the deployments list returned the deployer’s email address in its metadata.
The deployment question is answered and the logs are refused, but the Worker list is not, unless the developer steers the model to a listed tool or asks the security engineer to widen the list. Every run waits about a minute for the catalog and costs about $0.22 to $0.24, against $0.01 to $0.07 for act b2’s runs in code mode.
The takeaway: with one tool per operation the policy can allow reads and refuse the logs by name, but a list of names refuses whatever tool the model picks that nobody listed.
- Turns
- 3
- Tokens
- 248,292 in, 1,426 out
- Cost
- $0.2357
- Wall time
- 82 s
- Box build
- pkg
- Turns
- 4
- Tokens
- 241,478 in, 1,076 out
- Cost
- $0.2278
- Wall time
- 80 s
- Box build
- pkg
- Turns
- 3
- Tokens
- 239,979 in, 787 out
- Cost
- $0.2188
- Wall time
- 78 s
- Box build
- pkg
One run each, headless, on the earlier local build pkg with the kit’s six-tool rule; On the workshop’s build (pkg-fix), only the steering sentence was run as a paid run, twice, with your file as this page builds it: 3 turns and USD 0.2218 and 0.2217 as Claude Code reported them; tokens and wall time were not recorded. The logs and allowed tasks were not run as paid runs on pkg-fix. About 60 seconds of each wall time is the staging wait. See Builds and gaps for the builds.
Clean up
Section titled “Clean up”What this doesDeletes this act's stream files and the free check's stream. A stream holds whatever the agent read; in the measured steering run that included the deployer's email address.
rm -f act-b3-logs.jsonl act-b3-allowed.jsonl act-b3-steer.jsonl check.jsonl-f(the files)Claude Code also kept a transcript of each of these runs in Box storage, with the same content as the stream files. Storage is kept between runs, so deleting the streams leaves them there. Act b1 explains the folder, and why box profile reset would remove more than the transcripts.
What this doesLists the transcripts kept in the profile's storage. It changes nothing.
ls -R "$BOX_HOME/storage/ws/default/agent/config/projects"-RWhat this doesDeletes every transcript kept in the profile's storage. Run it after the run has ended.
rm -r "$BOX_HOME/storage/ws/default/agent/config/projects"-rWhat to remember
Section titled “What to remember”?codemode=falsein the MCP config file switches the server; the profile does not change.- Raise
MCP_TIMEOUTin[agent.env], or Claude Code starts before Box has staged the catalog and has no tools. - An allow-list is
forbidonmcp:callwithwhen(this server, tool calls) andunless(has tooland the list.containsit). It loads at start. - A list of tool names must hold every tool a model may pick for the job. Read the refusals: they tell you which names are missing.
The security engineer also wants to say which account a listed tool may be used on. Rules on a tool’s arguments shows how.
Read moreWrite policy for an MCP server: allow-lists, mcp:call fieldsBox docs
Read moreAction reference: mcp:callBox docs
Read moreMCP_TIMEOUT and other environment variablesClaude Code docs
Read moreCLI reference: --setting-sources, --tools, --allowedToolsClaude Code docs
Read moreOperators: has, containsCedar docs