@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.
- package/package.json +3 -1
- package/src/corpus/capability-map.md +72 -0
- package/src/corpus/cloudgrid-yaml.md +569 -0
- package/src/corpus/examples/app-with-data/index.md +24 -19
- package/src/corpus/templates/app-with-data/README.md +22 -19
- package/src/corpus/templates/app-with-data/cloudgrid.yaml +9 -9
- package/src/corpus/templates/app-with-data/index.md +38 -29
- package/src/corpus/templates/app-with-data/services/web/lib/db.js +10 -9
- package/src/corpus/templates/dashboard/cloudgrid.yaml +10 -0
- package/src/corpus/templates/dashboard/index.md +30 -0
- package/src/corpus/templates/deck/cloudgrid.yaml +10 -0
- package/src/corpus/templates/deck/index.md +30 -0
- package/src/corpus/templates/landing-page/cloudgrid.yaml +10 -0
- package/src/corpus/templates/landing-page/index.md +30 -0
- package/src/corpus/templates/report/cloudgrid.yaml +10 -0
- package/src/corpus/templates/report/index.md +30 -0
- package/src/corpus/templates/web-app/cloudgrid.yaml +10 -0
- package/src/corpus/templates/web-app/index.md +30 -0
- package/src/corpus/troubleshooting/persistent-apps.md +6 -6
- package/src/corpus/workflows/app-with-data.md +25 -18
- package/src/corpus/workflows/dashboard.md +5 -1
- package/src/corpus/workflows/landing-page.md +5 -1
- package/src/corpus/workflows/presentation.md +5 -1
- package/src/corpus/workflows/report.md +5 -1
- package/src/corpus/workflows/web-app.md +5 -1
- package/src/tools.js +2 -0
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: app-with-data
|
|
3
|
-
when:
|
|
4
|
-
|
|
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` + `
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
#
|
|
66
|
+
needs:
|
|
67
|
+
database: true
|
|
68
|
+
# cache: true # OPTIONAL — add only if the app needs Redis
|
|
65
69
|
```
|
|
66
|
-
**Declare the datastore with `
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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.
|
|
78
|
-
|
|
79
|
-
string; never commit a
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
module
|
|
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
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
|