# Set up Stacktree

You are being asked to set up Stacktree for the user. Follow these steps in
order, then ask them what they want to publish.

Stacktree turns HTML into a private, live URL that opens in any browser with
no account for the viewer. It is built for work an agent generates and a
person outside the chat needs to read: a report, an audit, a proposal, a
dashboard, a design. Links are private by default and replace in place, so a
URL you have already shared keeps showing the current version.

## Step 1 — install

If the user has npm, run:

```
npx stacktree-install
```

It signs them in through their browser, asks which agents to configure, and
writes the MCP config for each. Supported: Claude Code, Cursor, Codex CLI,
OpenCode, Amp.

If npm is not available, or their client supports remote MCP servers
directly, use the hosted server instead — no install, same tools:

```
https://api.stacktr.ee/mcp
```

For Claude.ai, that URL goes into the custom-connector dialog. For any client
that takes stdio MCP config by hand:

```json
{
  "mcpServers": {
    "stacktree": {
      "command": "npx",
      "args": ["-y", "stacktree-mcp"],
      "env": { "STACKTREE_API_KEY": "stk_live_..." }
    }
  }
}
```

If the client supports no MCP at all, the REST API works with the same key:
`POST https://api.stacktr.ee/v1/sites`
with `Authorization: Bearer $STACKTREE_API_KEY`. See https://stacktr.ee/docs.

## Step 2 — verify

Call `list_sites`. If it returns without an auth error, setup worked. If the
client needed a restart to load the MCP server, say so plainly rather than
retrying the call.

## Step 3 — know these five things

1. **Publish with `publish_html`.** Pass a complete HTML document. It returns
   `url`, `id` and `expires_at`. Surface the URL inline and tell the user
   when the link expires — read `expires_at`, do not assume permanence.
2. **Iterate with `update_site`, not a second publish.** Pass the previous
   `id`; the URL stays valid, so the link already sent to someone keeps
   working. A replace is also cheaper: it does not count as a new publish.
3. **Private is the default.** Every URL is unguessable and not crawlable.
   Add `password` for a passcode or use `set_email_gate` to restrict viewers
   to one company domain. Pass `public_slug` only when the user actually
   wants a discoverable address.
4. **File client work under a client space.** When the user names who the work
   is for ("send this to Acme"), pass `client: "Acme"` on `publish_html` —
   the space is created automatically. If the space has an address of its
   own, the response carries `client_url` on the user's domain, such as
   `acme.theiragency.com`. Prefer that link over the stacktr.ee one; it is
   the address their client bookmarks.
5. **Respect the plan, do not work around it.** The free plan allows 3 pages
   lifetime and caps expiry at 7 days. On HTTP 402 report the limit plainly
   and stop. Do not retry, and do not republish anonymously to dodge it.

## Step 4 — ask what to publish

Ask the user what they would like to publish first, and offer the cases this
is actually good at:

- A report, audit or proposal that should reach one client and nobody else.
- A dashboard or status page you regenerate — publish once, then
  `update_site` on the same URL so the recipient's bookmark stays live.
- Design directions or mockups an agent just produced, including a canvas
  from Claude Code's `/design`: the artboards are HTML, so a static copy
  goes behind a passcode on the user's own domain instead of a public link.
  Render a whole canvas directory to one publishable page first with the
  `design-to-stacktree` script that ships with the Stacktree skill.
- Anything you were about to hand over as a file attachment or a wall of
  pasted HTML.

If the user asks to make a published page look better, call
`get_design_guide` first and follow it — do not restyle a page that already
has a deliberate design.

Full documentation for agents: https://stacktr.ee/llms.txt
Human documentation: https://stacktr.ee/docs
