@cloudgrid-io/mcp 0.10.0 → 0.11.2

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.
@@ -1,7 +1,11 @@
1
1
  ---
2
2
  name: app-with-data
3
- when: The user wants an app that SAVES or PERSISTS data, shares state across users/sessions, has accounts/login, stores submissions, or needs a backend/API/database — e.g. a to-do list, a CRUD dashboard, a form that stores entries, a guestbook.
4
- summary: Build a real persistent Next.js + Mongo runtime app on the grid — edition-gate first, scaffold, put the app under services/web/, wire process.env.MONGODB_URL lazily, declare requires:[mongodb] (not needs:), deploy async, poll to a live URL.
3
+ when: to-do, task list, notes app, guestbook, CRUD app, form that SAVES/STORES submissions, anything that SAVES or PERSISTS data or shares state across users/sessions, sign-in/accounts, a backend/API/database — e.g. a to-do list, a CRUD dashboard, a form that stores entries, a guestbook. Needs a database → runtime → local edition.
4
+ needs: database
5
+ deploy: runtime
6
+ editions: local
7
+ capabilities_note: persistent — needs a database (Mongo). Runtime app, async build, local edition only. Declare the canonical `needs: { database: true }`; the deployer injects DATABASE_MONGODB_URL (+legacy MONGODB_URL).
8
+ summary: Build a real persistent Next.js + Mongo runtime app on the grid — edition-gate first, scaffold, put the app under services/web/, wire process.env.DATABASE_MONGODB_URL (legacy MONGODB_URL fallback) lazily, declare needs:{database:true} (not requires:), deploy async, poll to a live URL.
5
9
  ---
6
10
 
7
11
  # Workflow: app-with-data
@@ -44,7 +48,7 @@ the entity + `.cloudgrid/link.json` and writes a `cloudgrid.yaml` with an EMPTY
44
48
  `services: {}`. `plug` needs a linked directory, so run `init` FIRST.
45
49
 
46
50
  You then do two things: (a) write the app under **`services/web/`**, and (b) fill
47
- in `cloudgrid.yaml` to the shape below (`services.web` + `requires: [mongodb]`).
51
+ in `cloudgrid.yaml` to the shape below (`services.web` + `needs: { database: true }`).
48
52
 
49
53
  ## 4. Add the datastore + wire Mongo
50
54
 
@@ -59,27 +63,28 @@ in `cloudgrid.yaml` to the shape below (`services.web` + `requires: [mongodb]`).
59
63
  web:
60
64
  type: nextjs
61
65
  path: /
