@cloudgrid-io/mcp 0.20.6 → 0.20.8

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.
Files changed (33) hide show
  1. package/README.md +40 -31
  2. package/package.json +2 -1
  3. package/src/corpus/capability-map.md +21 -13
  4. package/src/corpus/cloudgrid-yaml.md +5 -3
  5. package/src/corpus/examples/ai-app/index.md +4 -3
  6. package/src/corpus/examples/docs-app/index.md +113 -0
  7. package/src/corpus/templates/ai-app/README.md +4 -4
  8. package/src/corpus/templates/ai-app/index.md +4 -4
  9. package/src/corpus/templates/ai-knowledge-base/AGENTS.md +17 -17
  10. package/src/corpus/templates/ai-knowledge-base/README.md +5 -4
  11. package/src/corpus/templates/ai-knowledge-base/cloudgrid.yaml +5 -4
  12. package/src/corpus/templates/ai-knowledge-base/index.md +15 -11
  13. package/src/corpus/templates/semantic-search/AGENTS.md +9 -9
  14. package/src/corpus/templates/semantic-search/README.md +4 -3
  15. package/src/corpus/templates/semantic-search/cloudgrid.yaml +6 -5
  16. package/src/corpus/templates/semantic-search/index.md +7 -4
  17. package/src/corpus/templates/simple-semantic-search/README.md +20 -0
  18. package/src/corpus/templates/simple-semantic-search/cloudgrid.yaml +235 -0
  19. package/src/corpus/templates/simple-semantic-search/index.md +353 -0
  20. package/src/corpus/templates/simple-semantic-search/services/web/package.json +15 -0
  21. package/src/corpus/templates/simple-semantic-search/services/web/src/document.txt +40 -0
  22. package/src/corpus/templates/simple-semantic-search/services/web/src/index.js +225 -0
  23. package/src/corpus/workflows/ai-app.md +5 -4
  24. package/src/corpus/workflows/ai-knowledge-base.md +17 -14
  25. package/src/corpus/workflows/semantic-search.md +9 -7
  26. package/src/corpus/workflows/simple-semantic-search.md +64 -0
  27. package/src/playbook.js +135 -0
  28. package/src/tools/cli.js +446 -0
  29. package/src/tools/constants.js +106 -0
  30. package/src/tools/deploy.js +1677 -0
  31. package/src/tools/register.js +1165 -0
  32. package/src/tools/util.js +17 -0
  33. package/src/tools.js +30 -3470
