@cloudgrid-io/mcp 0.4.7 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudgrid-io/mcp",
3
- "version": "0.4.7",
4
- "description": "MCP server for CloudGrid. Two editions: a local stdio server (full toolset) and a hosted web server (light, CLI-free toolset) over MCP Streamable HTTP.",
3
+ "version": "0.5.0",
4
+ "description": "MCP server for CloudGrid. Three editions: a local stdio server (full toolset), a hosted web server (light, CLI-free toolset), and a public docs server (search_cloudgrid_documentation) over MCP Streamable HTTP.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "cloudgrid-mcp": "src/index.js"
@@ -23,6 +23,9 @@
23
23
  "smoke:redrop": "node test/smoke-redrop.mjs",
24
24
  "smoke:oauth": "node test/smoke-oauth.mjs",
25
25
  "test:auth": "node test/auth.test.mjs",
26
+ "smoke:docs": "node test/smoke-docs.mjs",
27
+ "start:docs": "node src/docs.js",
28
+ "snapshot:corpus": "node scripts/snapshot-corpus.mjs",
26
29
  "build:mcpb": "node scripts/build-mcpb.mjs"
27
30
  },
28
31
  "dependencies": {
@@ -0,0 +1,148 @@
1
+ # CloudGrid CLI
2
+
3
+ [![release](https://img.shields.io/badge/release-v0.9.13-black)](https://github.com/cloudgrid-io/cli/releases)
4
+ [![npm](https://img.shields.io/badge/npm-v0.9.13-cb3837)](https://www.npmjs.com/package/@cloudgrid-io/cli)
5
+ [![license](https://img.shields.io/badge/license-Apache--2.0-green)](./LICENSE)
6
+
7
+ > Draft for the public `cloudgrid-io/cli` distribution repo. Structure mirrors
8
+ > `higgsfield-ai/cli`, fit to CloudGrid. Source stays private in the monorepo; this
9
+ > repo holds the installer + docs only.
10
+
11
+ Build, ship, and run apps and agents on CloudGrid from your terminal. A directory or a
12
+ URL becomes a live, addressable thing in about 30 seconds — deploy, tail logs, share,
13
+ read feedback, all without leaving your shell.
14
+
15
+ ## Contents
16
+
17
+ - [Install](#install)
18
+ - [Quickstart](#quickstart)
19
+ - [Examples](#examples)
20
+ - [Commands](#commands)
21
+ - [Flags](#flags)
22
+ - [Updating](#updating)
23
+ - [Uninstall](#uninstall)
24
+ - [Troubleshooting](#troubleshooting)
25
+ - [Support](#support)
26
+ - [License](#license)
27
+
28
+ ## Install
29
+
30
+ **macOS / Linux — curl**
31
+ ```
32
+ curl -fsSL https://raw.githubusercontent.com/cloudgrid-io/cli/main/install.sh | sh
33
+ ```
34
+
35
+ **macOS / Linux — Homebrew**
36
+ ```
37
+ brew install cloudgrid-io/tap/cloudgrid
38
+ ```
39
+
40
+ **Cross-platform (incl. Windows) — npm**
41
+ ```
42
+ npm install -g @cloudgrid-io/cli
43
+ ```
44
+
45
+ **Manual** — download the latest from [Releases](https://github.com/cloudgrid-io/cli/releases), extract, and put `cloudgrid` on your `$PATH`.
46
+
47
+ Verify: `cloudgrid --version` and `cloudgrid doctor`. The shorthand `cg` works for every command.
48
+
49
+ ## Quickstart
50
+
51
+ ```
52
+ cloudgrid login # Google OAuth in the browser
53
+ cloudgrid whoami # confirm user + active org
54
+ cloudgrid plug # build + deploy the current directory, prints the live URL
55
+ cloudgrid open # open it in the browser
56
+ ```
57
+
58
+ No account needed to try a one-off share: `cloudgrid plug ./index.html` drops a public link.
59
+
60
+ ## Examples
61
+
62
+ ```
63
+ # Scaffold and deploy a Node app
64
+ cloudgrid init app my-api --type node
65
+ cd my-api && cloudgrid plug
66
+
67
+ # Deploy the current directory and tail its logs
68
+ cloudgrid plug
69
+ cloudgrid logs --since 10m
70
+
71
+ # Make a deploy public, then read feedback
72
+ cloudgrid visibility set my-api link
73
+ cloudgrid feedback
74
+
75
+ # Switch org, list what's on the grid
76
+ cloudgrid use atomic
77
+ cloudgrid grid
78
+ ```
79
+
80
+ ## Commands
81
+
82
+ | Command | Purpose |
83
+ |---|---|
84
+ | `login` / `logout` / `whoami` | Sign in (Google OAuth), sign out, show user + active org |
85
+ | `use [slug]` | Set or show the active org |
86
+ | `init <kind> <name>` | Register a new app or agent |
87
+ | `plug [target]` | Build + deploy (or redeploy); prints the live URL |
88
+ | `dev` | Run the linked entity locally with grid-injected resources |
89
+ | `status [name]` | Org dashboard, entity detail, or a deploy snapshot |
90
+ | `logs [name]` | Stream entity logs |
91
+ | `open [name]` | Open the entity URL in the browser |
92
+ | `info [name]` / `builds [name]` | Entity metadata; recent deploys |
93
+ | `visibility set <slug> <mode>` | private \| authenticated \| org \| link |
94
+ | `rollback` / `versions` | Roll back to a prior deploy; list/tag minted versions |
95
+ | `env` / `secrets` | Manage runtime env vars and secrets (secret values are never printed) |
96
+ | `grid` / `list` | List what's on your hub / org |
97
+ | `rename` / `delete` / `unplug` | Rename, archive, take off the grid |
98
+ | `pull` / `clone` / `fork` | Download source; clone or fork an entity |
99
+ | `feedback [message]` | Send feedback to the CloudGrid team |
100
+ | `brain refresh <name>` | Re-run Grid Brain metadata (description, tags, diagram) |
101
+ | `doctor` | Diagnostic checks (Node, Docker, API reachability, auth) |
102
+ | `completion <shell>` | Shell completion script |
103
+
104
+ Run `cloudgrid <command> --help` for the full flag set of any command.
105
+
106
+ ## Flags
107
+
108
+ Global:
109
+ - `-V, --version` — print the CLI version
110
+ - `-v, --verbose` — detailed output
111
+ - `-h, --help` — help for any command
112
+
113
+ Common per-command:
114
+ - `--org <slug>` — pick/override the org
115
+ - `--json` — machine-readable output (where supported)
116
+ - `--no-clipboard` / `--no-notify` — suppress clipboard copy / OS notification on `plug`
117
+ - `--since <dur>` / `--tail <n>` — `logs` window
118
+
119
+ ## Updating
120
+
121
+ ```
122
+ npm update -g @cloudgrid-io/cli # npm
123
+ brew upgrade cloudgrid # homebrew
124
+ ```
125
+ `cloudgrid doctor` warns when a newer version is available.
126
+
127
+ ## Uninstall
128
+
129
+ ```
130
+ npm uninstall -g @cloudgrid-io/cli # npm
131
+ brew uninstall cloudgrid # homebrew
132
+ rm -rf ~/.cloudgrid # remove stored credentials + config
133
+ ```
134
+
135
+ ## Troubleshooting
136
+
137
+ - **`cloudgrid: command not found`** — ensure the npm global bin (or Homebrew bin) is on `$PATH`; re-run the installer.
138
+ - **Auth errors / 401** — `cloudgrid login` again; check `cloudgrid whoami` shows the expected org, switch with `cloudgrid use <org>`.
139
+ - **Deploy fails** — run `cloudgrid doctor`; check `cloudgrid logs` and `cloudgrid status <name>` for the trace.
140
+
141
+ ## Support
142
+
143
+ - Skills + MCP: [cloudgrid-io/skills](https://github.com/cloudgrid-io/skills)
144
+ - Issues: [cloudgrid-io/cli/issues](https://github.com/cloudgrid-io/cli/issues)
145
+
146
+ ## License
147
+
148
+ Apache-2.0. See [LICENSE](./LICENSE).
@@ -0,0 +1,89 @@
1
+ # Cookbook
2
+
3
+ Canonical chains you can run end to end. Each step is one skill. Together they are
4
+ the "I built a thing and shipped it" loop.
5
+
6
+ ## Prerequisite
7
+
8
+ The CLI is installed and you are logged in:
9
+
10
+ ```
11
+ npm install -g @cloudgrid-io/cli
12
+ cloudgrid login
13
+ ```
14
+
15
+ ## The build-and-ship loop
16
+
17
+ ```
18
+ init -> plug -> logs -> share -> feedback
19
+ ```
20
+
21
+ ### 1. Scaffold
22
+
23
+ Register a new app and seed a static web service:
24
+
25
+ ```
26
+ cloudgrid init app my-thing --type static
27
+ ```
28
+
29
+ `--type` accepts `node`, `nextjs`, `python`, or `static`. For an agent, use
30
+ `cloudgrid init agent my-thing`.
31
+
32
+ ### 2. Deploy
33
+
34
+ From the project directory, deploy it:
35
+
36
+ ```
37
+ cloudgrid plug
38
+ ```
39
+
40
+ `cloudgrid plug` also takes a path or a URL. It builds and deploys, then prints the
41
+ live URL. This usually takes about 30 seconds.
42
+
43
+ ### 3. Watch the logs
44
+
45
+ ```
46
+ cloudgrid logs my-thing --follow
47
+ ```
48
+
49
+ Drop `--follow` for a one-time tail. `--since 5m` limits how far back to read.
50
+
51
+ ### 4. Share
52
+
53
+ Make the entity reachable by anyone with the link. The command prints the URL:
54
+
55
+ ```
56
+ cloudgrid visibility set my-thing link
57
+ ```
58
+
59
+ ### 5. Read feedback
60
+
61
+ ```
62
+ cloudgrid feedback list
63
+ ```
64
+
65
+ ## Share an artifact with no account
66
+
67
+ The fastest chain has one step and no login. Drop an HTML file, get a public URL:
68
+
69
+ ```
70
+ curl -sS -X POST https://api.cloudgrid.io/api/v2/drop/auto \
71
+ -F "artifact=@./index.html;type=text/html"
72
+ ```
73
+
74
+ The response includes `url` (the live link) and `claim_url` (sign in within 7 days
75
+ to keep it). This is what the `cloudgrid-drop` skill and the `cloudgrid_drop` MCP
76
+ tool do for you. It is anonymous and serves inspirations only; a full app needs the
77
+ signed-in `plug` flow above.
78
+
79
+ ## Shorter chains
80
+
81
+ - **Ship an existing directory:** `plug`
82
+ - **Deploy a URL as an inspiration:** `plug https://example.com`
83
+ - **Refresh discovery metadata after a change:** `cloudgrid brain refresh my-thing --wait`
84
+
85
+ ## Notes
86
+
87
+ - Every command uses the active org and linked entity when you omit the name. Run
88
+ `cloudgrid whoami` to see the active context.
89
+ - These skills wrap the CLI. Anything the CLI can do, a skill can drive.
@@ -0,0 +1,63 @@
1
+ # Install (for agents)
2
+
3
+ You are an agent. These are steps to execute, not prose to summarize. Run them in
4
+ order. Stop and ask the user only where a step says to.
5
+
6
+ ## 1. Ensure the CLI is present
7
+
8
+ Check whether `cloudgrid` is on `$PATH`:
9
+
10
+ ```
11
+ cloudgrid --version
12
+ ```
13
+
14
+ If that fails, install it:
15
+
16
+ ```
17
+ npm install -g @cloudgrid-io/cli
18
+ ```
19
+
20
+ ## 2. Ensure the user is logged in
21
+
22
+ ```
23
+ cloudgrid whoami
24
+ ```
25
+
26
+ If that fails, tell the user to run `cloudgrid login` and wait for them to confirm.
27
+ Do not attempt to log in for them. Do not invent an auth flow.
28
+
29
+ ## 3. Confirm the skills are available
30
+
31
+ The skills live in this repo, one directory per skill, each with a `SKILL.md`.
32
+ Load the `SKILL.md` for the action the user wants:
33
+
34
+ - `skills/drop/SKILL.md` — share an artifact, get a URL (no login needed)
35
+ - `skills/login/SKILL.md` — sign in, with or without the CLI
36
+ - `skills/claim/SKILL.md` — claim an anonymous drop into the account
37
+ - `skills/init/SKILL.md` — scaffold a new app or agent
38
+ - `skills/plug/SKILL.md` — deploy a directory or URL
39
+ - `skills/logs/SKILL.md` — tail logs
40
+ - `skills/share/SKILL.md` — make an entity shareable
41
+ - `skills/feedback/SKILL.md` — read the feedback feed
42
+ - `skills/brain/SKILL.md` — refresh Grid Brain metadata
43
+
44
+ ## 4. Follow the skill
45
+
46
+ Each `SKILL.md` carries its own steps. Follow them exactly. The common rules:
47
+
48
+ - Wrap only the `cloudgrid` CLI. Do not call the API directly.
49
+ - Detect the user's language from their first message and reply in it. Keep
50
+ technical flags in English.
51
+ - Print results concisely: URLs and short summaries. Never dump raw JSON or IDs.
52
+ - Pick sane defaults. Ask one thing at a time, only when something is genuinely
53
+ missing.
54
+
55
+ ## 5. The canonical chain
56
+
57
+ For a full build-and-ship loop, run the skills in this order:
58
+
59
+ ```
60
+ init -> plug -> logs -> share -> feedback
61
+ ```
62
+
63
+ See `COOKBOOK.md` for the worked example.
@@ -0,0 +1,117 @@
1
+ # Install
2
+
3
+ CloudGrid Skills work in any agent that reads `SKILL.md` files. The steps below
4
+ cover the CLI prerequisite, then each agent.
5
+
6
+ ## Prerequisite: the CloudGrid CLI
7
+
8
+ Every skill drives the `cloudgrid` CLI. Install it once and log in:
9
+
10
+ ```
11
+ npm install -g @cloudgrid-io/cli
12
+ cloudgrid login
13
+ ```
14
+
15
+ `cloudgrid whoami` confirms you are logged in.
16
+
17
+ ## Add the skills
18
+
19
+ Pick the method that matches your agent.
20
+
21
+ ### Any agent (gh skill extension)
22
+
23
+ ```
24
+ gh skill install cloudgrid-io/skills
25
+ ```
26
+
27
+ ### Any agent (skills CLI)
28
+
29
+ ```
30
+ npx skills add cloudgrid-io/skills
31
+ ```
32
+
33
+ ### Claude Code
34
+
35
+ ```
36
+ /plugin marketplace add cloudgrid-io/skills
37
+ ```
38
+
39
+ The marketplace manifest lives in `.claude-plugin/`.
40
+
41
+ ### Codex
42
+
43
+ Three routes:
44
+
45
+ ```
46
+ codex plugin marketplace add cloudgrid-io/skills # plugin (manifest: .codex-plugin/)
47
+ npx skills add cloudgrid-io/skills -a codex # skills only (-> ~/.agents/skills)
48
+ ```
49
+
50
+ Or the MCP server, in `~/.codex/config.toml` — local or the hosted URL:
51
+
52
+ ```toml
53
+ [mcp_servers.cloudgrid]
54
+ command = "npx"
55
+ args = ["-y", "@cloudgrid-io/mcp"]
56
+
57
+ # or remote, nothing installed:
58
+ # [mcp_servers.cloudgrid]
59
+ # url = "https://mcp.cloudgrid.io/mcp"
60
+ ```
61
+
62
+ ### Cursor
63
+
64
+ Cursor reads Agent Skills natively (v2.4+):
65
+
66
+ ```
67
+ npx skills add cloudgrid-io/skills -a cursor # -> ~/.cursor/skills + ~/.agents/skills
68
+ ```
69
+
70
+ Or install the plugin from Cursor's in-app marketplace (manifest: `.cursor-plugin/`).
71
+ Or the MCP server, in `~/.cursor/mcp.json`:
72
+
73
+ ```json
74
+ { "mcpServers": { "cloudgrid": { "command": "npx", "args": ["-y", "@cloudgrid-io/mcp"] } } }
75
+ ```
76
+
77
+ Remote variant, nothing installed: `{ "mcpServers": { "cloudgrid": { "url": "https://mcp.cloudgrid.io/mcp" } } }`
78
+
79
+ ### Manual
80
+
81
+ ```
82
+ git clone https://github.com/cloudgrid-io/skills.git
83
+ ```
84
+
85
+ Then point your agent at the cloned directory.
86
+
87
+ ## MCP server
88
+
89
+ The `@cloudgrid-io/mcp` package is published on npm:
90
+
91
+ ```
92
+ npx -y @cloudgrid-io/mcp
93
+ ```
94
+
95
+ It wraps the same `cloudgrid` CLI and uses the same credentials, so no extra login
96
+ is needed. Remote-capable clients can point at `https://mcp.cloudgrid.io/mcp`
97
+ instead. See [USAGE.md](USAGE.md) for per-client snippets.
98
+
99
+ ### Claude Desktop — one-click install
100
+
101
+ Claude Desktop users can install the MCP as a Desktop Extension with no terminal,
102
+ no Node, and no JSON editing. Download the bundle and double-click it (or in Claude
103
+ Desktop: Settings, Extensions, Install from file):
104
+
105
+ ```
106
+ https://github.com/cloudgrid-io/mcp/releases/latest/download/cloudgrid.mcpb
107
+ ```
108
+
109
+ The bundle carries the full local toolset (including the `cloudgrid` CLI), so deploy
110
+ and secrets tools work without a separate install. Sign in from chat with the
111
+ `cloudgrid_login` tool on first use.
112
+
113
+ ## For agents
114
+
115
+ If you are an agent reading this to install the skills yourself, read
116
+ [INSTALL_FOR_AGENTS.md](INSTALL_FOR_AGENTS.md) instead. It is written as steps you
117
+ can execute directly.
@@ -0,0 +1,49 @@
1
+ ---
2
+ version: 0.2.0
3
+ name: brain
4
+ description: |
5
+ Refresh a CloudGrid entity's Grid Brain metadata. Use when the user wants to
6
+ re-classify an entity, regenerate its description, tags, or diagram, or update
7
+ how it appears in discovery after a change. Wraps cloudgrid brain refresh.
8
+ argument-hint: "[name]"
9
+ allowed-tools: Bash
10
+ ---
11
+
12
+ # CloudGrid Brain
13
+
14
+ Re-run the Grid Brain hooks for an entity to re-classify its description, tags, and
15
+ diagram. Use this after a change so discovery reflects the current state. Wraps
16
+ `cloudgrid brain refresh`.
17
+
18
+ ## Step 0 — Bootstrap
19
+
20
+ 1. If `cloudgrid` is not on `$PATH`: `npm install -g @cloudgrid-io/cli`
21
+ 2. If `cloudgrid whoami` fails: ask the user to run `cloudgrid login`. Wait for
22
+ confirmation.
23
+
24
+ ## UX rules
25
+
26
+ - Be concise. Report what changed, not the full hook trace.
27
+ - Detect the user's language from their first message and reply in it. Keep
28
+ technical flags in English.
29
+
30
+ ## How to run it
31
+
32
+ ```
33
+ cloudgrid brain refresh my-thing --wait
34
+ ```
35
+
36
+ `--wait` polls until the refresh finishes, up to about 60 seconds. Without it, the
37
+ refresh runs in the background and the command returns right away. Use `--wait`
38
+ when the user wants to see the result now.
39
+
40
+ Other flags:
41
+
42
+ - `--org <slug>` — target an entity in another org.
43
+ - `--json` — machine-readable output.
44
+
45
+ ## Reading the output
46
+
47
+ The refresh reports each hook: classify (description and tags), identification, and
48
+ the diagram. Summarize the outcome in one line, for example "Re-classified with 3
49
+ tags." Suggest `cloudgrid status <name>` if the user wants the full updated entity.
@@ -0,0 +1,53 @@
1
+ ---
2
+ version: 0.2.0
3
+ name: claim
4
+ description: |
5
+ Claim an anonymous CloudGrid drop into the user's account. Use when the user
6
+ dropped something anonymously and now wants to keep it, own it, or stop it from
7
+ expiring after signing in. The public URL does not change.
8
+ argument-hint: "[claim-url-or-token]"
9
+ allowed-tools: Bash
10
+ ---
11
+
12
+ # CloudGrid Claim
13
+
14
+ Turn an anonymous drop into an owned one. After an anonymous drop, the user has a
15
+ `claim_url` (or token). Once they sign in, claiming transfers ownership to them and
16
+ extends the expiry from 7 days to 30. The shareable URL stays the same, so any link
17
+ already shared keeps working.
18
+
19
+ ## Step 0 — sign in first
20
+
21
+ Claiming needs an identity. If the user is not signed in, run the `cloudgrid:login`
22
+ skill (or `cloudgrid login` with the CLI) first.
23
+
24
+ ## What you need
25
+
26
+ The claim token from the anonymous drop. It is the `token` query parameter inside
27
+ the `claim_url` the drop returned, for example
28
+ `https://console.cloudgrid.io/claim?token=<TOKEN>`.
29
+
30
+ ## How to run it
31
+
32
+ ```
33
+ JWT=$(jq -r .jwt ~/.cloudgrid/credentials 2>/dev/null)
34
+ # TOKEN is the claim token (from claim_url's ?token=...)
35
+ curl -sS -X POST https://api.cloudgrid.io/api/v2/anon-claim \
36
+ -H "Authorization: Bearer $JWT" -H "Content-Type: application/json" \
37
+ -d "{\"claim_token\":\"$TOKEN\"}"
38
+ ```
39
+
40
+ The response is `{ "claimed": [ { "url", "new_expires_at" }, ... ] }`.
41
+
42
+ ## Reading the result
43
+
44
+ - A non-empty `claimed` list means it worked. Tell the user the drop is now theirs,
45
+ the URL is unchanged, and the new expiry.
46
+ - An empty `claimed` list means there was nothing to claim — it may already be
47
+ claimed or expired. Say so plainly.
48
+
49
+ ## Notes
50
+
51
+ - One token claims one drop. To claim several, repeat with each token.
52
+ - The MCP `cloudgrid_claim` tool does this for you, and remembers the token from the
53
+ last anonymous drop so you can claim with no arguments.
@@ -0,0 +1,111 @@
1
+ ---
2
+ version: 0.2.0
3
+ name: drop
4
+ description: |
5
+ Share an artifact and get a public URL. Use when the user wants to share,
6
+ publish, send, or deploy an HTML page or file, or wants a link for a friend.
7
+ Works with no login (anonymous, 7-day, claimable later) or signed in (published
8
+ into the user's org, owned, 30-day). Inspirations only.
9
+ argument-hint: "[file]"
10
+ allowed-tools: Bash
11
+ ---
12
+
13
+ # CloudGrid Drop
14
+
15
+ Publish an artifact and get a shareable URL — with no account and no CLI. This is
16
+ the fastest path from "I made a thing" to "here is a link."
17
+
18
+ It calls the CloudGrid API directly. It does **not** use the `cloudgrid` CLI and it
19
+ does **not** require login. That is the point: anyone can drop.
20
+
21
+ ## When to use this vs cloudgrid:plug
22
+
23
+ - **Drop (this skill):** the user is not signed in, or just wants a quick public
24
+ link for an HTML page or file. Anonymous. Inspirations only.
25
+ - **Plug (`cloudgrid:plug`):** the user is signed in and wants a full app deploy in
26
+ their own org. Uses the CLI.
27
+
28
+ If the user is signed in and asks to "share" a static artifact, this skill still
29
+ works and is faster; offer `cloudgrid:plug` only when they want an app.
30
+
31
+ ## UX rules
32
+
33
+ - Be concise. The result the user wants is the URL. Print it plainly.
34
+ - Detect the user's language from their first message and reply in it.
35
+ - Do not ask the user to log in. The whole value here is that they do not have to.
36
+
37
+ ## How to run it
38
+
39
+ You need a single HTML file. If the user gave you inline HTML, write it to a file
40
+ first. The content must be a full HTML document (start with `<!doctype html>` or
41
+ `<html>`); if you only have a fragment, wrap it in a minimal document. HTML is
42
+ capped at 2 MB for anonymous drops.
43
+
44
+ Then POST it:
45
+
46
+ ```
47
+ curl -sS -X POST https://api.cloudgrid.io/api/v2/drop/auto \
48
+ -F "artifact=@/path/to/index.html;type=text/html"
49
+ ```
50
+
51
+ The response is JSON. Read two fields:
52
+
53
+ - `url` — the live, shareable link. Give this to the user.
54
+ - `claim_url` — the link to sign in and keep it past the 7-day expiry.
55
+
56
+ ## If the user is signed in
57
+
58
+ A signed-in user can publish into their own org instead of anonymously — the drop
59
+ is owned, lasts 30 days, and needs no claim. Add their token and org to the same
60
+ request:
61
+
62
+ ```
63
+ JWT=$(jq -r .jwt ~/.cloudgrid/credentials 2>/dev/null)
64
+ ORG=$(grep -E '^\s*active_org_slug:' ~/.cloudgrid/config.yaml | awk '{print $2}')
65
+ curl -sS -X POST https://api.cloudgrid.io/api/v2/drop/auto \
66
+ -H "Authorization: Bearer $JWT" -H "X-CloudGrid-Org: $ORG" \
67
+ -F "artifact=@/path/to/index.html;type=text/html" -F "org_slug=$ORG"
68
+ ```
69
+
70
+ The response has `owned_by: "authenticated"` and no `claim_url`. If the user is a
71
+ member of several orgs and `X-CloudGrid-Org` is missing, the API replies with the
72
+ list of orgs to choose from. The MCP `cloudgrid_drop` tool does this automatically
73
+ when credentials are present.
74
+
75
+ ## Re-dropping (update in place)
76
+
77
+ A re-drop of the same artifact updates it in place — same URL, new version, views
78
+ and reactions intact. The platform matches ownership through the anon-session
79
+ cookie, so keep a cookie jar across drops:
80
+
81
+ ```
82
+ curl -sS -c jar.txt -X POST https://api.cloudgrid.io/api/v2/drop/auto \
83
+ -F "artifact=@index.html;type=text/html" # first drop
84
+ curl -sS -b jar.txt -X POST https://api.cloudgrid.io/api/v2/drop/auto \
85
+ -F "previous_id=<entity_id from the first response>" \
86
+ -F "artifact=@index.html;type=text/html" # re-drop
87
+ ```
88
+
89
+ Send `previous_id` before the artifact part. Read the status:
90
+
91
+ - `200` — updated in place; the same `url` now serves the new bytes.
92
+ - `202` — no change; this exact content is already live.
93
+ - `201` — created new: no `previous_id`, or the previous drop was claimed, expired,
94
+ or not yours — the server falls back to create and never hard-fails.
95
+
96
+ Omit `previous_id` to start a separate new drop. The MCP `cloudgrid_drop` tool does
97
+ all of this for you (re-drops update in place; `fresh: true` forces a new one).
98
+
99
+ ## After the drop
100
+
101
+ Print the `url` on its own line, by itself, so it can be copied in one go. Then add
102
+ one line of context: an anonymous drop lasts 7 days and can be claimed to keep it;
103
+ a signed-in drop is already owned. Do not bury the URL in prose.
104
+
105
+ ## Limits and errors
106
+
107
+ - Anonymous drops are **inspirations only**. A full app needs sign-in — if the
108
+ artifact is an app, the API returns 401; switch to `cloudgrid:plug`.
109
+ - HTML over 2 MB is rejected. Trim it or suggest signing in.
110
+ - There is a per-IP and per-device daily cap. If you hit 429, tell the user to try
111
+ again later.