62
- requires:
63
- - mongodb # alias: db
64
- # - redis: private # OPTIONAL — add only if the app needs Redis
66
+ needs:
67
+ database: true
68
+ # cache: true # OPTIONAL — add only if the app needs Redis
65
69
  ```
66
- **Declare the datastore with `requires: [mongodb]` (NOT `needs:`)** — see the
67
- yaml comment in the template. The CLI warns `requires:` is deprecated, but the
68
- deployer only injects `MONGODB_URL` from `requires:`; `needs:` builds fine but
69
- injects NO DB connection (every request 500s). Keep `requires:` until the
70
- deployer honors `needs:`.
70
+ **Declare the datastore with `needs: { database: true }`** — this is the
71
+ canonical shape. The deployer provisions Mongo and injects
72
+ `DATABASE_MONGODB_URL` (plus the legacy `MONGODB_URL` alias) at dev-time and
73
+ runtime. `requires:` is the deprecated v1 alias; don't author new yaml with it,
74
+ and never set `needs:` and `requires:` together (the validator rejects it).
71
75
  2. Fetch the template for the Mongo wiring + CRUD shape:
72
76
  `gridctl_fetch("template", "app-with-data")`. It is a minimal, real
73
77
  Next.js + `mongodb`-driver to-do app under `services/web/`: a lazy client in
74
78
  `services/web/lib/db.js`, an App-Router GET/POST/DELETE route on a `todos`
75
79
  collection, and a page.
76
80
  3. Adapt it to the user's app (rename the collection, change the fields, adjust
77
- the UI). **Read the database from `process.env.MONGODB_URL`** — the grid
78
- injects that env var at dev-time and runtime. Never hardcode a connection
79
- string; never commit a secret.
80
- - **Put the DB connection behind a lazy getter — never read
81
- `process.env.MONGODB_URL` at module top level, or `next build` fails** (the
82
- module is imported for route analysis before the grid injects the var).
81
+ the UI). **Read the database from `process.env.DATABASE_MONGODB_URL`** (falling
82
+ back to the legacy `process.env.MONGODB_URL`) — the grid injects those env vars
83
+ at dev-time and runtime. Never hardcode a connection string; never commit a
84
+ secret.
85
+ - **Put the DB connection behind a lazy getter — never read the connection
86
+ string at module top level, or `next build` fails** (the module is imported
87
+ for route analysis before the grid injects the var).
83
88
  - (Optional) fetch `gridctl_fetch("example", "app-with-data")` for a slightly
84
89
  richer filled reference to imitate.
85
90
 
@@ -92,7 +97,9 @@ and sanity-check before deploying. Don't require it.
92
97
 
93
98
  - API keys / secrets → `gridctl_secrets`.
94
99
  - Non-secret config → `gridctl_env`.
95
- - Do **NOT** set `MONGODB_URL` or `REDIS_URL` yourself — the grid injects them.
100
+ - Do **NOT** set the DB/cache connection vars yourself (`DATABASE_MONGODB_URL`,
101
+ `CACHE_REDIS_URL`, or their legacy `MONGODB_URL` / `REDIS_URL` aliases) — the
102
+ grid injects them.
96
103
 
97
104
  ## 7. Deploy (async)
98
105
 
@@ -1,6 +1,10 @@
1
1
  ---
2
2
  name: dashboard
3
- when: The user wants to build a dashboard showing metrics, status, or KPIs with cards and charts.
3
+ when: dashboard, metrics, KPIs, stats page, status board, charts, analytics view — display-only (static data baked in).
4
+ needs: none
5
+ deploy: inspiration
6
+ editions: all
7
+ capabilities_note: static — no infrastructure, data is baked into the page. Publishes as an inspiration (instant, works on hosted) via gridctl_drop.
4
8
  summary: Fetch the dashboard template, fill it with the user's metrics and inline charts, deploy it, and return the live share URL.
5
9
  ---
6
10
 
@@ -1,6 +1,10 @@
1
1
  ---
2
2
  name: landing-page
3
- when: The user wants to build a landing page, marketing page, or product page for something.
3
+ when: landing page, marketing page, product page, hero page, coming-soon, waitlist, pricing page, portfolio, link-in-bio, event page.
4
+ needs: none
5
+ deploy: inspiration
6
+ editions: all
7
+ capabilities_note: static — no infrastructure. Publishes as an inspiration (instant, works on hosted) via gridctl_drop.
4
8
  summary: Fetch the landing-page template, fill it with the user's content, deploy it, and return the live share URL.
5
9
  ---
6
10
 
@@ -1,6 +1,10 @@
1
1
  ---
2
2
  name: presentation
3
- when: The user wants to build a presentation, slide deck, or set of slides about a topic.
3
+ when: slides, deck, pitch, presentation, slideshow.
4
+ needs: none
5
+ deploy: inspiration
6
+ editions: all
7
+ capabilities_note: static — no infrastructure. Publishes as an inspiration (instant, works on hosted) via gridctl_drop.
4
8
  summary: Fetch the deck template, fill it with the user's content, deploy it, and return the live share URL.
5
9
  ---
6
10
 
@@ -1,6 +1,10 @@
1
1
  ---
2
2
  name: report
3
- when: The user wants to build a report, one-pager, brief, or write-up with sections and data.
3
+ when: report, one-pager, summary, brief, whitepaper, case study, formatted document.
4
+ needs: none
5
+ deploy: inspiration
6
+ editions: all
7
+ capabilities_note: static — no infrastructure. Publishes as an inspiration (instant, works on hosted) via gridctl_drop.
4
8
  summary: Fetch the report template, fill it with the user's content, deploy it, and return the live share URL.
5
9
  ---
6
10
 
@@ -1,6 +1,10 @@
1
1
  ---
2
2
  name: web-app
3
- when: The user wants to build a small interactive web app, tool, calculator, or mini single-page application.
3
+ when: calculator, converter, generator, timer, quiz, interactive tool, mini-app, single-page tool, widget — anything computed client-side with no saved data.
4
+ needs: none
5
+ deploy: inspiration
6
+ editions: all
7
+ capabilities_note: static — no infrastructure, state lives only in memory. Publishes as an inspiration (instant, works on hosted) via gridctl_drop.
4
8
  summary: Fetch the web-app template, adapt its markup and inline JS to the user's tool, deploy it, and return the live share URL.
5
9
  ---
6
10
 
package/src/tools.js CHANGED
@@ -89,6 +89,8 @@ Operating rules:
89
89
  9. To modify an existing drop when you don't already have its HTML in context, first call gridctl_source to fetch the current HTML, apply your change, then call gridctl_drop/gridctl_plug with target_entity_id (the drop's entity_id) to update the SAME URL in place. Do not ask the user to paste the HTML back.
90
90
  10. Publishing a heavy or local file: in the local edition use the path parameter so it is read from disk (no inline size limit); never base64-encode HTML and never pass a file path (or an @-prefixed path) as html. If a drop looks empty, use gridctl_source to check what was actually published, then re-plug with the real HTML/path and target_entity_id.
91
91
  11. Persistence check: if the user needs to SAVE data, share state across users/sessions, log in, or store submissions, that's a runtime app-with-data (Mongo-backed), NOT a static page — static templates keep state only in memory and lose it on refresh. Use the app-with-data workflow. This requires the LOCAL edition (Claude Desktop/Code or the CLI); on the hosted edition, tell the user persistence isn't available there and offer a static version.
92
+ 12. To choose what to build: match the request against the workflow when: triggers and the capability-map (gridctl_fetch({kind:"doc", name:"capability-map"})). Pick the template whose needs: matches what the app requires (persistence → database; scheduled → cron; etc.). Static (needs: none) deploys as an inspiration (instant, any edition); anything needing needs: is a runtime (async, local edition).
93
+ 13. Before writing a cloudgrid.yaml, fetch the reference: gridctl_fetch({kind:"doc", name:"cloudgrid-yaml"}) — it has the full schema, the needs: vocabulary, and the requires-vs-needs caveat (the deployer does not inject from needs: yet, so a database/cache today uses requires: [mongodb] / requires: [redis]).
92
94
 
93
95
  Deploy is edition-dependent: on the hosted MCP call the drop tool with the HTML; on local MCP / CLI write the file and run the plug tool. An HTML page deploys synchronously, so you get a URL right away.`;
94
96