This is the full developer documentation for SuperToolkit # SuperToolkit > A credential broker for agents. The agent asks for an effect by name; the broker substitutes, signs or mints on the wire. SuperToolkit docshalf-lit: Works, with known gaps the page names. ## The agent gets the effect, never the credential. Your agent asks for something by name: read this repository, open that issue. SuperToolkit decides whether it may (by default a read goes ahead and a write waits for you), puts the real credential on the wire on the way out, and writes down what happened. The agent holds a placeholder, stk:ref:github:v1, which is worth exactly nothing to whoever finds it. Hard to leak a key you were never given. [Install →](/install/)[Read the limitations](/limitations/)[supertoolkit.dev ↗](https://supertoolkit.dev) ### Ask Captain Jack Ahoy. Ask me anything about SuperToolkit. I answer only from these docs, and I'll tell you when they don't cover it. Ask Captain Jack about SuperToolkitAsk Captain Jack…Ask Why did I get a 403 that says "Nothing was sent"?Can my agent read the token from its environment?Why does gh refuse the certificate on my Mac?How do I let an agent open pull requests but never merge them? An AI writes his answers from the docs; check anything you copy. ### Work with an agent ``` I'm working with SuperToolkit. Read https://docs.supertoolkit.dev/llms.txt to see what its docs cover, and https://docs.supertoolkit.dev/llms-full.txt for every page in one file. Then explain how SuperToolkit would broker my agent's GitHub access, and list what I need before I connect a credential. Name the docs page each answer comes from, and tell me when the docs do not cover something. ``` Copy prompt ### Quick start: broker a request, with the provider faked ``` $ git clone https://github.com/SuperJackfruitLabs/supertoolkit && cd supertoolkit && go test ./e2e/ -v -run 'TestChildReachesProvider|TestForgeRulesAllowThenDeny|TestForgeDenied' ``` Copy Needs Go 1.26 (the repository's go.mod) and curl, and nothing else: the provider is a local stand-in and the token is made up. Three tests: curl reaches the provider with a credential it never held, a forge preset lets a POST through and answers a DELETE with 403 before the provider sees it, and that refusal lands in the ledger with its rule and no secret. To broker your own services, start with Install. ### How a brokered request flows (step through it; it waits for you) 1Agent2Proxy3Decision4Injected5Provider6Audit 1\. AgentFORGEJO_TOKEN=stk:ref:forge-main:v1 2\. ProxyDELETE /api/v1/repos/acme/widgets/issues/1 3\. DecisionPOST …/issues (preset: issues)DELETE …/issues/1 → 403 4\. Injectedstk:ref:forge-main:v1Bearer \ 5\. Providerthe provider answers ✓ 6\. Audit403 denied: builtin:default-denycredential: sha256:… (a fingerprint) **1. Agent.** stk run -- your-agent starts the agent with HTTPS_PROXY pointing at the broker, the broker's CA, and a placeholder where each credential would be. NO_PROXY is cleared, because it is a confirmed bypass. The agent makes an ordinary HTTPS request with the placeholder in it. **2. Proxy.** The request reaches the broker, not the provider. The broker terminates TLS with its own local CA and looks up the service configured for that host. **3. Decision.** For a forge, its preset and your rules decide before the credential is even read: a deny always wins, and anything not allowed is denied. No preset allows DELETE. A refusal is answered at once with a 403 that names the rule: "supertoolkit denied this request: rule builtin:default-deny (no-rule). Nothing was sent." **4. Injected.** Only an allowed request makes the broker read the credential from its sealed store. It puts the real token where the placeholder was, or signs the request, or mints a short-lived token, as the service needs. **5. Provider.** The provider gets an ordinary request with a real credential, and its answer streams back to the agent as it arrives. The credential never entered the agent's process. **6. Audit.** Each request leaves a row in the audit ledger (stk audit): service, method, path, outcome, and a fingerprint where the credential would be, never the value. A refused request names its rule instead, since it never touched the credential. ← BackStep 1 of 6Next → ### Find your way Copy Markdown ## Why a broker [Section titled “Why a broker”](#why-a-broker) Let’s begin with the problem we are actually solving. The standard way to give an agent a tool is to put an API key in an MCP config file. That file is plaintext, any process can read it, and the agent reads it to start the server — so the credential ends up in the agent’s own context, and from there in the transcript and wherever transcripts are kept. SuperToolkit holds the credential in a process the agent cannot read, and puts it on the wire on the way out. The agent’s environment carries a placeholder: ```sh GH_TOKEN=stk:ref:github:v1 ``` If the agent reads that, it has read nothing. It means nothing off this host. You still get the effect; the key never joins the conversation. Six operations Substitute a token, substitute inside a Basic header, sign with SigV4, mint a JWT, refresh an OAuth 2.0 grant, or exchange a service credential for a token that lasts minutes. **Four of the six operations never put a long-lived secret on the wire at all.** A read is the agent's A write needs you. Defaults come from the catalogue and fail safe: anything unclassified is treated as a write, and `deny` is a floor no profile lifts. A record that answers What was done, under which policy, and what the provider said — with a fingerprint where the credential would be, never the value. Runs on your machine No account, no telemetry, no update check. The only hosts it contacts are the providers you connect and the token endpoints they publish. ## A client that ignores the proxy [Section titled “A client that ignores the proxy”](#a-client-that-ignores-the-proxy) A client that ignores proxy configuration entirely goes around the broker, and **fails silently** — it sends the placeholder to the provider and gets a plausible 401 back, which reads as a credential problem rather than a routing one. On Linux, a fronted MCP server run by `stk mcp serve` with `network: confined` (the default for a server that declares `egress:`) is blocked from doing this: its only route is the broker. With `network: watched` (also Linux only) a direct connection is detected and the server stopped. Everywhere else, including every `stk run` child and every fronted server on macOS, nothing inside a proxy can detect a client that never speaks to it. We can detect the bypass from outside, which is what `stk doctor --probe` is for. Run it before trusting a new client. You will know whether the client is on the brokered path before a real credential depends on the answer. See [Limitations](/limitations/). 🖌 Wet paint SuperToolkit works, and it is early: v0.0.9, released on 9 November 2026, is the current release. [Limitations](/limitations/) says what it does not do and why. Read it before trusting the broker with something that matters. Captain Jack says I read these docs so you don’t have to read all of them at once. Ask me in the box up top. I hold no credentials either, and if the answer isn’t in here I’ll say so rather than make one up. For agents, the same docs are plain text: [`/llms.txt`](/llms.txt) indexes them, and [`/llms-full.txt`](/llms-full.txt) is every page in one file. # Connect a service > Four ways to get a credential into the broker, in order of preference. We are going to move a credential from its provider into your broker—not through a hub and not through us. Three of the four paths below hold to that exactly; the fourth says plainly where it does not. ```sh stk add github # add the service, with safe default policy stk connect github # the credential, read from stdin — never a flag ``` A flag would land in shell history and in the process table, so the credential is read from stdin only. After those two commands, the service exists in policy and its credential is sealed in the store. Nothing secret was placed in an argument. ## 1. Paste it [Section titled “1. Paste it”](#1-paste-it) ```sh pbpaste | stk connect github # macOS stk connect github # then paste, then ctrl-D ``` For a token you already hold. Nothing is printed back but the number of fields sealed and where. That count is your payoff: it confirms what was sealed without echoing any of the material back to the terminal. ## 2. A browser on this machine — OAuth 2.0 with PKCE [Section titled “2. A browser on this machine — OAuth 2.0 with PKCE”](#2-a-browser-on-this-machine--oauth-20-with-pkce) ```sh stk connect x --browser ``` The broker opens the provider’s authorization page, receives the redirect on loopback, and exchanges the code. The **refresh token** is stored; the access token is not — it is acquired on demand, so a stolen store yields something that must be exchanged with the provider before it is worth anything. You register your own OAuth app and name its client id in `supertoolkit.yaml`: ```yaml services: x: oauth2: client_id: # only if the app is already registered with a different loopback callback redirect_uri: http://localhost:8080/callback ``` SuperToolkit ships no client id. A shared one would make every installation look like the same app to the provider, and be a single point of revocation for everyone. A client id is public by OAuth’s design — it names an app and authorises nothing — so it is safe in a committed file. A client secret is not, and is read from stdin. The redirect must be loopback: the broker receives it itself, so a callback anywhere else never arrives, and one reachable from the network would let anyone on it deliver a code to you. When the browser flow returns, the broker holds the refresh token and can acquire access tokens on demand. The browser never has to hand a token back through your shell. A self-hosted instance speaks the same protocol at other addresses. Name both endpoints, or neither: exchanging a code at a server that did not issue it never succeeds, so the file does not load with only one. ```yaml oauth2: client_id: authorize_url: https://auth.example.com/oauth2/authorize token_url: https://auth.example.com/oauth2/token ``` ## 3. No browser on this machine — the device grant [Section titled “3. No browser on this machine — the device grant”](#3-no-browser-on-this-machine--the-device-grant) ```sh stk connect github --device ``` As for the browser flow, the client id is your own OAuth app’s, named in `supertoolkit.yaml` (the device grant exists so a public client needs no secret). For a self-hosted instance such as GitHub Enterprise Server, name its two endpoints too, both or neither: ```yaml services: github: device: client_id: # only for a self-hosted instance authorization_url: https://github.example.com/login/device/code token_url: https://github.example.com/login/oauth/access_token ``` The provider issues a short code. You approve it in a browser **anywhere** — a phone is fine — and the token comes back to the broker directly, without ever touching the machine you approved from. ```plaintext code 9688-D9DD open https://github.com/login/device enter the code to approve it; it is useless to anyone who does not ``` The **user code** above may be read aloud, screenshotted or sent through a webhook: it does nothing without the person who approves it. The **device code** — the value the poll redeems — never appears in any output. Where the provider issues a refresh token, it is kept, and the connection renews itself. Where it does not, the command says so rather than leaving you to find out at the expiry. Once you approve the short code, the broker receives the resulting token directly. The machine with the browser has approved access without becoming the credential courier. Configure notifications so the code reaches you when nobody is watching the terminal: ```yaml notify: webhook: https://ntfy.sh/your-topic file: /var/log/stk-notify.log ``` With either destination configured, the approval prompt has somewhere to land even when the broker’s terminal is unattended. ## 4. Last resort — encrypted hand-over [Section titled “4. Last resort — encrypted hand-over”](#4-last-resort--encrypted-hand-over) For a machine with no browser whose provider offers no device grant. ```sh # on the broker stk handover key # on a machine that has a browser, with the credential stk handover seal github --to '' # back on the broker stk handover open github ``` The broker publishes a key that can only seal. Only its private half opens the envelope, and a tampered one fails rather than yielding partial material. Opening the envelope leaves the broker with the sealed credential and proves that this broker—not the sealing machine—held the private half needed to read it. **This path costs something the others do not**, and the commands say so: the credential exists on the sealing machine while it is sealed, and still exists there afterwards. Prefer the device grant or the web interface whenever either is possible. ## Proving it works [Section titled “Proving it works”](#proving-it-works) ```sh stk verify github stk verify github --expect-login your-login --json ``` `stk verify` makes one read call as the stored credential and prints the login it acts as, or the reason it failed, and exits non-zero on failure. It never prints a token. You now have the useful proof: the provider says which account this credential acts as, while the credential itself remains absent from the output. ## Withdrawing a credential [Section titled “Withdrawing a credential”](#withdrawing-a-credential) ```sh stk revoke github stk revoke github --local # only the local copy ``` Deleting our copy does not invalidate the token at the provider. Where the provider offers revocation we call it; where it does not, the output says the credential may still be valid and gives you the page that can withdraw it. It never claims more than it did. At the end, you know whether only the local copy is gone or the provider has invalidated the credential too. That distinction is too important for a victory message to blur. # Install > Install SuperToolkit with the checksum-verifying installer or from source, and stand up a broker. Let’s put one binary on your machine and prove it is ready before a real credential goes anywhere near it. SuperToolkit’s binary is `stk`; it runs on Linux or macOS, amd64 or arm64. ## The installer [Section titled “The installer”](#the-installer) ```sh curl -fsSL https://supertoolkit.dev/install.sh | sh ``` It downloads the release archive for this OS and architecture and the release’s `SHA256SUMS`, and **verifies the archive before moving anything into place**. A missing checksum tool, a `SHA256SUMS` that does not mention the archive, or a mismatch stops it: it refuses rather than warns. It then puts `stk` in `/usr/local/bin` if that is writable, otherwise `~/.local/bin`, and prints `stk version`. When the command finishes, you have a checksum-verified `stk` at the path it prints, along with the installed version. If that directory is not on your `PATH`, the installer says so instead of pretending the next command will work. | Variable | Default | | | -------------- | ---------------------------------- | ---------------------------------------------------------------------------------------- | | `STK_VERSION` | the latest release | a tag to install instead | | `STK_BIN_DIR` | `/usr/local/bin` or `~/.local/bin` | where to put the binary | | `STK_BASE_URL` | the GitHub release | a mirror or an air-gapped copy. `SHA256SUMS` is still fetched from it and still verified | ```sh curl -fsSL https://supertoolkit.dev/install.sh | STK_VERSION=v0.0.9 STK_BIN_DIR="$HOME/bin" sh ``` ## From source [Section titled “From source”](#from-source) ```sh git clone https://github.com/SuperJackfruitLabs/supertoolkit cd supertoolkit go build -o stk ./cmd/stk mkdir -p "$HOME/.local/bin" install -m 0755 stk "$HOME/.local/bin/stk" export PATH="$HOME/.local/bin:$PATH" ``` Go 1.26.0 or newer is required by the module. The commands above install `stk` under your account and add it to this shell’s `PATH`. Add the same `export` line to your shell startup file to use it in future terminals. That route ends in the same place as the installer: a local `stk` you can invoke now, with the source checkout still available if you want to inspect it. There is nothing else to install: the web interface is embedded in the binary. `stk version` prints the version it was built as. On a server where agents run as their own OS users, run the broker as another one, under systemd: see [Run as a service](/run/serve/), and `stk install`. ## First run [Section titled “First run”](#first-run) ```sh stk init ``` This creates a local certificate authority, the state directory and key that will protect each sealed credential file, and a starter `supertoolkit.yaml`. The credential file itself appears when you connect a service. `stk init` prints every path and **where the store key came from** — an OS keychain, or a file beside the ciphertext. That difference matters and is reported rather than hidden; see [Limitations](/limitations/#the-store-key-is-only-as-good-as-the-platform). You now have the CA, key and policy file the broker needs—and an explicit answer about where the key that will protect connected credentials came from. The CA is created once per install and persists. On macOS, Go programs ignore `SSL_CERT_FILE` and read the system keychain, so tools written in Go — `gh` among them — need the CA trusted there. `stk init` prints the exact command. ## Prove it works before trusting it [Section titled “Prove it works before trusting it”](#prove-it-works-before-trusting-it) ```sh stk doctor # the setup, and that no credential is reachable by a child stk doctor --probe # that your clients actually go through the broker ``` The probe is the important one. It drives a real request through a real broker at a hostname in the `.invalid` TLD, which can never resolve — so a client that fails DNS has **proved** it bypassed the proxy rather than merely looked like it might: ```plaintext ✓ curl honoured the provider received the substituted credential ✓ python3 urllib honoured the provider received the substituted credential ✓ node fetch honoured the provider received the substituted credential ✗ go net/http refused-ca it would not trust the broker's certificate ``` A client reported as `bypassed` must not be brokered. A client that *refuses the certificate* is the safe case: the request does not happen, rather than happening unbrokered. When the probe reports `honoured`, you have observed the provider stand-in receive the substituted value. That is the result we need before trusting the same route with a real service. ## Uninstall [Section titled “Uninstall”](#uninstall) Delete the binary and the state directory `stk init` named. To withdraw the credentials first, and as far as possible at the providers too: ```sh stk revoke ``` The command tries provider revocation first, then removes the local copy. Its output says whether the provider invalidated the credential or it may still be valid, so deleting ciphertext is never mistaken for withdrawing access. # Limitations > What SuperToolkit does not do, and why. Each entry is a decision or a measurement. Note This page is generated from `docs/limitations.md` in the repository. Where the two disagree, the repository wins. Here is where we put the edges in daylight. What SuperToolkit does not do, and why. Each entry is a decision or a measurement, not a shrug — and the ones that are decisions say what they would cost to change. Read this before trusting the broker with something that matters. You should leave knowing which failures are loud, which are detectable, and which boundary you must provide outside the broker. *** ## A client that ignores the proxy [Section titled “A client that ignores the proxy”](#a-client-that-ignores-the-proxy) **A client that ignores proxy configuration entirely goes around the broker, and fails silently.** Whether that can be blocked depends on how the client is run: * **Blocked:** a fronted MCP server run by `stk mcp serve` with `network: confined`, on Linux only. A server that declares `egress:` and no `network:` gets `confined` by default. It runs in its own network namespace with only loopback, so a direct connection has no route. If the namespace cannot be created, the server is not started. See [A fronted server’s own network](#a-fronted-servers-own-network-blocked-or-only-detected). * **Detected and stopped, not blocked:** a fronted server with `network: watched` (also Linux only). The first direct connection happens; the server is then stopped. * **Only detectable from outside:** everything else. That covers every `stk run` child, a fronted server with `network: host`, a fronted server with no `egress:` (it defaults to `host`), and every fronted server on macOS, where `confined` and `watched` are refused at policy load and `network: host` must be said explicitly. For a client in that last group, the bypass cannot be fixed inside the broker, and nothing stops or records it. Such a client sends the worthless placeholder to the provider, gets a plausible 401 back, and the error reads as a credential problem rather than a routing one. The Phase 0 spikes found two: a Go program that builds its own `http.Transport` without `ProxyFromEnvironment`, and Node’s default `fetch` before `NODE_USE_ENV_PROXY` existed. Nothing in a proxy can detect a client that never speaks to it. What can be done is detect it from outside, which is what `stk doctor --probe` is for: ```plaintext $ stk doctor --probe ✓ curl honoured the provider received the substituted credential ✓ python3 urllib honoured the provider received the substituted credential ✓ node fetch honoured the provider received the substituted credential ✗ go net/http refused-ca it would not trust the broker's certificate ``` The probe drives a real request through a real broker at a hostname in the `.invalid` TLD, which RFC 2606 guarantees will never resolve. A client that honours the proxy resolves nothing — it asks the broker for the host by name. A client that ignores the proxy must resolve it itself and cannot. A DNS failure is therefore **proof** of a bypass, not a guess. **Run the probe before trusting a new client.** A client it reports as `bypassed` must not be brokered. The command exits non-zero on `bypassed` or `failed`, and `--json` gives a machine-readable list. That result gives you a hard stop before a real service is involved. An `honoured` client can move on; a `bypassed` client needs a different boundary. ### The safe class, by contrast [Section titled “The safe class, by contrast”](#the-safe-class-by-contrast) A client that *rejects the broker’s certificate* fails **loudly**: the request does not happen. That is the right failure. On macOS, Go programs ignore `SSL_CERT_FILE` and use the system keychain, so `gh` and similar need the CA trusted there — `stk init` prints the command. Everywhere else `stk run` sets the trust store and it just works. *** ## Measured, and recorded as facts [Section titled “Measured, and recorded as facts”](#measured-and-recorded-as-facts) Full numbers and the machine they came from: [measurements.md](/measurements/). * **Brokered mTLS does not work.** An upstream requiring a client certificate gets a 502 — loud, immediate, nothing sent. The broker holds no client certificate. Tunnel that host instead of brokering it, where its own certificate stays intact. Changing this means a client certificate per service in the store, which is a feature. * **Bodies are transparent to at least 8 MB**, hashes matching end to end, with the credential still substituted. Nothing buffers a whole body, so the next limit is the provider’s. * **Overhead is about 79 µs at the median**, 459 µs at p99, against 56 µs direct. A cross-region round trip is 250 to 1,900 times that. *** ## Protocol limits [Section titled “Protocol limits”](#protocol-limits) ### WebSocket and other upgrades: refused, not broken [Section titled “WebSocket and other upgrades: refused, not broken”](#websocket-and-other-upgrades-refused-not-broken) A credential is substituted on an HTTP request, and an upgraded connection carries no further HTTP requests to substitute into. The broker returns **501** with an explanation rather than appearing to succeed and then hanging, which is what it used to do and reads as the provider’s fault. Tunnel the host instead: remove it from `services` and its traffic passes through unopened. The connection works and carries whatever credential the client itself holds — the trade this product otherwise exists to avoid. ### Non-HTTP protocols are out of scope [Section titled “Non-HTTP protocols are out of scope”](#non-http-protocols-are-out-of-scope) Postgres, MySQL, Redis, Kafka, SMTP, IMAP. A CONNECT proxy cannot inject into a Postgres handshake; these need a protocol-aware local proxy per protocol, which is a second product shape rather than a missing afternoon. A tunnelled host passes them through untouched today, unbrokered. ### GraphQL APIs do not fit the catalogue [Section titled “GraphQL APIs do not fit the catalogue”](#graphql-apis-do-not-fit-the-catalogue) Every call is `POST /graphql` and the operation lives 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 audit 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 (`TestNoTwoCapabilitiesAreIndistinguishableOnTheWire`) now fails any entry with that shape. Supporting GraphQL means dispatching on the operation name inside the body, which is a real design with real ambiguities (aliases, batched operations, fragments). It is not hard; it is simply not done. *** ## Deliberately out of scope [Section titled “Deliberately out of scope”](#deliberately-out-of-scope) Each of these is a product-shape decision. None is blocked; none is started. | Not done | Why not | | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Inbound webhooks** | Receiving and verifying provider events is half of what an integration platform does, and all of it is a new surface with a different security posture — a public listener instead of an outbound proxy | | **Connectors as pinned binaries** | `connector-protocol/v1` is already specified. It earns its place when a service needs code we have to ship, which no service in the catalogue does | | **Identity chaining** | ID-JAG and RFC 8693 against whichever issuer a deployment has. This is the step that makes it a platform rather than a utility, and the drafts are still moving — better to follow the RFC than predict it | | **vsock transport** | For microsandboxes with no filesystem shared with the host. Needs a guest-side shim, because `curl` cannot speak AF_VSOCK. The net-rule path works today | | **OAuth 1.0a** | Built for, then dropped. X is the only provider in the catalogue that offers it, recommends OAuth 2.0 instead, and does not support 1.0a for media upload at all — so it could not post an image. Nothing shipped needs it | *** ## The store key is only as good as the platform [Section titled “The store key is only as good as the platform”](#the-store-key-is-only-as-good-as-the-platform) **On Linux there is usually no OS keychain, so the key that encrypts your credentials sits in a file beside the ciphertext.** Anything that can read one can read the other, and the encryption then protects against a stolen disk rather than against another process running as the same user. `stk doctor` says so rather than hiding it: ```plaintext ! credential store key file beside the ciphertext — anything that can read one file can read the other; an OS keychain is not wired on this platform ``` On macOS the key comes from the login keychain and this warning does not appear. The difference matters most where it is least visible: a production token on a server is less well protected than the same token on a laptop, which is the opposite of what most people would assume. What you can do today: * `STK_PASSPHRASE` in the broker’s environment takes precedence over the file, so a key held by your init system — systemd `LoadCredential`, a secrets manager, a prompt at start — never touches the disk. * Run the broker as its own OS user with a `0700` home, which is the posture the design assumes anyway. * Treat a VPS credential as narrower in scope than a laptop one: shorter-lived, fewer scopes, and revoked on suspicion rather than on proof. What would close it properly is wiring a Linux keyring — libsecret or the kernel keyring — which is a platform integration rather than a fix, and is not done. ## Operational limits [Section titled “Operational limits”](#operational-limits) * **`stk run`’s per-session loopback proxy is not authenticated.** Only the fixed proxy of `stk serve --proxy-listen` requires a proxy key. Any local process that finds a `stk run` session’s port can use the routes that session allows, though it still receives no credential. * **The audit ledger rotates at 8 MB, keeping one generation.** An unbounded audit log on a small VPS is an outage. If you need more history, ship `audit.log` somewhere before it rotates. * **One client id per service, in the committed policy file.** SuperToolkit ships none: a shared client id would make every installation look like the same app to the provider. You register your own. * **The OAuth redirect must be a loopback URL.** The broker listens for the redirect itself, so a callback pointing anywhere else never reaches the machine — and one reachable from the network would let anybody on it deliver a code there. `127.0.0.1` and `localhost` both work, on any port and path. The default is `http://127.0.0.1:7837/callback`; an app that is already registered with a different loopback callback names it under `oauth2.redirect_uri` rather than being edited to suit us. * **A credential’s rotation is written back before the access token is returned.** If that write fails, the connect fails loudly — the alternative is a lockout hours later, nowhere near its cause. * **`stk handover` briefly puts the credential on the sealing machine.** The commands say so. The device grant and the web UI do not have that property, so prefer them when either is possible. ## Shared refresh ownership [Section titled “Shared refresh ownership”](#shared-refresh-ownership) On supported macOS and Linux hosts, token acquisition uses a stable OS-owned file lock. Process death releases it; elapsed time does not prove an owner died. Cache invalidation preserves lock files. If ownership or cache persistence is unavailable, acquisition fails explicitly instead of racing another refresh or returning an unpersisted access token. No additional refresh retries are introduced. Stop older broker processes before updating a store to this lock format. Known live old-format owners are refused, but concurrent old and new broker binaries sharing one store are not a supported migration. Do not remove a live cache lock file to bypass a refusal. Managed profiles must pin their broker version and account for old owned processes during upgrade and recovery. ## The staging deployment [Section titled “The staging deployment”](#the-staging-deployment) `deploy/staging/` runs the broker as user `stk` on the staging host, for a Salaam agent that runs under its own uid. It fronts one service, `git-public` (`auth: none`), and Salaam’s git is pointed at it through `~/.gitconfig`. That is configuration, not confinement: the agent runs commands as an ordinary user with network access, so `/usr/bin/git -c http.proxy= …` or any other client that ignores the proxy goes straight out, unrecorded. The broker bounds and records what goes *through* it. Enforcing that nothing goes around it needs egress filtering for the agent’s uid, which staging does not have yet. Fronted MCP servers can be served directly (`stk mcp serve `), each tool call decided and audited, and a host outside policy is decided by address (`egress:`) rather than passed through: staging declares `egress: public-only`, so nothing is tunnelled undecided. Its `fetch` server is `network: confined`: it runs in its own network namespace with only loopback, so a direct connection has no route. See the next section for what each mode costs. ## A fronted server’s own network: blocked, or only detected [Section titled “A fronted server’s own network: blocked, or only detected”](#a-fronted-servers-own-network-blocked-or-only-detected) `stk mcp serve` starts the server as the caller, with the proxy in its environment. Whether a server that ignores the proxy can go around it depends on `network:`: * **`confined`** (the default for a server with `egress`): the server runs in its own user and network namespace with only a loopback interface; a shim relays to the broker over a Unix socket. A direct connection has no route: **blocked**. If the namespace cannot be created, the server is not started. On Ubuntu 24.04 and later, `kernel.apparmor_restrict_unprivileged_userns=1` refuses it unless an AppArmor profile grants `userns` to the stk binary — an operator decision, not something stk installs. DNS lookups may still work through a resolver’s Unix socket (nss-resolve); connections cannot. * **`watched`**: the server’s sockets (and its descendants’) are polled every 50 ms from `/proc`. A TCP connection, or non-DNS UDP, to anything but the broker is **detected**: recorded in the audit as `netwatch:direct` with the address, and the server is stopped; every later call fails. It is not prevented — the first connection happens, and one that opens and closes between two polls is not seen. * **`host`**: configured, not confined — the same posture as any `stk run` child. **Measured: Go clients never proxy loopback.** Go’s `ProxyFromEnvironment` skips the proxy for `localhost` and loopback addresses, so a Go-based server fetching `http://127.0.0.1/…`, or following a redirect there, goes direct and the broker never sees it. A test keeps this (`TestMCPServeLoopbackBypassByAGoClientIsCaughtWhenWatched`): watched catches and stops it; only confined prevents it. Python’s httpx (used by `mcp-server-fetch`) does proxy loopback. ## Egress decisions [Section titled “Egress decisions”](#egress-decisions) * **Ports are not rules.** An allowed address is allowed on any port. * **Only `methods:` opens a tunnel.** An egress without `methods` decides by address and passes the tunnel through unopened, so the method and path of an HTTPS request are not seen or recorded, only the host and the address. With `methods` the tunnel is opened with the broker’s CA, which the client must trust; one that does not fails loudly. * **Approval-gated tools are refused by `stk mcp serve`**, with their rule id: holding a direct tool call open for a person is not built. The meta-tools (`stk mcp`) keep approval. * **The tool-call hint is the server’s own claim.** An unannotated tool defaults to approval, so is refused; a tool annotated read-only is allowed unless the policy says otherwise. Name each tool you allow in `capabilities:`. * **With a daemon, the decision is the daemon’s, but the caller runs the server.** An agent that can run commands can run the same server without stk. `stk mcp serve` bounds the server, not the agent. # What is measured > Three roadmap items that read "untested" or "unproven", closed with numbers and the machine they came from. Note This page is generated from `docs/measurements.md` in the repository, with the machine each figure came from. Three roadmap items once read “untested” or “unproven.” We replaced each assumption with a measurement, and you get the machine beside the number—a benchmark without its machine is a rumour. Reproduce with `go test ./e2e/ -run Measure -v`. That command reruns the body, mTLS, and latency measurements together, so you can compare your machine with the recorded baseline rather than taking the table on faith. **Machine:** darwin/arm64, 8 CPUs, go1.26.4. Taken 2026-10-15. Every figure is against a **local** upstream on loopback, which is the point: it isolates the broker’s own cost from the network’s. *** ## 1. Bodies above 64 KB — transparent [Section titled “1. Bodies above 64 KB — transparent”](#1-bodies-above-64-kb--transparent) The roadmap called this “unproven rather than broken”: the proxy was transparent at every size tested, but no endpoint had ever accepted a large upload. X’s media `APPEND` is multipart with segments up to 5 MB, so this is load-bearing for publishing work rather than theoretical. A random body is sent through the broker and hashed at both ends. | Size | Bytes received | SHA-256 matches | Credential | | ----- | -------------- | --------------- | ----------- | | 1 B | 1 | yes | substituted | | 64 KB | 65,536 | yes | substituted | | 1 MB | 1,048,576 | yes | substituted | | 8 MB | 8,388,608 | yes | substituted | **Finding: transparent at every size, and the credential is still substituted.** The substitution happens on headers, so the risk was a buffering bug reordering it; the test asserts the upstream saw the real credential at 8 MB as well as at 1 byte. Nothing above 8 MB has been tried, and nothing in the implementation buffers a whole body, so the next limit is the provider’s. One note for whoever reads the test: an earlier run reported the credential as `"Bearer"` and looked like a real defect. That was `%s` in `fmt.Sscanf` stopping at the space inside the header value — a measurement artifact, the fourth of its kind in this project. The upstream now answers tab-separated. ## 2. Brokered mTLS — does not work, and says so [Section titled “2. Brokered mTLS — does not work, and says so”](#2-brokered-mtls--does-not-work-and-says-so) The roadmap said “untested”, which is not the same as broken. An upstream demanding `RequireAndVerifyClientCert` was placed behind the broker. **Finding: the broker returns 502 and the client sees the failure.** The upstream’s log reads `tls: client didn't provide a certificate`; the client receives `supertoolkit: upstream unreachable`. The broker holds no client certificate, so it cannot complete the handshake on the operator’s behalf. This is the **safe** class of failure: loud, immediate, and nothing was sent. It is not fixed by configuration. A host requiring mTLS should be **tunnelled** rather than brokered — remove it from `services` and the broker passes its traffic through unopened, with the client’s own certificate intact. Brokering it would need a client certificate per service in the store, which is a feature and not a bug fix. ## 3. Latency — 79 µs median overhead [Section titled “3. Latency — 79 µs median overhead”](#3-latency--79-µs-median-overhead) The repository is about to claim speed in public, and the broker’s overhead had never been isolated. 300 requests after a 10-request warm-up, so the CONNECT and the TLS handshake are not counted as steady state — measuring those once as if they were is how a proxy gets blamed for a handshake. | Path | Median | p99 | | ------------------ | --------- | ---------- | | Direct to upstream | 56 µs | 95 µs | | Through the broker | 135 µs | 554 µs | | **Overhead** | **79 µs** | **459 µs** | **Finding: about 79 µs at the median, 459 µs at the 99th percentile.** For scale, a single packet round-trip to a provider in another region is 20–150 ms — between 250 and 1,900 times the median overhead. The broker’s cost is below the noise of any real network, which is what “fast” has to mean for a thing that sits in front of an API call. The p99 is six times the median, which is the cost of the broker being a second Go runtime scheduling point rather than anything structural. It has not been chased, because 459 µs is still a rounding error against a real request. The test asserts only that the brokered median stays within an order of magnitude of the direct one. A regression past that is a design change, not a slow afternoon. Taken together, the measurements give us three concrete boundaries: bodies were transparent through 8 MB, brokered mTLS failed loudly, and steady-state median overhead was 79 µs on the recorded machine. # Commands > Every stk command and flag, with the page that explains it. This is the exact command surface when you know what you want to do and need the spelling, flag, or deeper page. `stk help` (or `--help`, `-h`) prints the same list; `stk version` (or `--version`, `-v`) prints the version. ## Set up and connect [Section titled “Set up and connect”](#set-up-and-connect) Start here to create local state, add a service, and move credential material into the broker without putting it in command arguments. | Command | | | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `stk init` | create the local CA, store key and state directory, and a starter `supertoolkit.yaml` ([Install](/install/#first-run)); sealed credential files appear when services are connected | | `stk add ...` | add services, with safe default policy ([Services](/use/services/)) | | `stk connect ` | store a credential, read from stdin ([Connect](/connect/)) | | `stk connect --browser` | OAuth 2.0 authorization code with PKCE | | `stk connect --device` | the device grant, for a machine with no browser | | `stk handover key [--json]` | print this broker’s hand-over key, which can only seal | | `stk handover seal --to [--stdin]` | seal a credential for another broker, from this machine’s store or, with `--stdin`, from a pipe, so this machine needs no store | | `stk handover open ` | open a sealed envelope into this broker’s store | | `stk verify [--expect-login ] [--json]` | make one read call as the stored credential and print the login it acts as, or why it failed; non-zero on failure, and on a login other than `--expect-login`. For a GitHub App it also checks every configured repository is in the installation | | `stk revoke [--local]` | withdraw a credential, here and, where the provider offers it, at the provider. `--local` (or `--forget`) removes only the local copy. `stk forget` is the same command | ## Run an agent [Section titled “Run an agent”](#run-an-agent) These commands put policy and audit around an agent, an MCP server, or a single effect. | Command | | | ------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | | `stk run -- ` | 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.