@cloudgrid-io/mcp 0.20.20 → 0.20.22
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 +2 -1
- package/src/corpus/capability-map.md +1 -1
- package/src/corpus/cloudgrid-yaml.md +3 -3
- package/src/corpus/examples/ai-app/index.md +20 -21
- package/src/corpus/templates/_cloudgrid.yaml.reference +2 -2
- package/src/corpus/templates/admin-dashboard/cloudgrid.yaml +2 -2
- package/src/corpus/templates/ai-app/README.md +18 -13
- package/src/corpus/templates/ai-app/cloudgrid.yaml +2 -2
- package/src/corpus/templates/ai-app/index.md +23 -18
- package/src/corpus/templates/ai-app/services/web/app/api/chat/route.js +11 -8
- package/src/corpus/templates/ai-app/services/web/package.json +1 -1
- package/src/corpus/templates/ai-knowledge-base/AGENTS.md +19 -21
- package/src/corpus/templates/ai-knowledge-base/README.md +1 -1
- package/src/corpus/templates/ai-knowledge-base/cloudgrid.yaml +2 -2
- package/src/corpus/templates/ai-knowledge-base/index.md +2 -2
- package/src/corpus/templates/analytics-dashboard/cloudgrid.yaml +2 -2
- package/src/corpus/templates/api-dashboard/cloudgrid.yaml +2 -2
- package/src/corpus/templates/api-docs/cloudgrid.yaml +2 -2
- package/src/corpus/templates/api-service/cloudgrid.yaml +2 -2
- package/src/corpus/templates/app-with-data/cloudgrid.yaml +2 -2
- package/src/corpus/templates/appointment-booking/AGENTS.md +1 -1
- package/src/corpus/templates/appointment-booking/cloudgrid.yaml +2 -2
- package/src/corpus/templates/approval-workflow/AGENTS.md +2 -2
- package/src/corpus/templates/approval-workflow/cloudgrid.yaml +2 -2
- package/src/corpus/templates/billing-dashboard/AGENTS.md +2 -2
- package/src/corpus/templates/billing-dashboard/cloudgrid.yaml +2 -2
- package/src/corpus/templates/blog-cms/cloudgrid.yaml +2 -2
- package/src/corpus/templates/booking-system/AGENTS.md +2 -2
- package/src/corpus/templates/booking-system/cloudgrid.yaml +2 -2
- package/src/corpus/templates/booking-system/index.md +1 -1
- package/src/corpus/templates/calendar-scheduler/AGENTS.md +1 -1
- package/src/corpus/templates/calendar-scheduler/cloudgrid.yaml +2 -2
- package/src/corpus/templates/calendar-scheduler/index.md +1 -1
- package/src/corpus/templates/changelog/cloudgrid.yaml +2 -2
- package/src/corpus/templates/company-website/cloudgrid.yaml +2 -2
- package/src/corpus/templates/course-platform/AGENTS.md +2 -2
- package/src/corpus/templates/course-platform/cloudgrid.yaml +2 -2
- package/src/corpus/templates/crm/cloudgrid.yaml +2 -2
- package/src/corpus/templates/dashboard/cloudgrid.yaml +2 -2
- package/src/corpus/templates/deck/cloudgrid.yaml +2 -2
- package/src/corpus/templates/directory/cloudgrid.yaml +2 -2
- package/src/corpus/templates/docs-site/cloudgrid.yaml +2 -2
- package/src/corpus/templates/erp/AGENTS.md +2 -2
- package/src/corpus/templates/erp/cloudgrid.yaml +2 -2
- package/src/corpus/templates/erp/index.md +1 -1
- package/src/corpus/templates/event-board/cloudgrid.yaml +2 -2
- package/src/corpus/templates/expense-tracker/cloudgrid.yaml +2 -2
- package/src/corpus/templates/feature-request-board/cloudgrid.yaml +2 -2
- package/src/corpus/templates/financial-dashboard/cloudgrid.yaml +2 -2
- package/src/corpus/templates/forum/AGENTS.md +3 -3
- package/src/corpus/templates/forum/cloudgrid.yaml +2 -2
- package/src/corpus/templates/hr-portal/AGENTS.md +1 -1
- package/src/corpus/templates/hr-portal/cloudgrid.yaml +2 -2
- package/src/corpus/templates/internal-tools-portal/AGENTS.md +2 -2
- package/src/corpus/templates/internal-tools-portal/cloudgrid.yaml +2 -2
- package/src/corpus/templates/inventory/cloudgrid.yaml +2 -2
- package/src/corpus/templates/invoice/cloudgrid.yaml +2 -2
- package/src/corpus/templates/job-board/cloudgrid.yaml +2 -2
- package/src/corpus/templates/kanban/cloudgrid.yaml +2 -2
- package/src/corpus/templates/landing-page/cloudgrid.yaml +2 -2
- package/src/corpus/templates/lms/AGENTS.md +3 -3
- package/src/corpus/templates/lms/cloudgrid.yaml +2 -2
- package/src/corpus/templates/marketplace/AGENTS.md +1 -1
- package/src/corpus/templates/marketplace/cloudgrid.yaml +2 -2
- package/src/corpus/templates/marketplace/index.md +1 -1
- package/src/corpus/templates/membership-site/AGENTS.md +1 -1
- package/src/corpus/templates/membership-site/cloudgrid.yaml +2 -2
- package/src/corpus/templates/monitoring-dashboard/cloudgrid.yaml +2 -2
- package/src/corpus/templates/online-store/AGENTS.md +1 -1
- package/src/corpus/templates/online-store/cloudgrid.yaml +2 -2
- package/src/corpus/templates/portfolio/cloudgrid.yaml +2 -2
- package/src/corpus/templates/product-catalog/cloudgrid.yaml +2 -2
- package/src/corpus/templates/product-launch/cloudgrid.yaml +2 -2
- package/src/corpus/templates/project-management/cloudgrid.yaml +2 -2
- package/src/corpus/templates/property-listings/cloudgrid.yaml +2 -2
- package/src/corpus/templates/quiz-platform/cloudgrid.yaml +2 -2
- package/src/corpus/templates/report/cloudgrid.yaml +2 -2
- package/src/corpus/templates/restaurant-reservations/AGENTS.md +2 -2
- package/src/corpus/templates/restaurant-reservations/cloudgrid.yaml +2 -2
- package/src/corpus/templates/revenue-dashboard/cloudgrid.yaml +2 -2
- package/src/corpus/templates/saas-marketing/cloudgrid.yaml +2 -2
- package/src/corpus/templates/semantic-search/cloudgrid.yaml +1 -1
- package/src/corpus/templates/simple-semantic-search/cloudgrid.yaml +3 -3
- package/src/corpus/templates/status-page/cloudgrid.yaml +2 -2
- package/src/corpus/templates/subscription-management/AGENTS.md +1 -1
- package/src/corpus/templates/subscription-management/cloudgrid.yaml +2 -2
- package/src/corpus/templates/task-manager/cloudgrid.yaml +2 -2
- package/src/corpus/templates/ticket-system/cloudgrid.yaml +2 -2
- package/src/corpus/templates/time-tracking/cloudgrid.yaml +2 -2
- package/src/corpus/templates/travel-booking/AGENTS.md +2 -2
- package/src/corpus/templates/travel-booking/cloudgrid.yaml +2 -2
- package/src/corpus/templates/travel-booking/index.md +1 -1
- package/src/corpus/templates/waitlist/cloudgrid.yaml +2 -2
- package/src/corpus/templates/web-app/cloudgrid.yaml +2 -2
- package/src/corpus/workflows/ai-app.md +13 -9
- package/src/corpus/workflows/ai-knowledge-base.md +15 -12
- package/src/tools/constants.js +1 -1
- package/src/tools/register.js +22 -14
- package/src/tools.js +1 -1
|
@@ -102,7 +102,7 @@ name: web-app
|
|
|
102
102
|
# # disk — persistent FS mount (PVC). Injects DISK_PATH. Pins to 1 replica.
|
|
103
103
|
# # true | { size: 1Gi, mount: /var/data } (forbidden: /proc /sys /dev)
|
|
104
104
|
# disk: true
|
|
105
|
-
# # ai — AI Gateway via @cloudgrid-io/
|
|
105
|
+
# # ai — AI Gateway via @cloudgrid-io/runtime. Injects RUNTIME_GATEWAY_URL. true | false.
|
|
106
106
|
# ai: true
|
|
107
107
|
|
|
108
108
|
|
|
@@ -198,7 +198,7 @@ services:
|
|
|
198
198
|
# path: /api/health
|
|
199
199
|
# expected: "200"
|
|
200
200
|
# Static runtime env vars (strings). Reserved: PORT, APP_NAME, SERVICE_NAME,
|
|
201
|
-
# NODE_ENV, MONGODB_URL, REDIS_URL,
|
|
201
|
+
# NODE_ENV, MONGODB_URL, REDIS_URL, RUNTIME_GATEWAY_URL, N8N_WEBHOOK_URL, CLOUDGRID_*.
|
|
202
202
|
# env:
|
|
203
203
|
# LOG_LEVEL: info
|
|
204
204
|
# Sibling services/private resources that must be Ready first (no cron, no cycles).
|
|
@@ -4,8 +4,8 @@ when: chatbot, AI assistant, Q&A bot, conversational app, support bot, ask-me-an
|
|
|
4
4
|
needs: ai, database
|
|
5
5
|
deploy: runtime
|
|
6
6
|
editions: local
|
|
7
|
-
capabilities_note: AI chatbot — needs ai (the grid AI gateway) + a database (Mongo) for chat history. Next.js App Router app. Uses @cloudgrid-io/
|
|
8
|
-
summary: Build an AI chatbot on the grid — a Next.js app that calls @cloudgrid-io/
|
|
7
|
+
capabilities_note: AI chatbot — needs ai (the grid AI gateway) + a database (Mongo) for chat history. Next.js App Router app. Uses @cloudgrid-io/runtime runtime.ai.chat({ model, messages }) — zero-config in-grid identity (the SDK reads RUNTIME_GATEWAY_URL automatically; chat needs a model; no API key). Runtime app, async build, local edition only. Declare `needs: { ai: true, database: true }`. (RAG over your own docs needs `needs: { vector: pgvector }` — now available, #1545 shipped (verified live 2026-07-16); this template ships the plain chatbot without it.)
|
|
8
|
+
summary: Build an AI chatbot on the grid — a Next.js app that calls @cloudgrid-io/runtime runtime.ai.chat({ model, messages }) (zero-config in-grid auth, reads RUNTIME_GATEWAY_URL, no key) and persists the conversation to grid-shared Mongo. Edition-gate first, scaffold, put the app under services/web/, declare needs:{ai:true,database:true}, read DATABASE_MONGODB_URL lazily, deploy async, poll to a live URL.
|
|
9
9
|
---
|
|
10
10
|
|
|
11
11
|
# Workflow: ai-app
|
|
@@ -80,15 +80,19 @@ ai: true, database: true }`).
|
|
|
80
80
|
(`app/api/chat/route.js`, `export const dynamic = "force-dynamic"`) that reads
|
|
81
81
|
the user message, calls the AI gateway, persists the exchange to Mongo, and
|
|
82
82
|
returns the reply.
|
|
83
|
-
3. **Call the AI gateway with `@cloudgrid-io/
|
|
83
|
+
3. **Call the AI gateway with `@cloudgrid-io/runtime`** — zero config, no API key:
|
|
84
84
|
```js
|
|
85
|
-
import {
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
|
|
85
|
+
import { runtime } from "@cloudgrid-io/runtime";
|
|
86
|
+
// Chat expects a model and returns { text }. No key, no baseURL.
|
|
87
|
+
const { text: reply } = await runtime.ai.chat({
|
|
88
|
+
model: "claude-haiku",
|
|
89
|
+
messages: [{ role: "user", content: text }],
|
|
90
|
+
});
|
|
89
91
|
```
|
|
90
|
-
The SDK
|
|
91
|
-
|
|
92
|
+
The SDK reads `RUNTIME_GATEWAY_URL` (injected by the grid) and the in-grid
|
|
93
|
+
identity automatically — **do NOT set an API key or reference the env var.**
|
|
94
|
+
`chat` needs a `model`. It only works inside a deployed grid app (or under
|
|
95
|
+
`grid dev`).
|
|
92
96
|
4. **Persist the exchange to Mongo** — read `process.env.DATABASE_MONGODB_URL`
|
|
93
97
|
(falling back to the legacy `process.env.MONGODB_URL`) **lazily inside the
|
|
94
98
|
getter, never at module top level**, or `next build` fails (the module is
|
|
@@ -5,7 +5,7 @@ needs: ai+database
|
|
|
5
5
|
deploy: runtime
|
|
6
6
|
editions: local
|
|
7
7
|
kind: blueprint
|
|
8
|
-
capabilities_note: "persistent RAG — needs ai + database. Runtime app, async build, local edition only. Declare needs:{ai:true, database:true}; the deployer injects
|
|
8
|
+
capabilities_note: "persistent RAG — needs ai + database. Runtime app, async build, local edition only. Declare needs:{ai:true, database:true}; the deployer injects RUNTIME_GATEWAY_URL (AI Gateway via @cloudgrid-io/runtime — works today) and DATABASE_MONGODB_URL (+legacy MONGODB_URL). The ideal embedding store needs:{vector:pgvector} (VECTOR_PGVECTOR_URL) is now AVAILABLE — #1545 shipped (verified live 2026-07-16) — but this blueprint still stores embeddings in a Mongo `chunks` collection and cosine-ranks in-app; declare vector:pgvector only if you also build the retrieval on pgvector."
|
|
9
9
|
summary: "A BLUEPRINT for a retrieval-augmented 'ask my docs' knowledge base — ingest documents, chunk + embed them, retrieve the nearest chunks per question, and answer grounded with citations, on persistent Next.js + Mongo + the CloudGrid AI Gateway. This is not fill-in-the-blanks app code; it ships structure + cloudgrid.yaml. Fetch the template, read AGENTS.md for the file tree / collections / RAG loop / CloudGrid wiring (needs ai+database, the pgvector note — #1545 shipped), then BUILD the app under services/web/ following it, and deploy async to a live URL (local edition only)."
|
|
10
10
|
---
|
|
11
11
|
|
|
@@ -18,7 +18,7 @@ grid's shared Mongo) with a **RAG loop**: ingest documents → chunk → embed
|
|
|
18
18
|
→ at query time embed the question, retrieve the nearest chunks, and ask the model
|
|
19
19
|
to answer using only those. It is the `app-with-data` shape plus embeddings +
|
|
20
20
|
retrieval + a grounded answer step. Both the embedding and answer calls run through
|
|
21
|
-
CloudGrid's **AI Gateway** (`@cloudgrid-io/
|
|
21
|
+
CloudGrid's **AI Gateway** (`@cloudgrid-io/runtime`).
|
|
22
22
|
|
|
23
23
|
**This is a BLUEPRINT.** Unlike a fill-in-the-blanks template, it ships
|
|
24
24
|
*structure* — a `cloudgrid.yaml` and an `AGENTS.md` structure guide — not finished
|
|
@@ -85,7 +85,7 @@ needs:
|
|
|
85
85
|
|
|
86
86
|
**App code MUST live under `services/<name>/`** — `path:` is the URL mount, NOT
|
|
87
87
|
the filesystem path. **Declare `needs: { ai: true, database: true }`** (canonical)
|
|
88
|
-
— the deployer injects `
|
|
88
|
+
— the deployer injects `RUNTIME_GATEWAY_URL` (routed through `@cloudgrid-io/runtime`, no API
|
|
89
89
|
key) and provisions Mongo, injecting `DATABASE_MONGODB_URL` (+ legacy
|
|
90
90
|
`MONGODB_URL`). `requires:` is the deprecated v1 alias; never author it and never
|
|
91
91
|
set `needs:` and `requires:` together (the validator rejects the combination).
|
|
@@ -96,24 +96,27 @@ embeddings.
|
|
|
96
96
|
## 5. Build the app following AGENTS.md
|
|
97
97
|
|
|
98
98
|
Generate the files under `services/web/` per the guide:
|
|
99
|
-
- **Lazy
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
- **Lazy Mongo getter** — read `process.env.DATABASE_MONGODB_URL` (legacy
|
|
100
|
+
`MONGODB_URL` fallback) in `lib/db.js` **inside** a getter, never at module top
|
|
101
|
+
level (a top-level read fails `next build`). `lib/ai.js` just imports
|
|
102
|
+
`@cloudgrid-io/runtime` — the SDK reads `RUNTIME_GATEWAY_URL` itself, so there is
|
|
103
|
+
no env var to read (and none to set).
|
|
103
104
|
- **Ingest** (`POST /api/documents`): chunk the text (`lib/chunk.js`), `embed()`
|
|
104
|
-
the chunks via
|
|
105
|
-
`embedding` array, mark the `documents` doc
|
|
105
|
+
the chunks via `runtime.ai.embeddings({ text })` (batch; `vec.values`), store one
|
|
106
|
+
`chunks` doc per chunk with its `embedding` array, mark the `documents` doc
|
|
107
|
+
`ready`.
|
|
106
108
|
- **Retrieve** (`lib/retrieve.js`): embed the question, cosine-rank the Mongo
|
|
107
109
|
`chunks`, return top-k `{ text, documentId, score }` — a pure function that swaps
|
|
108
110
|
cleanly to a pgvector query (now available — #1545 shipped).
|
|
109
111
|
- **Answer** (`POST /api/ask`): retrieve top-k, prompt the model to answer ONLY
|
|
110
|
-
from the provided context and to cite the chunks, `chat(
|
|
111
|
-
|
|
112
|
+
from the provided context and to cite the chunks, `runtime.ai.chat({ model,
|
|
113
|
+
system, messages })` via the AI Gateway (chat needs a model; it returns
|
|
114
|
+
`{ text }`), return the answer plus source chunks so the UI shows **citations**.
|
|
112
115
|
|
|
113
116
|
## 6. Config / secrets
|
|
114
117
|
|
|
115
118
|
- The AI Gateway and Mongo need **no secrets** — they are injected by `needs:`. Do
|
|
116
|
-
**NOT** set `
|
|
119
|
+
**NOT** set `RUNTIME_GATEWAY_URL`, `DATABASE_MONGODB_URL`, or legacy `MONGODB_URL`
|
|
117
120
|
yourself; the grid injects them.
|
|
118
121
|
- Only if you add auth/payments: map the secret in the `vault:` block
|
|
119
122
|
(`AUTH_PROVIDER_KEY` and/or `STRIPE_KEY`) and store the value with
|
package/src/tools/constants.js
CHANGED
|
@@ -68,7 +68,7 @@ export const CLI_NPX_PKG = "@cloudgrid-io/cli@latest";
|
|
|
68
68
|
// server-side with HTTP 426) — a gate below the floor green-lights CLIs the API
|
|
69
69
|
// rejects on every call (issue #59). Bump this in lockstep with every floor
|
|
70
70
|
// raise (CLI release protocol checklist).
|
|
71
|
-
export const MIN_CLI_VERSION = "0.15.
|
|
71
|
+
export const MIN_CLI_VERSION = "0.15.14";
|
|
72
72
|
|
|
73
73
|
// Upload/create POST budget. The build itself is async (server returns 202 +
|
|
74
74
|
// poll_url); this bounds only the request→response, so a stalled server errors
|
package/src/tools/register.js
CHANGED
|
@@ -28,6 +28,21 @@ import {
|
|
|
28
28
|
runSource,
|
|
29
29
|
} from "./deploy.js";
|
|
30
30
|
|
|
31
|
+
// Build the argv for grid_create_project → `grid new` (CLI >= 0.15.14; `init`
|
|
32
|
+
// is a deprecated alias we no longer author). Modern shape: `new <slug>` with
|
|
33
|
+
// `--agent` for agents (NOT the legacy `init <kind> <slug>` positional). The
|
|
34
|
+
// old `--description` flag was removed from the CLI, so it is gone here too.
|
|
35
|
+
// Exported pure so the argv is unit-tested without spawning a CLI.
|
|
36
|
+
export function buildCreateProjectArgs({ kind, name, type, needs, dir, org } = {}) {
|
|
37
|
+
const args = ["new", name];
|
|
38
|
+
if (kind === "agent") args.push("--agent");
|
|
39
|
+
if (type) args.push("--type", type);
|
|
40
|
+
if (Array.isArray(needs) && needs.length) args.push("--needs", needs.join(","));
|
|
41
|
+
if (dir) args.push("--dir", dir);
|
|
42
|
+
if (org) args.push("--grid", org); // CLI 0.12 dropped --org for --grid (same slug)
|
|
43
|
+
return args;
|
|
44
|
+
}
|
|
45
|
+
|
|
31
46
|
// ── Registration ───────────────────────────────────────────────────────────────
|
|
32
47
|
// Registers the tools onto `server`. ctx.edition decides whether the CLI-wrapping
|
|
33
48
|
// tools are included (they need a local machine).
|
|
@@ -861,26 +876,19 @@ export function registerTools(server, ctx) {
|
|
|
861
876
|
|
|
862
877
|
regTool(
|
|
863
878
|
"grid_create_project",
|
|
864
|
-
"
|
|
879
|
+
"Scaffold a new CloudGrid app or agent folder (cloudgrid.yaml + a web service), optionally pre-declaring resources. Wraps `grid new` (scaffolds locally; no server entity until you grid_deploy).",
|
|
865
880
|
{
|
|
866
|
-
kind: z.enum(["app", "agent"]).describe("Entity kind."),
|
|
881
|
+
kind: z.enum(["app", "agent"]).describe("Entity kind. 'agent' scaffolds an agent: block."),
|
|
867
882
|
name: z.string().describe("Slug: 3-40 lowercase alphanumerics and hyphens."),
|
|
868
883
|
type: z.enum(["node", "nextjs", "python", "static"]).optional().describe("Seed a web service of this type."),
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
884
|
+
needs: z.array(z.enum(["database", "cache", "kv", "queue", "pubsub", "vector", "ai", "disk"])).optional()
|
|
885
|
+
.describe("Pre-declare infrastructure needs in the scaffolded cloudgrid.yaml (e.g. [\"database\",\"ai\"])."),
|
|
886
|
+
dir: z.string().optional().describe("Target directory. Defaults to the current folder."),
|
|
887
|
+
org: z.string().optional().describe("Override the active grid this project will target."),
|
|
872
888
|
cwd: z.string().optional().describe("Working directory. The CLI runs in this directory. Defaults to the MCP server's working directory."),
|
|
873
889
|
},
|
|
874
890
|
{ readOnlyHint: false, destructiveHint: false, openWorldHint: true },
|
|
875
|
-
cliTool((
|
|
876
|
-
const args = ["init", kind, name];
|
|
877
|
-
if (type) args.push("--type", type);
|
|
878
|
-
if (description) args.push("--description", description);
|
|
879
|
-
if (dir) args.push("--dir", dir);
|
|
880
|
-
// CLI 0.12 dropped `--org` in favour of `--grid` (same slug).
|
|
881
|
-
if (org) args.push("--grid", org);
|
|
882
|
-
return args;
|
|
883
|
-
}, { cwdParam: true }),
|
|
891
|
+
cliTool((input) => buildCreateProjectArgs(input), { cwdParam: true }),
|
|
884
892
|
);
|
|
885
893
|
|
|
886
894
|
// NOTE: grid_deploy is no longer CLI-wrapping — the unified direct-API verb
|
package/src/tools.js
CHANGED