Export a policy pack to ToolHive
Last updated 15 November 2026
For platform teams that run MCP servers through Stacklok ToolHive. At the end you will have exported a policy pack as an authorization file, started a server with it, and know which tools it denies, which rules of the pack it cannot enforce, and the limits of matching tool names in Cedar.
What the export is
The ToolHive export turns one published version of a policy pack into an authorization file for ToolHive's thv run --authz-config. The file uses the format ToolHive v0.65.0 documents: version 1.0, type cedarv1 and a list of Cedar policies. It permits every request, then forbids every tool call whose tool name reads as destructive, which is what the enforcement rule SW-GW-006 of the pack asks for. ToolHive cannot ask a person to approve a call, so the export denies those tools instead of asking.
The target is new in scanner 1.15.0, the engine that builds every export. It is on the same plans as the Claude Code hooks, Kong and Zuplo MCP Gateway exports: every plan that has policy packs. Rules, policy packs and exports compares the five targets.
Download the export
- On the Policy packs page, open the pack and find the version in the Versions list. Only a published version can be exported.
- Choose Export, then ToolHive. The dialog says: An authorization file for thv run that denies destructive tools. The README in the download says how to add it.
- Choose Download the export. The download is a zip named for the pack, the version and the target, and its link works for a short time, so export again for a new one.
Owners, managers and members can export. Spellwarden keeps an export for 30 days, and an organisation can build 100 exports an hour. A script can build the same export with a write key, with the target toolhive:
curl -X POST -H "x-api-key: $SPELLWARDEN_API_KEY" -H "content-type: application/json" \
-d '{"target": "toolhive"}' \
https://dash.spellwarden.ai/api/v1/orgs/<your-organisation>/policy-packs/baseline/versions/1.0/exportsClaude can build it too, with the connector's tool export_policy_pack and the target toolhive: see Spellwarden connector for Claude.
The files
| File | What it holds |
|---|---|
toolhive/spellwarden-authz.json | The authorization file: the permit, then one forbid policy for each destructive verb while SW-GW-006 is on in the pack. |
SPELLWARDEN-README.md | What the export enforces, what it cannot enforce and why, how to install it and its limits. It ends with: Validate field names against the vendor's current documentation before use, and a link back to this guide. |
SHA256SUMS | The SHA-256 of the other two files. |
The baseline pack's authorization file begins like this; the other nine forbid policies follow the same pattern for the other verbs:
{
"version": "1.0",
"type": "cedarv1",
"cedar": {
"policies": [
"@id(\"spellwarden-allow-rest\") permit(principal, action, resource);",
"@id(\"SW-GW-006:delete\") forbid(principal, action == Action::\"call_tool\", resource) when { resource.name like \"delete*\" || resource.name like \"*_delete\" || resource.name like \"*-delete\" || resource.name like \"*_delete_*\" || resource.name like \"*_delete-*\" || resource.name like \"*-delete_*\" || resource.name like \"*-delete-*\" || resource.name like \"Delete*\" || resource.name like \"*_Delete\" || resource.name like \"*-Delete\" || resource.name like \"*_Delete_*\" || resource.name like \"*_Delete-*\" || resource.name like \"*-Delete_*\" || resource.name like \"*-Delete-*\" || resource.name like \"DELETE*\" || resource.name like \"*_DELETE\" || resource.name like \"*-DELETE\" || resource.name like \"*_DELETE_*\" || resource.name like \"*_DELETE-*\" || resource.name like \"*-DELETE_*\" || resource.name like \"*-DELETE-*\" };",
...
],
"entities_json": "[]"
}
}Each policy stays below 8 KiB, the size ToolHive accepts for an inline policy. With SW-GW-006 turned off in a pack, the file holds only the permit, and the README says that nothing is enforced.
Install it
- Check the files against SHA256SUMS.
- Start the server with the authorization file:
thv run --authz-config <absolute path of toolhive/spellwarden-authz.json> <server>. - If the server already has an authorization file, do not replace it with this one. Copy the forbid policies of this file, whose ids start with SW-GW-006, into the cedar.policies list of yours. A forbid policy wins over every permit, so they hold next to the permits you already have.
ToolHive filters the tool list by the same policies, so clients no longer see the denied tools, and a call to one of them is answered with HTTP 403. A new published version of the pack is a new export: replace the file, or the copied policies, when you publish one.
What it enforces and what it cannot
For each of the eight enforcement rules of a pack that has the rule on, the export's README says one of these:
| Rule | In this export | Why |
|---|---|---|
| SW-HK-001 | Not enforced | Enforced by the Claude Code hooks export. |
| SW-HK-002 | Not enforced | Enforced by the Claude Code hooks export. |
| SW-GW-003 | Not enforced | Needs ToolHive's authentication settings on thv run, which this export does not write. |
| SW-GW-004 | Not enforced | The authorization file decides on requests, not on tool results. |
| SW-EG-005 | Not enforced | A sandbox egress proxy is not in this version. |
| SW-GW-006 | Enforced | Denied: the gateway cannot ask a person, so a destructive tool is refused instead of asked about. |
| SW-RG-007 | Not enforced | Enforced by the private registry, not by an export. |
| SW-OB-008 | Not enforced | ToolHive's audit log is configured on thv run, not by this export. |
Organisation rules are not included: they match text, and ToolHive's authorization file decides on the name of a request, not on its text.
Which tools are denied
A tool is denied when its name starts with one of the verbs delete, drop, destroy, remove, purge, truncate, terminate, wipe, reset and force, or holds one as a word between underscores or hyphens. These are the verbs the Claude Code hooks export asks about.
| Tool name | Result | Why |
|---|---|---|
delete_row | Denied | It starts with delete. |
files-remove | Denied | It holds remove as a word after a hyphen. |
db_force_push | Denied | It holds force as a word between underscores. |
DROP_TABLE | Denied | UPPER spellings are matched. |
read_order | Allowed | No verb of the list. |
list_deleted | Allowed | deleted is not the word delete, and the name does not start with it. |
dElete_row | Allowed | A mixed-case spelling is not matched: see the limits below. |
Limits
- Cedar's like operator is case-sensitive and Cedar has no lower-case function. The export matches the lower case, Capitalised and UPPER spellings of each verb, so delete, Delete and DELETE are denied and a mixed-case spelling such as dElete_row is not.
- Only tool calls are restricted. Prompts, resources and every other request pass.
- Virtual MCP composite tools are authorised by their own name, not by the names of the tools they call.
- The format was checked against ToolHive v0.65.0. Before each engine release, Spellwarden's release workflow runs that ToolHive with the baseline pack's export in front of a test server and checks that a destructive tool is refused with HTTP 403 and hidden from the tool list while an allowed tool answers. A later ToolHive release may change the format; a later engine release checks the export against it again.