` | run a command with a broker in front of it ([From an agent](/use/from-an-agent/)) |
| `stk mcp [--profile ]` | MCP on stdio, the four meta-tools. `-p` is `--profile` |
| `stk mcp install claude-code\|cursor` | print the client configuration; no secret in it |
| `stk mcp serve [--profile ] [--socket ] [--standalone]` | serve one fronted server’s own tools ([Fronted servers](/use/mcp-serve/)) |
| `stk approvals` | what is waiting on you ([Approvals](/use/approvals/)). `stk approval` is the same command |
| `stk approvals allow ` | approve and perform it; `stk approvals approve ` too |
| `stk approvals refuse ` | refuse it; `stk approvals deny ` too |
| `stk audit [--limit ] [--json]` | what the broker did, newest first ([Audit](/use/audit/)). `-n` is `--limit` |
| `stk ui [--bind ] [--no-open]` | the web interface on a one-time link ([Web interface](/reference/web-ui/)) |
| `stk publish submit\|perform \|recover` | SuperPipeline-gated publishing to X; exit 3 means the gate awaits a person ([Gated publishing](/use/publish/)) |
## Run the broker for agents
[Section titled “Run the broker for agents”](#run-the-broker-for-agents)
Use the daemon commands when several long-running clients should share one broker and one live policy.
| Command | |
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `stk serve` | the broker daemon, with `--proxy-listen`, `--allow-uid`, `--operator-uid`, `--socket-mode`, `--local-commands-socket`, `--local-commands-mode` ([Run as a service](/run/serve/)) |
| `stk install --user ` | run stk as its own OS user under systemd (Linux), with `--group`, `--state-dir`, `--runtime-dir`, `--config`, `--agent-uid`, `--operator-uid`, `--proxy-port`, `--unit-name`, `--dry-run` |
| `stk reload [--json]` | re-read `supertoolkit.yaml` into the running `stk serve` (or send it `SIGHUP`) |
| `stk env [--json]` | print the proxy URL, CA and placeholders for the fixed proxy |
## Check it
[Section titled “Check it”](#check-it)
These checks tell you what is configured and whether a client really uses the brokered path.
| Command | |
| ------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `stk doctor` | check the setup, and prove no credential is reachable by a child |
| `stk doctor --probe [--json] [--with-proxy-key]` | prove each client here actually goes through the broker; exit 1 on a bypass, or when no client was exercised. `--with-proxy-key` probes through a broker that requires a proxy key |
| `stk doctor --json [--agent-uid ]...` | the checks and the isolation verdict as JSON, for the agent uids in `agent_uids:` and any `--agent-uid` |
`stk doctor` reports an isolation level for the agent uids it is told about — the top-level `agent_uids:` list in the policy file, plus any `--agent-uid`: `separate-user` when every checked path passed for every agent uid, `same-user` with the reasons when one did not, and `unknown` when no agent uid is configured. The level never changes doctor’s exit status.
## Internal entry points
[Section titled “Internal entry points”](#internal-entry-points)
These are called by a supervising controller, not by people, and older binaries reject them:
| Command | |
| ---------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| `stk managed-mcp-v1 --manifest --sha256 ` | the four meta-tools under a private, pinned manifest, every effect verified with the controller first |
| `stk managed-evidence-v1 --manifest --sha256 ` | one invocation’s saved receipt metadata, read-only, for an `inspect` control on stdin |
| `stk managed-control-v1 --manifest --sha256 ` | one recovery control (inspect, fence, cancel, revoke, acknowledge), read from stdin |
The protocol, the manifest shapes and what the controller must check are in the repository’s [`docs/managed-mcp.md`](https://github.com/SuperJackfruitLabs/supertoolkit/blob/main/docs/managed-mcp.md).
For ordinary operation, stop above this section. These names are stable protocol entry points for a supervising controller, not shortcuts around the public commands.
# The web interface
> stk ui serves five screens on its own loopback listener behind a one-time link, and the eight API routes behind them.
When you want to inspect the broker without translating ledger rows in your head, start its local interface:
```sh
stk ui # http://127.0.0.1:7420, opened in your browser
stk ui --no-open # print the link only
stk ui --bind 10.0.0.5:7420 # an address on a private network, if you mean it
```
`stk ui` serves the status, services, policy, approvals and audit screens to the person who runs it. Three rules hold it in place:
* **Its own listener.** The control socket agents reach gains no HTTP route, and the UI is started on demand, so a broker’s attack surface is unchanged by the command existing.
* **Loopback unless you say otherwise.** It binds `127.0.0.1:7420` by default, and naming an address with `--bind` (`-b`) is what says you mean it.
* **A one-time link.** The URL carries a random token once; the browser keeps it as a cookie (`HttpOnly`, `SameSite=Strict`) and is redirected so the token leaves the address bar and the history. Without it every route answers `401`.
After the redirect, your browser has the cookie and the token is gone from the visible URL. Other callers still receive `401`.
It is just another caller: it may show that a credential is present, its fields and the operation that uses it, never its value. A decision made here performs the effect in this process, and is recorded as `name (uid N) via stk ui`. While the policy names a SuperPipeline approvals board, it refuses every local decision, as `stk approvals` does.
## The API
[Section titled “The API”](#the-api)
If you need the exact request surface behind those screens, it is small enough to list in full:
The screens read the same JSON the browser fetches. Every route needs the cookie; none returns a credential, and a test holds every route to that.
| Route | |
| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GET /api/status` | the workspace, how many services and fronted servers, the profiles, how many approvals are pending, and `stk doctor`’s checks |
| `GET /api/services` | each service and fronted server: host, operation, what goes on the wire, whether it is connected, and its field names |
| `GET /api/policy` | each capability’s policy, summary and ceiling (`agent` for a read, `approval` otherwise) |
| `GET /api/approvals` | the approvals queue, each effect with its arguments, expiry, state and decider |
| `GET /api/audit` | the newest 200 records of the ledger |
| `POST /api/policy` | `{"category", "action", "policy"}`: set one capability’s policy in `supertoolkit.yaml`. A write cannot be made agent-callable here: approval is its ceiling |
| `POST /api/approvals/decide` | `{"id", "allow"}`: decide an approval, and perform it if allowed |
| `POST /api/services/revoke` | `{"service"}`: remove the local copy of a credential. To withdraw it at the provider too, use `stk revoke` |
A binary built without the web assets serves the API alone and says so on `/`; build the assets with `pnpm -C web build`.
So the UI never becomes a second authority: it reads and decides through the same local state, and every route stays behind the same one-time session.
# Run as a service
> stk serve, the control socket and who may decide, stk install under systemd, the fixed proxy and stk env, and stk reload.
`stk run` starts a broker for one command and stops it afterwards. When your agents run all the time, we can give them one daemon instead. Run the broker as a different OS user from the agent, and the agent cannot read the sealed store, its key, or the approvals. It still reaches the broker over a control socket and a loopback proxy.
## `stk serve`
[Section titled “stk serve”](#stk-serve)
```sh
stk serve
stk serve --proxy-listen 127.0.0.1:8899 --allow-uid 1001 --socket-mode 0660
```
`stk serve` runs the broker and listens on the control socket, `stk.sock` in the state directory (or `STK_SOCKET`). `stk mcp`, `stk mcp serve`, `stk approvals` and `stk reload` talk to it when it answers.
Once `serve` is listening, those commands share one live policy, queue, and ledger instead of starting a private broker apiece.
| Flag | |
| ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `--proxy-listen ` | also keep the egress proxy at this fixed loopback address, key required (below) |
| `--allow-uid ` | a uid allowed to call the socket. Repeatable. Without one, the socket’s file mode is the only gate |
| `--operator-uid ` | a uid allowed to decide approvals. Repeatable. Default: root and the daemon’s own uid |
| `--socket-mode 0600\|0660` | the control socket’s file mode; `0660` lets the agent’s group reach it at all, while `--allow-uid` stays the authorisation |
| `--local-commands-socket ` | also serve the proxy on this Unix socket, pinned to the `local-commands` identity ([details](/use/mcp-serve/#the-local-commands-socket)) |
| `--local-commands-mode 0600\|0660` | that socket’s file mode |
Each flag also takes `--flag=value`.
### Who may call, and who may decide
[Section titled “Who may call, and who may decide”](#who-may-call-and-who-may-decide)
The daemon reads each caller’s uid from the kernel. With `--allow-uid`, a uid that is neither an allowed uid nor an operator is refused before any method runs.
| Control-socket method | Who |
| -------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| `approvals.decide` | operator uids only |
| `approvals.list`, `status`, and the four MCP tools | agent and operator uids |
| `reload` | agent and operator uids: it applies the policy file the operator wrote and cannot change it |
| `mcp.spec`, `mcp.decide`, `mcp.visible`, `mcp.done`, `mcp.violation` | agent and operator uids: the [`stk mcp serve`](/use/mcp-serve/) gate, which evaluates policy and records the outcome but never changes policy |
**Only an operator decides.** The socket refuses `approvals.decide` to any uid that is not an operator. Operator uids are `--operator-uid` (repeatable), or by default root and the uid the daemon runs as, leaving out either if it is also an agent uid. A uid named as both an agent and an operator is refused at startup. The decision records the deciding uid’s own account (`name (uid N)`, from the kernel), never a name the caller sends.
Without `--allow-uid`, `stk serve` warns at every start: any process running as the daemon’s uid, an agent included, is then an operator and can decide its own approvals. The gate is only as real as the uid split under it.
That warning is the checkpoint: before you call the service isolated, confirm the agent uid and operator uid do not collapse back into the same account.
## `stk install`: its own OS user, under systemd
[Section titled “stk install: its own OS user, under systemd”](#stk-install-its-own-os-user-under-systemd)
```sh
sudo stk install --user stk --group stk --agent-uid 1001 [--agent-uid 1002] [--operator-uid 1000] [--unit-name stk]
```
Linux with systemd only; on any other OS it refuses. It must run as root and needs at least one `--agent-uid`. `--dry-run` prints the plan and the unit and changes nothing. It creates, if absent:
* a system user (no home, `nologin`) and, with `--group`, that group;
* the state directory (`--state-dir`, default `/var/lib/stk`, `0700`), the runtime directory (`--runtime-dir`, default `/run/stk`, `0700`, or `0750` with `--group`) and the directory of the policy file (`--config`, default `/etc/stk/supertoolkit.yaml`; the directory `0750 root:`);
* `stk-passphrase.key` in the state directory (`0400`, random, never printed), which the unit hands to the service with systemd `LoadCredential`, so the passphrase is not in an environment file;
* `/etc/systemd/system/.service` (default `stk`), running `stk serve --proxy-listen 127.0.0.1: --socket-mode … --allow-uid …` with `--proxy-port` (default 8899). Each `--agent-uid` becomes an `--allow-uid`, and each `--operator-uid` is passed on.
If a policy file already exists its mode is set to `0640 root:`; install never creates policy. A second run changes nothing. It refuses to run when the state directory holds a store but no `stk-passphrase.key`, rather than add a new passphrase over a store sealed under another key. It does not add agent users to the group: with `--group`, run `usermod -aG ` yourself. Then `systemctl enable --now `; the report prints the exact command.
After that command, systemd owns the broker lifecycle and the generated service has the uid split, state paths, and proxy port from the plan you reviewed.
On a station installed this way, decide with `sudo stk approvals allow ` (root) or `sudo -u stk stk approvals allow ` (the service user), unless `--operator-uid` named someone else.
### Several instances on one host
[Section titled “Several instances on one host”](#several-instances-on-one-host)
To keep one station’s agent from ever using another station’s brokered credential, run one stk per station, each with its own user and group, `--state-dir`, `--runtime-dir`, `--config`, `--proxy-port`, `--agent-uid` and `--unit-name`:
```sh
sudo stk install --user stk-st2 --group stk-st2 --state-dir /var/lib/stk-st2 \
--runtime-dir /run/stk-st2 --config /etc/stk-st2/supertoolkit.yaml \
--proxy-port 8900 --agent-uid 2001 --unit-name stk-st2
```
`--unit-name` takes letters, digits, `_ . -`, at most 64, with no `.service` suffix and no `@`. Install refuses to overwrite an existing unit of that name unless its `User=` and state directory are the plan’s own. It does not check that ports or directories are unique across instances: choose them distinct. Run `stk doctor` and `stk env` with that instance’s `STK_HOME`, `STK_CONFIG` and `STK_SOCKET` (as in its unit) to see that instance only.
## The fixed proxy and `stk env`
[Section titled “The fixed proxy and stk env”](#the-fixed-proxy-and-stk-env)
`stk serve --proxy-listen ` (loopback addresses only) publishes the proxy at a fixed address. It creates `proxy.key` in the state directory (`0600`), and the broker then answers `407` to any `CONNECT` that does not carry it, before opening any tunnel. Without `--proxy-listen`, `serve` keeps a random loopback port and no key.
```sh
stk env # shell assignments
stk env --json
```
`stk env` prints what a client needs to use that proxy: the proxy URL with the key as URL userinfo (`HTTPS_PROXY`, `HTTP_PROXY`), the CA path (`SSL_CERT_FILE`, `CURL_CA_BUNDLE`, `REQUESTS_CA_BUNDLE`, `NODE_EXTRA_CA_CERTS`), a placeholder for each configured service, `NODE_USE_ENV_PROXY=1` and `STK_BROKERED=1`. Run it as a user that can read the state directory.
Evaluating those assignments gives the client a live authenticated proxy, the broker CA, and placeholders for configured services. It still does not receive a service credential.
The proxy key is not a service credential. It gates *use of the broker* and nothing else: holding it lets a client use the routes policy already allows, and unlocks no secret. Before printing it, `stk env` checks that the listener recorded in `proxy.addr` is a live stk proxy, so a stale address left by a crashed `serve` does not get the key.
`stk run` is unchanged: its per-session loopback proxy is not authenticated (see [Limitations](/limitations/)).
## `stk reload` and `SIGHUP`
[Section titled “stk reload and SIGHUP”](#stk-reload-and-sighup)
```sh
stk reload
stk reload --json
kill -HUP
```
Both re-read the policy file in the running service. A file that does not load keeps the old policy and reports why. A service removed from the file stops being brokered, and its stored credential is kept (`stk revoke` removes a credential). Policy is read per request, so a tunnel opened before a reload enforces the new rules on its next request.
A successful reload applies the new policy without restarting the broker. A failed one leaves the last known-good policy serving requests and tells you why the replacement was rejected.
## Where stk keeps things
[Section titled “Where stk keeps things”](#where-stk-keeps-things)
| Variable | |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `STK_HOME` | the state directory: the CA, the sealed store, the ledger, the approvals queue, the socket. Default: the user configuration directory’s `supertoolkit` |
| `STK_CONFIG` | the policy file. Default: `supertoolkit.yaml` in the working directory |
| `STK_SOCKET` | the control socket. Default: `stk.sock` in the state directory |
| `STK_PASSPHRASE` | the store’s passphrase, from your init system. Preferred over a keychain or a file beside the ciphertext |
| `STK_PASSPHRASE_FILE` | a file holding the passphrase. A file that is named but unreadable is an error, never a fall back to another key |
| `CREDENTIALS_DIRECTORY` | systemd’s; when set and `STK_PASSPHRASE_FILE` is not, the passphrase is read from `stk-passphrase` in it (what `stk install`’s unit uses) |
None of the three passphrase variables is passed on to a child that stk starts.
# Security model
> What SuperToolkit protects against, what it does not, and where the credential actually is.
## The invariant
[Section titled “The invariant”](#the-invariant)
We can draw the whole security model from one line:
> The agent never holds, reads, or receives a credential.
There is no endpoint that returns one — not for an agent, not for the CLI, not for the web interface. A change that adds one is wrong regardless of how convenient it would be.
## Where a credential lives
[Section titled “Where a credential lives”](#where-a-credential-lives)
The useful question is not whether a credential exists; it is where it can exist at each point in the request:
| | |
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **At rest** | AES-256-GCM, in an owner-only file in an owner-only directory. The key is derived with Argon2id from a passphrase held in the OS keychain where one exists. Ciphertext is padded, so the file’s size does not report the credential’s length. |
| **In memory** | Only in the broker, only while a request is in flight or a short-lived token is cached. |
| **On the wire** | Whatever the scheme requires — and for four of the six operations, never the long-lived secret. |
| **In the agent** | A placeholder, which means nothing off the host. |
The short-lived access token is cached on disk too, sealed with the same key and bound to its own purpose, so one cannot be substituted for the credential that minted it. It is there so that concurrent processes do not each exchange a refresh token — which, against a provider that rotates, they would lose.
## What it protects against
[Section titled “What it protects against”](#what-it-protects-against)
When the boundary holds, these are the failures we keep off the agent’s side:
* A credential reaching an agent’s context, a transcript, or a log.
* An agent causing an irreversible effect on its own say-so.
* Not knowing afterwards what was done.
* A plaintext key in an MCP configuration file that any process can read.
## What it does not protect against
[Section titled “What it does not protect against”](#what-it-does-not-protect-against)
The boundary is deliberately narrower than “nothing bad can happen.” Keep these cases in view when you decide what to broker:
* **A client that ignores proxy configuration.** It goes around the broker and fails silently. Detect it from outside with `stk doctor --probe`, and do not broker a client it reports as `bypassed`.
* **An agent with a shell, running as the broker’s user or an operator uid.** It could run `stk approvals allow` itself, or read the store. Run the broker as its own OS user (`stk install`), with the agent as an agent uid: the socket then refuses `approvals.decide` to it, and it cannot read the state directory. Do not give the agent a shell as the broker’s user.
* **A host you chose to intercept behaving badly.** Interception’s blast radius is exactly your configured service list; everything else is tunnelled unopened.
* **Reading the CA private key.** Anyone who can is able to impersonate the hosts this broker intercepts, which is the same reach as reading the credential store. Both are owner-only in an owner-only directory.
* **A platform with no keychain.** On Linux the store key is usually a file beside the ciphertext, which `stk doctor` reports as a warning. See [Limitations](/limitations/#the-store-key-is-only-as-good-as-the-platform).
## Failing closed
[Section titled “Failing closed”](#failing-closed)
When SuperToolkit cannot prove the safe path, it chooses the result that does not send the effect:
If the broker is unreachable, a client fails. It does not fall back to a direct connection — a silent fall back is the worst outcome available, because it looks like success while the credential is a worthless placeholder.
* A capability nobody has classified is treated as a write.
* A missing or misspelled policy resolves to `approval`, not `agent`.
* An unknown profile is an error rather than the default set.
* Expiry is never approval.
* A request that cannot be built is refused before anyone is asked to approve it.
## Reporting something
[Section titled “Reporting something”](#reporting-something)
Report a suspected vulnerability **privately**: open the repository’s **Security** tab and choose **Report a vulnerability**. That creates an advisory only the maintainers can see. Please do not open a public issue for one.
[SECURITY.md](https://github.com/SuperJackfruitLabs/supertoolkit/blob/main/SECURITY.md) sets out what is in scope, and which behaviours are already documented limitations rather than flaws.
For anything that is not a vulnerability, [issues](https://github.com/SuperJackfruitLabs/supertoolkit/issues) are the right place.
That split gets a suspected vulnerability into a private advisory while keeping ordinary product questions in the public issue tracker.
# Approvals
> What happens when an agent proposes an effect you have to decide.
Here is the promise we need an approval gate to keep: an effect at `approval` is submitted, returns `pending` with an id, and **performs nothing** until somebody decides. With nothing to decide through, the effect simply does not happen. The queue fails closed.
## Deciding
[Section titled “Deciding”](#deciding)
```sh
stk approvals # what is waiting on you
stk approvals allow # or: stk approvals approve
stk approvals refuse # or: stk approvals deny
```
`stk approval` is the same command. With a daemon running as its own user, only an **operator uid** may decide: root and the daemon’s user by default, or the uids named with `--operator-uid`. See [who may decide](/run/serve/#who-may-call-and-who-may-decide).
Or in the web interface, which shows the same queue:
```sh
stk ui
```
Either path brings you to the same pending effect. After you decide it, every other view sees the same answer; there is no second queue waiting in the wings.
The queue is shared by every process on the machine, so an approval raised by an agent through `stk mcp` can be decided from the CLI or the browser. Decide-once is enforced by the filesystem: if two people answer at the same moment in two windows, one wins and the other is told who got there first.
## Approving performs the effect
[Section titled “Approving performs the effect”](#approving-performs-the-effect)
Whoever decides carries it out, and the record keeps what actually happened:
```json
{"state":"approved","decided_by":"web","performs":true}
{"outcome":"201 Created","error":""}
```
This matters more than it sounds. An approval that only records a decision — with nothing anywhere performing it — puts a false statement in the audit trail: somebody reading `approved` would reasonably believe the thing had happened.
Exactly one party performs an approved effect, and the record says which, so a waiting agent reports the outcome rather than running it a second time.
“Approved, and it failed” is a true record and is kept as one. The outcome carries the provider’s status or the reason it did not work.
So approval buys an attempted effect, not a flattering label. You can see both the decision and what the provider actually did with it.
## What the screen shows
[Section titled “What the screen shows”](#what-the-screen-shows)
> Each shows the exact request that would be sent, not a summary. Approving a description is not approving the act.
The arguments are shown in full, because approving something you cannot inspect is the thing this is meant to prevent. A request that cannot be built is refused before anyone is asked, so a decision is never spent on something that could not have taken effect.
## Expiry is never approval
[Section titled “Expiry is never approval”](#expiry-is-never-approval)
An approval expires after thirty minutes by default. An expired effect cannot be approved afterwards — somebody returning to a stale browser tab and clicking allow must not cause the effect.
## Every approval binds the exact request
[Section titled “Every approval binds the exact request”](#every-approval-binds-the-exact-request)
At submit, stk computes a digest over the exact request the effect would send — service, capability, profile, method, URL, body and every argument — and stores it on the effect. Whoever performs an approved effect rebuilds the request and recomputes the digest first. A mismatch, from an edited queue record or a policy or catalogue change that moved the target, is refused: nothing is sent, and the outcome records both digests.
## Approvals hosted on SuperPipeline
[Section titled “Approvals hosted on SuperPipeline”](#approvals-hosted-on-superpipeline)
By default an approval waits locally. Name a SuperPipeline board and every approval is hosted there instead, for a workspace owner or admin to decide, on the board or in chat:
```yaml
services:
superpipeline-approvals-write: {} # approval-requests:write: creates the request
superpipeline-approvals-read: {} # approval-requests:read: reads the decision back
superpipeline:
approvals_board: brd_…
```
The policy does not load with `approvals_board` set unless both services are declared. Connect each with an Organization-plane service credential that has that one scope (`stk connect superpipeline-approvals-write`, then `-read`, the credential on stdin), then `stk reload`.
After reload, new approval effects appear on that board instead of the local queue. The agent still receives only a pending id; the credentials used to host the decision remain native to stk.
With a board named, an effect at `approval`:
1. is submitted as hosted, and the agent is answered `pending` with `decided_on: superpipeline` and the approval request’s id;
2. becomes an approval request on the board, with the request digest, the effect’s 30-minute expiry, and a preview of the exact request (target, station, requester, profile and every argument). A preview that had to be cut is marked incomplete, so a client withholds approval until the person opens the full request;
3. is read back every few seconds by `stk serve` (and by `stk mcp` for its own session). On `approved`, stk checks again before acting: the answer is for the request it created, the option is allow-once, the subject and digest are the effect’s, it has not expired, and a decider is named. Then exactly one watcher performs it and records SuperPipeline’s decider. On `denied` it is refused; on `expired` it expires undecided.
**Nobody decides a hosted approval locally**, operators included: while the policy names a board, `stk approvals` and `stk ui` refuse every local decision. **Failure is closed**: if SuperPipeline cannot be reached, the effect waits, is retried, and then expires. It never falls back to a local decision.
That leaves one source of authority for the effect. A network failure can delay or expire it, but cannot quietly move the decision somewhere easier.
## The limit worth knowing
[Section titled “The limit worth knowing”](#the-limit-worth-knowing)
The gate protects against an agent confined to the tool surface it is given, and against an agent with a shell **when the agent runs as its own uid** and the broker as another: the daemon’s socket refuses `approvals.decide` to agent uids (see [Run as a service](/run/serve/)). It does **not** protect against an agent that runs as the broker’s own user, or as an operator uid: that agent could run `stk approvals allow` itself, write a decision file, or run `stk ui`. A standalone `stk mcp`, which runs as the agent’s uid, is the same case. If that matters, install the broker with `stk install` and do not give the agent a shell as the broker’s user.
# The audit ledger
> What was done, under which policy, and what the provider said.
When you ask what an agent actually did, the ledger should answer without making you reconstruct the day from provider dashboards. Start with the newest effects:
```sh
stk audit # the most recent effects
stk audit --limit 200
stk audit --json
```
```plaintext
Oct 15 02:20:28 github create_issue approval 201 Created
POST /repos/you/your-repo/issues · credential: sha256:40a7a1d2319d
Oct 15 02:20:15 github get_user agent 200 OK
GET /user · credential: sha256:40a7a1d2319d
```
Each line records the service, the capability **by the name you set policy on**, the policy that applied, and what the provider answered.
You can now connect an effect to the policy that allowed it and the provider response that followed, while the credential remains a fingerprint.
## No credential is ever recorded
[Section titled “No credential is ever recorded”](#no-credential-is-ever-recorded)
What is kept about the credential is a fingerprint, or the name of the operation that replaced it — never the value. A signed request carries no token at all, so naming the operation is the honest answer there. There is a test for every scheme.
## Where it lives
[Section titled “Where it lives”](#where-it-lives)
We keep one ledger for every local entry point, so the CLI and browser cannot develop competing memories of the same request.
An append-only file in the state directory, owner-only. Every process writes the same one — a broker, the daemon, an MCP server — so `stk audit` and the web interface cannot disagree about what happened.
It rotates at 8 MB keeping one generation, because an unbounded audit log on a small server is an outage. If you need more history, ship the file somewhere before it rotates.
A line that cannot be parsed is skipped rather than fatal. A process killed mid-write leaves one incomplete record, and a ledger that refuses to open because of its last line has lost everything before it.
## Hosts outside policy
[Section titled “Hosts outside policy”](#hosts-outside-policy)
For an unconfigured host, we record only what the broker was actually in a position to know. The distinction matters when you read the row later:
A connection to a host you have not configured is recorded too, but only as far as the broker can see it:
* **With no `egress:`**, it is tunnelled unopened and recorded as `tunnelled, not decided`, with the host. The broker never sees inside it, which is what keeps interception’s blast radius equal to your service list.
* **With an [`egress:`](/use/mcp-serve/#egress-decided-by-address) policy**, it is decided by address, and recorded allowed or refused with the rule that decided it and the address dialled.
* **With `methods:` in that egress**, the tunnel is opened with the broker’s CA, so each request’s method and path are checked and recorded as well.
## What is not recorded
[Section titled “What is not recorded”](#what-is-not-recorded)
The credential, ever. And, for a host outside policy whose egress has no `methods:`, what went through the tunnel: its method, path and body are not seen, only the host and the address.
That is the ledger’s boundary: enough to explain the decision, never a secret, and no invented detail from inside a tunnel the broker did not open.
# From an agent
> Four MCP tools instead of a thousand, and running a child under the broker.
## As an MCP server
[Section titled “As an MCP server”](#as-an-mcp-server)
We can give an agent the whole brokered catalogue without dropping the whole catalogue into its context. Generate the small discovery configuration for your client:
```sh
stk mcp install claude-code # prints the configuration; no secret in it
stk mcp install cursor
```
`stk mcp` speaks MCP on stdio and exposes exactly **four** tools:
| Tool | For |
| ---------------------------- | -------------------------------------------------------- |
| `discover_server_categories` | what is available at all |
| `get_category_actions` | what one service can do, and whether each needs approval |
| `get_action_details` | the parameters of one action |
| `execute_action` | do it |
A hundred services cost four tool definitions of context instead of a thousand. The agent discovers what it needs when it needs it, and the enforcement point is the same one the CLI uses.
These commands print configuration; they do not edit your client. Put the printed `mcpServers` entry in the path the command names, then reload the client. It now sees four stable tools and can discover service-specific actions only when it needs them. Context stays small; policy does not move.
An effect at `approval` returns:
```json
{ "state": "pending", "id": "7637942b8594",
"note": "a human must approve this before it happens; nothing has been done yet" }
```
The agent should report that and stop — not retry, not work around it. Tell the person what is waiting and its id.
## Running any client under the broker
[Section titled “Running any client under the broker”](#running-any-client-under-the-broker)
When an agent already has the client it needs, put the broker around the whole process:
```sh
stk run -- your-agent
```
The child is started with `HTTPS_PROXY` pointing at the broker, the CA in the four variables that cover curl, Python, Node and Go, and a placeholder in place of each credential. `NO_PROXY` is deliberately cleared, because it is a confirmed bypass.
The child now has proxy and trust settings plus worthless placeholders, not credentials. It can make the same HTTP calls while the broker owns the secret part.
Anything that speaks HTTP works unmodified. Before trusting a new client, prove it actually goes through the broker:
```sh
stk doctor --probe
```
An `honoured` result is the proof you came for: that client reached the test provider through the broker rather than wandering around it.
## Fronting an MCP server you did not write
[Section titled “Fronting an MCP server you did not write”](#fronting-an-mcp-server-you-did-not-write)
A third-party MCP server can be started as a child with **no credential in its environment** — a placeholder instead — and the substitution happens on egress:
```yaml
servers:
slack:
command: npx
args: ['-y', '@modelcontextprotocol/server-slack']
host: slack.com
env_var: SLACK_BOT_TOKEN
```
Its tools appear as one category among the four meta-tools, under the same policy as everything else. `env:` gives it non-secret variables; the placeholder goes in `env_var:`, and `host:` is where the broker substitutes the credential on its way out.
With the server declared, its tools join the same four-tool discovery surface and inherit the same policy decisions as native actions. No separate secret distribution scheme has appeared while we were not looking.
To serve the server’s own tools under their own names instead, each call still decided and audited, use [`stk mcp serve`](/use/mcp-serve/).
# Fronted servers and egress
> stk mcp serve serves one fronted MCP server's own tools, each call decided and audited; egress decides hosts outside policy by address; the local-commands socket.
[From an agent](/use/from-an-agent/) covers `stk mcp`, where a fronted server’s tools appear as one category behind the four meta-tools. This page covers serving a fronted server **under its own tool names**, deciding where its traffic may go, and the proxy socket for sandboxed local commands.
We will keep the server’s familiar tool names while moving the decisions and receipts into SuperToolkit. Then we will narrow the network it can reach.
## `stk mcp serve`
[Section titled “stk mcp serve”](#stk-mcp-serve)
```yaml
egress: { preset: public-only } # hosts not named in policy: public addresses only
servers:
fetch:
command: /usr/local/bin/mcp-server-fetch
args: [--ignore-robots-txt]
network: confined # or watched (detect and stop), or host
egress: { preset: public-only, schemes: [https, http], methods: [GET] }
capabilities: { fetch: agent }
```
```sh
stk mcp serve fetch # decisions and audit by the broker daemon
stk mcp serve fetch --socket /run/stk/stk.sock # a daemon at another socket
stk mcp serve fetch --standalone # an in-process broker, for a laptop
stk mcp serve fetch --profile reader
```
It speaks MCP on stdio and answers `initialize`, `ping`, `tools/list` and `tools/call` with the server’s own tools. Without `--standalone` it needs a daemon (`stk serve`) at the default socket or `--socket`, and refuses to start if none answers.
Once it starts, the client sees the server’s own allowed tools. Each call now passes through the same policy and audit boundary as the rest of the broker.
* **`tools/list` is filtered by policy.** A tool the profile does not allow, or whose policy is `deny`, is not listed.
* **Every `tools/call` is decided by stk and recorded in `stk audit`**, allowed or denied, with a rule id, before the server sees it. A call to an unlisted tool is decided too.
* **Rule ids say where the decision came from**: `server:/capabilities.` (your word in `capabilities:`), `server:/default.read-only-hint` (the server annotated it read-only), `server:/default.unannotated` (approval, the safe default), `profile:`.
* **A tool at `approval` is refused**, with its rule id. Holding a direct tool call open for a person is not built; the meta-tools keep approval.
* **The server runs as the caller**, never as the broker’s user, with a placeholder (`env_var:`) instead of any credential, and the non-secret variables in `env:`. `host:` is the host its credential is substituted on; a server with no credential declares `egress:` instead.
With a daemon, the decision and the audit row are the daemon’s, from the policy it holds, over the control socket (`mcp.spec`, `mcp.visible`, `mcp.decide`, `mcp.done`, and `mcp.violation` for a detected bypass).
## Egress, decided by address
[Section titled “Egress, decided by address”](#egress-decided-by-address)
`egress:` decides connections to hosts that are not services in your policy. At the top level it is the workspace default; on a server, that server’s own.
This is where we turn “somewhere on the network” into a policy you can inspect:
```yaml
egress:
preset: public-only # or none (the default): no address is refused by class
allow: [203.0.113.7/32] # exceptions: CIDRs or class names
deny: [198.51.100.0/24] # always wins over allow and preset
schemes: [https, http] # what the proxy accepts for this egress
methods: [GET] # empty = any; set = the tunnel is opened and each request checked
```
| Class | Ranges |
| ------------- | ----------------------------------------------------------------------------------- |
| `loopback` | 127.0.0.0/8, ::1 |
| `private` | 10/8, 172.16/12, 192.168/16 |
| `link-local` | 169.254/16 (cloud metadata), fe80::/10 |
| `cgnat` | 100.64/10 (tailnets) |
| `ula` | fc00::/7 |
| `unspecified` | 0.0.0.0/8, :: |
| `multicast` | 224/4, ff00::/8 |
| `reserved` | 240/4 and broadcast, 192.0.0/24, 198.18/15, the documentation ranges, 2001:db8::/32 |
IPv4-mapped, NAT64 and 6to4 addresses are classified by the IPv4 address they carry, so they cannot launder a private one. The order is `deny`, then `allow`, then the preset, then allow.
The broker decides **at the moment it dials**: it resolves the name itself, every resolved address must be allowed, and the connection goes to the decided address, not the name, so a second DNS answer cannot move it. The broker never follows a redirect, so every hop is a new request, decided afresh. A refusal is a `403` to the `CONNECT`, before anything reaches the destination. With `http` in `schemes`, plain `http://` requests are accepted and decided the same way. With `methods:`, the tunnel is opened with the broker’s CA so each request’s method can be checked (`egress:method`) and its path recorded. Ports are not rules: an allowed address is allowed on any port.
The result is bound to the address the broker actually dials. A DNS change or redirect does not inherit an earlier decision; it earns a new one.
The proxy learns which server a request is for from its proxy credential: the user name `stk+` with that server’s own password, which the broker mints for that one name and `stk mcp serve` gives its child. The name alone selects nothing: the proxy key, another server’s password or none is refused with `407`, and so is a server that policy no longer declares. A request that names no server gets the workspace `egress`.
### A hostname allowlist: `hosts:`
[Section titled “A hostname allowlist: hosts:”](#a-hostname-allowlist-hosts)
An address preset answers “any public host”. A sandboxed `npm install` needs “these registries and nothing else”:
```yaml
egress:
hosts:
- registry.npmjs.org # exactly this name, https on 443 only
- "*.pythonhosted.org" # every name under it, not pythonhosted.org itself
- http://deb.debian.org # also plain http on 80, for this host only
```
The name is checked **before DNS**, so an unlisted host is never resolved; an IP literal is refused. A `hosts:` egress defaults to `preset: public-only`, so a listed name that resolves to this machine or its network is still refused. `hosts: []` refuses every host; no `hosts:` key means no hostname check. Refusals name the rule (`egress:hosts/not-listed`, `egress:hosts/port`, …).
With `hosts:` in place, an allowed name must pass both gates: the name itself and the class of every address it resolves to.
## A server’s own network
[Section titled “A server’s own network”](#a-servers-own-network)
A proxy cannot see a client that never speaks to it. For a server stk starts, `network:` decides what happens to one that ignores the proxy:
| `network:` | |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `confined` | the default for a server with `egress`. Linux only. The server runs in its own user and network namespace with only loopback, and a shim relays to the broker: a direct connection has no route, so it is **blocked**. If the namespace cannot be created, the server is not started |
| `watched` | Linux only. The server’s sockets are polled; a connection to anything but the broker is **detected**, recorded as `netwatch:direct`, and the server stopped. Not prevented: the first connection happens |
| `host` | the default without `egress`, and the only mode on macOS. Configured to use the broker, not confined |
[Limitations](/limitations/#a-fronted-servers-own-network-blocked-or-only-detected) has what each costs, and why a Go client never proxies loopback.
Choose `confined` when you need the direct path blocked, `watched` when detection is sufficient, and `host` only when configuration—not confinement—is the intended boundary. The table tells you which promise each choice actually keeps.
## The local-commands socket
[Section titled “The local-commands socket”](#the-local-commands-socket)
A command can read its own `HTTP_PROXY`, and a credential handed to a command is one the command can read. Sandboxed local commands get their own socket instead, where the identity is the socket’s and no credential is asked for:
```sh
stk serve --local-commands-socket /run/stk/local-commands.sock --local-commands-mode 0660
```
```yaml
servers:
local-commands:
command: none
network: host
egress:
hosts: [registry.npmjs.org, "*.pythonhosted.org"]
```
* **Every connection on it is `local-commands`**, whatever user name it sends; a claimed identity is ignored and recorded (`local-commands:identity-forced`).
* **Only `servers.local-commands.egress` decides**, with no fallback to the workspace egress. With no such egress, every request is refused (`local-commands:no-policy`).
* **No brokered service is reachable** through it (`local-commands:brokered-service`).
* **Its file mode is the only gate**, so no proxy key is asked for: use `0660` and put the sandbox’s command user in stk’s group, or `0600` when they are the same user. It serves the proxy only, never the control plane.
It is off unless `--local-commands-socket` is given.
When you enable it, sandboxed commands get one forced identity and one egress policy. They cannot rename themselves into a fronted server’s wider allowance.
# Policy and profiles
> One committed file, defaults that fail safe, and profiles that can only narrow.
Policy should be boring to review and safe to commit. We keep it in one file in your repository, with no secrets inside it:
```yaml
workspace: default
services:
github:
capabilities:
create_issue: approval # the agent proposes, you decide
x:
oauth2:
client_id:
profiles:
reader: # a profile narrows; it can never widen
github: [get_user, list_repos]
```
## Three answers
[Section titled “Three answers”](#three-answers)
Every capability ends at one of three answers. You can read the table from most permissive to least; an omitted answer does not sneak in above them.
| Policy | Meaning |
| ---------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `agent` | The caller may trigger the effect directly. |
| `approval` | The agent may propose; a human decides. **This is the zero value**, so a missing or misspelled policy fails safe rather than open. |
| `deny` | Unavailable to anyone on this workspace. A floor no profile can lift. |
## Where the defaults come from
[Section titled “Where the defaults come from”](#where-the-defaults-come-from)
The catalogue classifies each capability by what it does to the world, because reversibility is the distinction that matters:
* a **read** observes and changes nothing → `agent`
* a **write** changes something you could undo → `approval`
* a **destructive** capability cannot be undone → `approval`
A capability nobody has classified is never agent-callable. An unknown effect is treated as a write, not as a read.
That gives us the useful default: a new capability waits for a person instead of quietly inheriting authority nobody reviewed.
## Profiles
[Section titled “Profiles”](#profiles)
A profile is a named subset handed to one caller:
```sh
stk mcp --profile reader
```
It can only narrow. A profile naming a capability that policy denies does not widen it, and an unknown profile does not quietly resolve to the default — it is an error, because silently granting the default set to a caller that asked for something else is the wrong direction to fail in.
Once you start the MCP server with `reader`, that caller sees only the named subset. The profile can close doors; it cannot open one policy already closed.
## Checking what a caller can see
[Section titled “Checking what a caller can see”](#checking-what-a-caller-can-see)
```sh
stk doctor
```
reports the profiles declared and, for each, what it exposes.
You can now compare the intended subset with the broker’s report before handing the profile to an agent.
# Gated publishing
> stk publish posts to X only after a SuperPipeline gate approved the exact bytes, and never posts twice.
Let’s take one effect all the way from proposed bytes to a recorded delivery. `stk publish` is a durable path for a post to X: the agent proposes the exact bytes, a person approves those bytes on a SuperPipeline gate, and stk posts them automatically—only them—and records where they went.
```sh
stk publish submit < request.json # store the exact request; prints its id and digest
stk publish perform # post it, if and only if the gate approved these bytes
stk publish recover # finish or fence anything a crash left half-done
```
**Exit status 3 means the gate is waiting for a person.** It is neither success (0) nor failure (1): `perform` prints `{"id": …, "state": "awaiting_decision"}` and nothing has been sent. Run it again later.
The three commands give you a durable request, a gated attempt, and a recovery path. At no point does “still waiting” masquerade as delivery.
## What it needs
[Section titled “What it needs”](#what-it-needs)
Three services connected on the broker: `x` (the account that posts), and the two native-only SuperPipeline services, `superpipeline-approvals-read` (to read the gate’s decision) and `superpipeline-approvals-write` (to record the delivery on the card). Each SuperPipeline credential is an Organization-plane service credential with one scope. The agent holds none of them, and no profile can name the SuperPipeline ones.
## Submit
[Section titled “Submit”](#submit)
`submit` reads one JSON request on stdin:
| Field | |
| ---------------------- | -------------------------------------------------------------------------- |
| `boardId`, `subjectId` | the SuperPipeline board and the frozen approval subject (`brd_…`, `aps_…`) |
| `expiresAt` | the subject’s expiry, RFC 3339 |
| `method`, `url` | `POST` and `https://api.x.com/2/tweets`: the only request it accepts |
| `bodyBase64` | the exact request body |
| `mediaBase64` | each media object, in order |
| `summary` | what a person reading the record should see |
It stores those bytes and prints the effect’s id, its request digest and its state. The board and subject ids are lookup references, not authority: only stk’s own authenticated read-back of the gate can authorize the send.
Submit ends with the exact bytes frozen under an id and digest. That is the object a person will approve; later edits cannot hitch a ride on the decision.
## Perform
[Section titled “Perform”](#perform)
`perform` loads the stored bytes back from disk, then asks SuperPipeline directly, with stk’s own read credential, for the stored gate decision. It must return the gate, the frozen subject’s digest, an `automatic` delivery decision, and that the decision is current. Immediately before sending, stk hashes the actual method, URL, body and media and compares that with the digest the person approved. A mismatch is refused and recorded with both digests. A rejection, requested changes, a manual delivery choice, expiry, an unreachable SuperPipeline or an unreadable answer all fail closed.
After X accepts the post, stk reads it back to find its live URL, and records that URL on the SuperPipeline card with the write credential.
Perform therefore ends with evidence on both sides: the live post can be read back, and its URL is attached to the card that carried the decision.
A SuperPipeline-gated effect cannot be decided locally: `stk approvals allow` and `deny` both refuse it without changing its state.
## Never twice
[Section titled “Never twice”](#never-twice)
A timeout or a dropped connection after the bytes may have reached X is not a failure: stk records `outcome_unknown`, fences every retry, and reads X back to see whether the exact approved post exists, without writing.
* **Found**: recorded as delivered, with its URL, which goes on the card.
* **Not found, or not indexed yet**: the fence stays. A search miss is inconclusive and never permits a retry.
* **Read-back failed**: still `outcome_unknown`, still fenced.
`stk publish recover` walks the queue and does this for every gated effect a crash left sending, unknown, delivered-but-unrecorded or allowed to retry, and refuses any that expired without a confirmed decision. A provider’s 4xx or 5xx is a confirmed answer, recorded as it is, and never treated as delivery.
Recovery gives every interrupted effect a safe terminal state or an explicit fence. The one result it never manufactures is permission to send the same bytes again on a guess.
# Services
> The thirteen services in the catalogue, what the broker does for each, and the services you declare yourself.
The catalogue is deliberately short. You already have hundreds of MCP servers to choose from; we add an entry only where the broker fronts a service directly. Breadth is not the trick here. A precise request boundary is.
The thirteen services are chosen so that every auth scheme and every credential placement has a **live connector** behind it rather than only a constant.
| Service | Host | Operation | Placeholder in |
| ------------------------------- | ----------------------- | -------------------------------- | ------------------------------------- |
| `github` | api.github.com | substitute a token | `GH_TOKEN` |
| `github-app` | api.github.com | mint a JWT → installation token | — |
| `aws-sts` | sts.amazonaws.com | sign with SigV4 | — |
| `x` | api.x.com | refresh an OAuth 2.0 grant | `X_BEARER_TOKEN` |
| `google` | sheets · drive · oauth2 | refresh an OAuth 2.0 grant | `GOOGLE_ACCESS_TOKEN` |
| `slack` | slack.com | substitute a token | `SLACK_BOT_TOKEN` |
| `notion` | api.notion.com | substitute a token | `NOTION_TOKEN` |
| `stripe` | api.stripe.com | substitute inside a Basic header | `STRIPE_SECRET_KEY` |
| `openai` | api.openai.com | substitute a token | `OPENAI_API_KEY` |
| `cloudflare` | api.cloudflare.com | substitute a token | `CLOUDFLARE_API_TOKEN` |
| `resend` | api.resend.com | substitute a token | `RESEND_API_KEY` |
| `superpipeline-approvals-read` | app.superpipeline.dev | exchange a service credential | `SUPERPIPELINE_APPROVALS_READ_TOKEN` |
| `superpipeline-approvals-write` | app.superpipeline.dev | exchange a service credential | `SUPERPIPELINE_APPROVALS_WRITE_TOKEN` |
“Placeholder in” is the variable `stk run` and `stk env` fill with a worthless placeholder, where the client expects its credential.
```sh
stk add github slack x
```
Adding a service prints how its capabilities are classified — how many are agent-callable reads and how many need approval.
That summary tells you what the safe defaults bought before you connect a credential or hand the service to an agent.
The two `superpipeline-approvals-*` services are **native-only**: stk uses them itself, for [approvals hosted on SuperPipeline](/use/approvals/#approvals-hosted-on-superpipeline) and for [gated publishing](/use/publish/). No agent profile can name them, and their tokens are applied in stk’s own transport and never returned. Each is an Organization-plane service credential with one scope, connected with `stk connect superpipeline-approvals-read` (or `-write`), the credential on stdin.
## Some notes the table cannot carry
[Section titled “Some notes the table cannot carry”](#some-notes-the-table-cannot-carry)
The table is exact; these notes explain why a few rows needed their particular shape.
**Stripe** keeps scheme-aware substitution honest. Its secret key travels as the Basic username, so the broker decodes the header, replaces the value and re-encodes it. A plain string swap matches nothing there and silently does nothing, which is exactly what it did until a review caught it.
**Google** needed more than one hostname. A credential is refreshed at `oauth2.googleapis.com` and spent at `sheets.googleapis.com` or `www.googleapis.com`; intercepting one of three would leave the others tunnelled with the placeholder arriving unswapped.
**Notion** requires a dated `Notion-Version` header. It is part of the request shape rather than something a caller should have to remember, so it lives in the catalogue beside the paths.
**X** rotates its refresh token on every single use and invalidates the old one immediately. The rotation is persisted before the new access token is handed out, because a rotation that is not written back locks you out at the next refresh — hours later, nowhere near its cause.
## What does not fit
[Section titled “What does not fit”](#what-does-not-fit)
**GraphQL APIs.** Every call is `POST /graphql` with the operation in the body, so a method and a path cannot tell one capability from another. Policy could not name what it was allowing and the ledger could not say what happened, which is worse than not supporting it. Linear was dropped from the launch catalogue for exactly this, and a test fails any entry with that shape.
**Non-HTTP protocols** — Postgres, Redis, SMTP. A CONNECT proxy cannot inject into a Postgres handshake. Those need a protocol-aware local proxy, which is a second product shape.
Anything not in the table can still be reached in one of three ways: a git forge or a public endpoint [declared in your own configuration](#a-git-forge-defined-in-configuration), or a [fronted MCP server](/use/from-an-agent/#fronting-an-mcp-server-you-did-not-write).
## A git forge, defined in configuration
[Section titled “A git forge, defined in configuration”](#a-git-forge-defined-in-configuration)
A self-hosted Forgejo or Gitea has a host no catalogue could name, so a forge is declared in `supertoolkit.yaml` instead of compiled in:
```yaml
services:
forge-main:
kind: forge
provider: forgejo # forgejo | gitea | github | bitbucket
host: forge.example.com # a bare hostname
scheme: bearer # or `token` for Authorization: token
env_var: FORGEJO_TOKEN
repositories: [acme/widgets] # owner/name, required
preset: issues # read | issues | pull-requests | maintain | none
```
Then `stk connect forge-main` (the token on stdin) and `stk verify forge-main`, which makes one read call as that credential and prints the login it acts as, or the reason it failed. `api_prefix:` sets the path the API is served under when it is not the provider’s default.
The verification result names the provider identity you connected without printing the token. You can check the account before the first allowed write.
**Presets are enforced.** The broker decides every request to a forge before it fetches the credential: a request no rule allows gets a `403` that names the rule, and nothing is sent to the provider. The preset’s rules come first, then your own `rules:`; a matching `deny` always wins, and anything not allowed is denied.
| `preset:` | allows (cumulative) |
| --------------- | --------------------------------------------------------------------------- |
| `read` | GET on `/user` and the configured repositories |
| `issues` | read, plus creating and editing issues, comments and issue labels |
| `pull-requests` | issues, plus opening and editing pull requests, reviews and review requests |
| `maintain` | pull-requests, plus merging pull requests, releases and repository labels |
| `none` | nothing; write every rule yourself |
No preset allows `DELETE`, so a `DELETE` needs an explicit `allow` of your own. Bitbucket has no presets yet: use `preset: none`.
```yaml
preset: read
rules:
- allow: "PATCH /repos/{owner}/{repo}/issues/*"
when: {state: absent} # a JSON body must not set `state`
- deny: "POST /repos/{owner}/{repo}/issues/*/lock"
```
A rule is exactly one of `allow:` or `deny:`, with an optional `when:` on the JSON body; any other key fails the load, because a dropped misspelling would turn a conditional allow into an unconditional one. Paths are written relative to `api_prefix`. `{owner}` and `{repo}` must be used together and match the configured repositories. Paths containing `..`, `//` or an encoded slash are refused.
GraphQL is denied by default (rule `builtin:graphql`), because one endpoint carries every operation. `allow_graphql: true` on the service stops that built-in deny; the endpoint is then still subject to the path rules, but the operation inside the body is not inspected, so no rule can restrict which queries or mutations run. `stk audit` shows the rule that denied a request.
### A GitHub App forge
[Section titled “A GitHub App forge”](#a-github-app-forge)
```yaml
services:
acme-app:
kind: forge
provider: github
host: github.example.com # GitHub Enterprise Server; api.github.com for github.com
auth: app
env_var: GH_TOKEN
repositories: [acme/widgets, acme/gadgets] # one owner only
preset: issues
```
`auth: app` is GitHub-only and sends the installation token as a Bearer header (`scheme: token` is refused with it). The installation token is requested restricted to the configured repositories, which must all belong to one owner. For any host other than `api.github.com` the API is served under `/api/v3`, which is the default `api_prefix`. Connect it with `app_id`, `installation_id` and `private_key` as `field=value` lines on stdin to `stk connect acme-app`.
When an allowed request needs authentication, the broker mints an installation token for the configured repository set. The private key stays in the broker’s store instead of joining the agent.
### Audit labels
[Section titled “Audit labels”](#audit-labels)
`labels:` on a `kind: forge` service copies up to three short values — `station`, `principal` and `grant` — onto every audit row for it, so a ledger shared by several callers says whose request each was. Any other key, a value over 128 bytes or a control character fails the load.
## A public endpoint, for policy and audit only
[Section titled “A public endpoint, for policy and audit only”](#a-public-endpoint-for-policy-and-audit-only)
`auth: none` declares a forge service that holds no credential. The broker never reads the store for it and injects nothing; its rules still decide every request and `stk audit` still records it. Anonymous git over HTTPS is the case it is for:
```yaml
services:
git-public:
kind: forge
provider: github
host: github.com
auth: none
api_prefix: /
preset: none
repositories: [acme/widgets]
rules:
- allow: "GET /{owner}/{repo}/info/refs"
- allow: "POST /{owner}/{repo}/git-upload-pack"
- deny: "POST /*/*/git-receive-pack"
```
This is still useful: you get policy and an audit trail for anonymous traffic, without pretending there is a secret to protect.
A push opens with `GET …/info/refs?service=git-receive-pack`; the broker decides that request as the push it begins, so a denied push is refused at its first request. `scheme` and `env_var` cannot be set with `auth: none`, and `stk connect` and `stk verify` refuse it. Point git at the broker with `http.proxy` and `http.sslCAInfo` (from [`stk env`](/run/serve/#the-fixed-proxy-and-stk-env)), and turn off `ssh://`, `git://` and `ext::`, which would go around it.
# What SuperToolkit is
> A credential broker for agents, and the single invariant it is built around.
SuperToolkit gives agents credential and auth management without giving them credentials. Your agent asks for an effect by name; we keep the secret that causes it on the other side of the broker.
## The one invariant
[Section titled “The one invariant”](#the-one-invariant)
> **The agent never holds, reads, or receives a credential.**
It is not configurable, and there is no override. No endpoint returns a credential — not to an agent, the CLI, or the web interface. You set policy for the effects an agent may *trigger*. That line is the product; everything else exists to hold it.
## How it works
[Section titled “How it works”](#how-it-works)
For one child, `stk run` starts an in-process broker and a loopback proxy. For long-running agents, run `stk serve` as its own OS user; clients reach its Unix control socket and loopback proxy. In either mode, you start HTTP clients with `HTTPS_PROXY` pointing at the broker and a **placeholder** where their token would be:
```sh
GH_TOKEN=stk:ref:github:v1
```
The broker recognises that placeholder on the wire and does whatever the service needs. You do not modify the client: configure it exactly as you would without a broker, except the value it holds is worth nothing. The request still works; the credential never becomes client state.
## The six credential operations
[Section titled “The six credential operations”](#the-six-credential-operations)
What a service needs decides what the broker does. The catalogue declares it, so adding a scheme is an entry rather than a branch in the request path.
| Operation | What happens | On the wire | `stk connect` and `stk ui` call it |
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------- | --------------------------------------- |
| **substitute** | A stored token replaces the placeholder. | the long-lived token | substitute (token) |
| **substitute, scheme-aware** | The Basic header is decoded, the value replaced, and re-encoded. A plain string swap matches nothing, because the credential is inside base64. | the long-lived token | substitute (token) |
| **sign** | The request is signed inside the broker. The credential is an HMAC over the method, path, headers and body — not a value anything can carry. | a signature | sign (AWS SigV4) |
| **mint** | A JWT is minted from a stored private key and exchanged for an installation token that expires in an hour. | a short-lived token | acquire (GitHub App installation token) |
| **refresh** | A stored OAuth 2.0 refresh token is exchanged for a short-lived access token. The refresh token only ever reaches the provider’s token endpoint. | a short-lived token | acquire (OAuth 2.0 refresh) |
| **exchange** | A stored service credential is exchanged at the Organization plane for a token that lasts minutes, naming the audience it is for. The stored credential only ever reaches the exchange endpoint. | a short-lived token | acquire (service token exchange) |
Four of the six operations never put a long-lived secret on the wire at all. `stk doctor` tells you which case each connected service is in, derived from what is actually stored rather than from what the catalogue expected.
A service declared with `auth: none` holds no credential at all, and is shown as none (policy and audit only): the broker enforces its rules and records every request, and injects nothing. See [Services](/use/services/#a-public-endpoint-for-policy-and-audit-only).
## What it is not
[Section titled “What it is not”](#what-it-is-not)
You are not signing in to a hosted service, and we are not asking you to adopt an agent framework. SuperToolkit sits beside whatever you already run. It does not open traffic for hosts you have not configured: everything else is tunnelled unopened (and recorded), so the blast radius of interception is exactly your service list — unless an [`egress:`](/use/mcp-serve/#egress-decided-by-address) policy with `methods:` asks for those connections to be opened and checked.