@@ -77,12 +77,12 @@ os.environ.get("MONGODB_URL")` inside `get_client()`, never at module top level.
77
77
  `requires:` together (the validator rejects the combination).
78
78
 
79
79
  **No `needs: vector`.** The ideal embedding store is pgvector
80
- (`needs: { vector: pgvector }` → `VECTOR_PGVECTOR_URL`), but the runtime
81
- role-grant is **blocked on platform issue #1545**. Until it lands, embeddings live
82
- in the Mongo `chunks.embedding` float array and are cosine-ranked in-app
83
- (`search.py::_cosine`). When #1545 ships, move the vectors to pgvector and replace
84
- the in-app cosine block with an `ORDER BY embedding <=> $q LIMIT k` query — the
85
- rest of the pipeline is unchanged.
80
+ (`needs: { vector: pgvector }` → `VECTOR_PGVECTOR_URL`), and it is **now
81
+ available** — #1545 shipped (verified live 2026-07-16). This template still keeps
82
+ embeddings in the Mongo `chunks.embedding` float array and cosine-ranks in-app
83
+ (`search.py::_cosine`). To swap, move the vectors to pgvector and replace the
84
+ in-app cosine block with an `ORDER BY embedding <=> $q LIMIT k` query — the rest
85
+ of the pipeline is unchanged.
86
86
 
87
87
  ---
88
88
 
@@ -155,9 +155,9 @@ to store the same way. Non-secret public config can also go via `grid env`.
155
155
  source or embeddings are unconfigured. `GET /backend/status` reports capability
156
156
  **booleans** (`source_configured`, `embeddings_configured`, …), never secret
157
157
  values.
158
- 4. **No `needs: vector`.** `needs:` is `database` only — pgvector's runtime
159
- role-grant is still blocked (#1545). (The scheduled cron refresh IS active — see
160
- §8.)
158
+ 4. **No `needs: vector`.** `needs:` is `database` only — the pgvector need is
159
+ available (#1545 shipped), but this template's code uses Mongo embeddings (§3
160
+ for the swap). (The scheduled cron refresh IS active — see §8.)
161
161
 
162
162
  ---
163
163
 
@@ -17,9 +17,10 @@ aggregated to the document level with a best-passage highlight.
17
17
  | `backend` | `python` (FastAPI) | `/backend` | `services/backend/src/main.py` |
18
18
 
19
19
  `needs: { database: true }` → CloudGrid injects `DATABASE_MONGODB_URL` (fallback
20
- `MONGODB_URL`). **No `needs: vector`** — pgvector runtime role-grant is blocked
21
- (platform #1545), so embeddings live in the Mongo `chunks` collection and are
22
- cosine-ranked in-app. Refresh runs two ways: the manager "Refresh now" endpoint
20
+ `MONGODB_URL`). **No `needs: vector`** — the need is available now (#1545
21
+ shipped, verified live 2026-07-16), but this template stores embeddings in the
22
+ Mongo `chunks` collection and cosine-ranks in-app; declare `vector: pgvector`
23
+ only if you also switch the code to pgvector. Refresh runs two ways: the manager "Refresh now" endpoint
23
24
  (on demand) and an active Python `type: cron` job (`services/refresh/`, daily 03:00
24
25
  UTC) — both call the same `indexing.run_sync` (see AGENTS.md §8).
25
26
 
@@ -89,9 +89,9 @@ name: semantic-search
89
89
  # pubsub: true
90
90
  # # vector — pgvector on Postgres. Injects VECTOR_PGVECTOR_URL (+ PGVECTOR_URL).
91
91
  # # true | pgvector | { engine: pgvector, dim: 1536 }
92
- # # NOT USED HERE — pgvector runtime role-grant is blocked (platform #1545).
93
- # # This template stores embeddings in the Mongo `chunks` collection and
94
- # # cosine-ranks in-app instead. Swap to `vector: pgvector` once #1545 lands.
92
+ # # NOT USED HERE — available now (#1545 shipped). This template stores
93
+ # # embeddings in the Mongo `chunks` collection and cosine-ranks in-app.
94
+ # # Uncomment `vector: pgvector` only if you also switch the code to pgvector.
95
95
  # vector: pgvector
96
96
  # # object_storage — GCS bucket. Injects OBJECT_STORAGE_GCS_BUCKET, _GCS_REGION.
97
97
  # # true | { size: 10Gi }
@@ -204,8 +204,9 @@ services:
204
204
  timezone: UTC
205
205
  run: job # batch job — runs services/refresh/src/main.py once
206
206
  # CloudGrid managed Mongo → injects DATABASE_MONGODB_URL (+ legacy MONGODB_URL).
207
- # NO `needs: vector` — pgvector runtime role-grant is still blocked (#1545);
208
- # embeddings live in the Mongo `chunks` collection and are cosine-ranked in-app.
207
+ # NO `needs: vector` — available now (#1545 shipped), but this template stores
208
+ # embeddings in the Mongo `chunks` collection and cosine-ranks in-app;
209
+ # uncomment `vector: pgvector` only if you also switch the code to pgvector.
209
210
  needs:
210
211
  database: true
211
212
 
@@ -24,9 +24,11 @@ level with a best-passage highlight.
24
24
  `$text` index exists at boot — `$text` returns `[]` on an empty catalog rather
25
25
  than raising `IndexNotFound` (a 500). The `$text` query is also guarded in
26
26
  `except OperationFailure` as belt-and-suspenders.
27
- 5. **No `needs: vector`** — pgvector runtime role-grant is blocked (#1545), so
28
- embeddings live in the Mongo `chunks` collection (a float array) and are
29
- cosine-ranked in-app. **The refresh cron IS active** — a Python `type: cron`,
27
+ 5. **No `needs: vector`** — the need is available now (#1545 shipped, verified
28
+ live 2026-07-16), but this
29
+ template stores embeddings in the Mongo `chunks` collection (a float array)
30
+ and cosine-ranks in-app; declare `vector: pgvector` only if you also switch
31
+ the code to pgvector. **The refresh cron IS active** — a Python `type: cron`,
30
32
  `run: job` service (`services/refresh/`) reindexes daily at 03:00 UTC, and the
31
33
  manager "Refresh now" endpoint reindexes on demand; both call the same
32
34
  `indexing.run_sync` (the cron vendors the backend `app/` modules — see AGENTS.md §8).
@@ -86,7 +88,8 @@ needs:
86
88
 
87
89
  > **Capability:** the need is `database: true` — the deployer provisions Mongo and
88
90
  > injects `DATABASE_MONGODB_URL` (+ legacy `MONGODB_URL`). NO `needs: vector`
89
- > (#1545). Three services: `web` (static), `backend` (python), `refresh` (cron).
91
+ > (available, #1545 shipped — this template uses Mongo embeddings). Three
92
+ > services: `web` (static), `backend` (python), `refresh` (cron).
90
93
  > `requires:` is the deprecated v1 alias — don't mix it with `needs:`.
91
94
 
92
95
  ## Configure + deploy
@@ -0,0 +1,20 @@
1
+ # simple-semantic-search
2
+
3
+ Semantic search over a document in one node service, on the CloudGrid managed
4
+ vector substrate. `needs: { vector: pgvector }` provisions pgvector and injects
5
+ `VECTOR_PGVECTOR_URL`; `needs: { ai: true }` gives embeddings through
6
+ `@cloudgrid-io/runtime` with no API key. On startup the service embeds
7
+ `document.txt` (one vector per paragraph) into a `chunks` table sized from a
8
+ probe embedding, then `POST /search` embeds the query and returns the nearest
9
+ passages by cosine distance. `/health` returns 503 until the seed finishes, so
10
+ the platform holds the pod out of traffic until search works.
11
+
12
+ Proven by a real end-to-end deploy (live in under 3 minutes, 2026-07-16).
13
+
14
+ - Deploy: `grid init app <name> --here`, then `grid plug`.
15
+ - The CLI writes `.cloudgrid/link.json` (folder ↔ entity binding) — never
16
+ hand-author it; `rm -rf .cloudgrid` + re-init to take a copied folder as your
17
+ own app.
18
+ - Replace `services/web/src/document.txt` with the content to index.
19
+ - For a multi-service search portfolio (upload UI + refresh cron), use the
20
+ `semantic-search` blueprint instead.
@@ -0,0 +1,235 @@
1
+ # ============================================================================
2
+ # cloudgrid.yaml — Complete Example
3
+ # ============================================================================
4
+ #
5
+ # This file shows EVERY field the platform supports, with comments explaining
6
+ # each one. It is a reference — no real project would use all of these at once.
7
+ #
8
+ # STANDARD: every CloudGrid template ships its cloudgrid.yaml in THIS full form.
9
+ # Uncomment ONLY the fields the archetype needs (always: name + services; plus
10
+ # needs: for runtime apps). Leave everything else commented. Comments are
11
+ # ignored by the parser, so the file deploys to exactly the active fields.
12
+ #
13
+ # Only two fields are required: name and services. Everything else is optional.
14
+ # Full docs: docs/cloudgrid-yaml-reference.md
15
+ # ============================================================================
16
+
17
+
18
+ # ─── IDENTITY ───────────────────────────────────────────────────────────────
19
+
20
+ # Entity slug (REQUIRED). 2-42 chars, lowercase alphanumeric + hyphens.
21
+ # Must start and end with a letter or digit.
22
+ # Becomes part of your public URL: <name>-<4hex>.<org>.cloudgrid.io
23
+ name: simple-semantic-search
24
+ description: Semantic search over a bundled document, backed by pgvector.
25
+ icon: "🔎"
26
+
27
+ # One-line summary. Max 280 chars. If omitted, Grid Brain auto-generates one.
28
+ # description: Order processing API for the e-commerce platform
29
+
30
+ # Single emoji or short text shown as the entity icon. Max 64 chars.
31
+ # icon: "📦"
32
+
33
+ # Entity type: 'app' (default) or 'agent'. An agent is an app with an agent: block.
34
+ # kind: app
35
+
36
+
37
+ # ─── NETWORKING ─────────────────────────────────────────────────────────────
38
+
39
+ # Whether this entity serves public HTTP traffic.
40
+ # true = public URL + Ingress (default). false = internal only.
41
+ # expose: true
42
+
43
+ # Additional domain names this entity serves on (the platform URL is always active).
44
+ # custom_domains:
45
+ # - orders.example.com
46
+ # - shop.example.com
47
+
48
+
49
+ # ─── HEALTH PROBE (entity-level override) ──────────────────────────────────
50
+
51
+ # Override the default health check for the entire entity.
52
+ # probe:
53
+ # path: /healthz # HTTP path to probe (default: /).
54
+ # expected: "<500" # '<500' (default), '200', '2xx'.
55
+
56
+
57
+ # ─── DEPLOY NOTIFICATIONS ──────────────────────────────────────────────────
58
+
59
+ # Slack notification to the org's default channel on deploy failure.
60
+ # true = notify (default), false = silent.
61
+ # notify: true
62
+
63
+
64
+ # ─── SCALING ────────────────────────────────────────────────────────────────
65
+
66
+ # Replica scaling intent.
67
+ # 'auto' — platform decides from the grid tier (default).
68
+ # 'alert' — single-replica, emit a SPOF warning at plug time.
69
+ # 1-10 — explicit replica count, clamped to the grid max.
70
+ # scale: auto
71
+
72
+
73
+ # ─── INFRASTRUCTURE NEEDS ──────────────────────────────────────────────────
74
+ #
75
+ # Declare infrastructure; the platform provisions it and injects connection
76
+ # details as env vars. Nine needs: database, cache, kv, queue, pubsub, vector,
77
+ # object_storage, disk, ai. Simplest form is `true`.
78
+ #
79
+ # needs:
80
+ # # database — MongoDB. Injects DATABASE_MONGODB_URL (+ legacy MONGODB_URL).
81
+ # # true | pool | dedicated | { tier: external, secret: MY_DB }
82
+ # database: true
83
+ # # cache — Redis, LRU eviction (derived data). Injects CACHE_REDIS_URL (+ REDIS_URL).
84
+ # # true | redis | { engine: external, secret: MY_REDIS_URL }
85
+ # cache: true
86
+ # # kv — Redis, no eviction (durable: flags, idempotency). Injects KV_REDIS_URL.
87
+ # kv: true
88
+ # # queue — Redis job-queue substrate (BullMQ). Injects QUEUE_REDIS_URL.
89
+ # queue: true
90
+ # # pubsub — Redis broadcast pub/sub. Injects PUBSUB_REDIS_URL.
91
+ # pubsub: true
92
+ # # vector — pgvector on Postgres. Injects VECTOR_PGVECTOR_URL (+ PGVECTOR_URL).
93
+ # # true | pgvector | { engine: pgvector, dim: 1536 }
94
+ # vector: pgvector
95
+ # # object_storage — GCS bucket. Injects OBJECT_STORAGE_GCS_BUCKET, _GCS_REGION.
96
+ # # true | { size: 10Gi }
97
+ # object_storage: true
98
+ # # disk — persistent FS mount (PVC). Injects DISK_PATH. Pins to 1 replica.
99
+ # # true | { size: 1Gi, mount: /var/data } (forbidden: /proc /sys /dev)
100
+ # disk: true
101
+ # # ai — AI Gateway via @cloudgrid-io/ai. Injects AI_GATEWAY_URL. true | false.
102
+ # ai: true
103
+
104
+
105
+ # ─── INTER-ENTITY COMMUNICATION ────────────────────────────────────────────
106
+
107
+ # Entities this app calls (outbound). Service-account token injected per pair.
108
+ # calls:
109
+ # - org:atomic/billing-api
110
+
111
+ # Inbound caller policy — who can call YOUR entity.
112
+ # callers:
113
+ # policy: auto # 'auto' | 'manual' (default).
114
+ # scope: org # 'org' (default) | 'space' | 'explicit'.
115
+ # fallback: deny # 'deny' (default) | 'warn'.
116
+ # # allowed_apps: # required only when scope: explicit
117
+ # # - org:atomic/frontend
118
+
119
+
120
+ # ─── VAULT ──────────────────────────────────────────────────────────────────
121
+
122
+ # Map org vault items to env vars. Keys UPPER_SNAKE_CASE; values = vault item keys.
123
+ # vault:
124
+ # STRIPE_KEY: stripe-live-key
125
+ # SENDGRID_API_KEY: sendgrid-key
126
+
127
+
128
+ # ─── CONNECTORS AND HOOKS ──────────────────────────────────────────────────
129
+
130
+ # connectors:
131
+ # - id: team-slack
132
+ # target: org # 'system' | 'org'.
133
+ # channel: "#deploys"
134
+ # hooks:
135
+ # - on: deploy.failed # release.published | deploy.failed | feedback.received | entity.created
136
+ # via: team-slack
137
+ # template: "Deploy failed for {entity_name}: {error}"
138
+ # channel: "#alerts"
139
+ # triggers:
140
+ # - from: team-slack
141
+ # event: message
142
+ # channel: "#support"
143
+ # route: /webhooks/slack
144
+
145
+
146
+ # ─── LOCAL DEVELOPMENT ──────────────────────────────────────────────────────
147
+
148
+ # Config for `grid dev`. Redact fields in dev data snapshots.
149
+ # dev:
150
+ # snapshot:
151
+ # mask:
152
+ # - users.email
153
+ # - users.phone
154
+
155
+
156
+ # ─── AGENT METADATA ────────────────────────────────────────────────────────
157
+
158
+ # An agent is an app with kind: agent (above) and an agent: block.
159
+ # agent:
160
+ # purpose: Sync customer data from external CRM every night
161
+ # schedule: "0 2 * * *"
162
+ # trigger: webhook
163
+
164
+
165
+ # ─── PRIVATE RESOURCE AUTO-DEPENDENCIES ────────────────────────────────────
166
+
167
+ # When true (default), private resources are auto-injected as depends_on.
168
+ # auto_depends_on_private_requires: true
169
+
170
+
171
+ # ─── SERVICES (REQUIRED) ───────────────────────────────────────────────────
172
+ #
173
+ # At least one service is required. Key = service name (slug rules).
174
+ # Types: node, nextjs, python, static, cron.
175
+ #
176
+ services:
177
+ web:
178
+ # type (REQUIRED): node | nextjs | python | static | cron
179
+ type: node
180
+ # HTTP route: '/' | '/api' | false (internal) | omitted (=false + warning).
181
+ # Only one service per entity can claim '/'.
182
+ path: /
183
+ # Container port (default 8080; read process.env.PORT). Not for cron.
184
+ # port: 3000
185
+ # nextjs only: base_image: distroless (default) | alpine
186
+ # base_image: distroless
187
+ # node only: lang: javascript (default) | typescript
188
+ # lang: typescript
189
+ # Custom source location (default services/<name>/). '.' = project root.
190
+ # source:
191
+ # path: src/worker
192
+ # Health probe: false/omitted (TCP) | true (/health) | "/path" | {path,expected}
193
+ # Returns 503 until the startup seed finishes, so traffic waits for a ready index.
194
+ health: /health
195
+ # Static runtime env vars (strings). Reserved: PORT, APP_NAME, SERVICE_NAME,
196
+ # NODE_ENV, MONGODB_URL, REDIS_URL, AI_GATEWAY_URL, N8N_WEBHOOK_URL, CLOUDGRID_*.
197
+ # env:
198
+ # LOG_LEVEL: info
199
+ # Sibling services/private resources that must be Ready first (no cron, no cycles).
200
+ # depends_on:
201
+ # - worker
202
+ # Per-service needs override (merges with app-level needs).
203
+ # needs:
204
+ # queue: true
205
+ # Static-only build step:
206
+ # build:
207
+ # command: npm run build
208
+ # output: dist
209
+ # env:
210
+ # VITE_API_URL: https://api.example.com
211
+ # node_version: "22" # static build step: '18'|'20'|'22'|'24' (quoted)
212
+ # Cron-only: schedule (REQUIRED), timezone (UTC|EST|PST), run (job | https URL)
213
+ # schedule: "0 9 * * 1"
214
+ # timezone: UTC
215
+ # run: job
216
+ # Verbose per-service persistence (prefer needs.disk):
217
+ # persist:
218
+ # - name: scratch
219
+ # path: /tmp/scratch
220
+ # size: 500Mi
221
+
222
+
223
+
224
+ needs:
225
+ vector: pgvector # pgvector on Postgres. Injects VECTOR_PGVECTOR_URL (+legacy PGVECTOR_URL).
226
+ ai: true # AI Gateway for embeddings via @cloudgrid-io/runtime. Injects AI_GATEWAY_URL.
227
+
228
+
229
+ # ============================================================================
230
+ # NOTES
231
+ # - NOT here: org:/entity_id: (→ .cloudgrid/link.json), secrets (→ grid secrets set),
232
+ # Dockerfile (platform generates from services.*.type).
233
+ # - Deploy: grid plug | Local with grid resources: grid dev
234
+ # - Full reference: docs/cloudgrid-yaml-reference.md | CLI: docs/cli-reference.md
235
+ # ============================================================================