@gapi/gcli 1.8.231 → 1.8.232
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/README.md +82 -12
- package/package.json +1 -1
- package/release/index.js +27 -0
package/README.md
CHANGED
|
@@ -205,6 +205,59 @@ options:
|
|
|
205
205
|
external: []
|
|
206
206
|
```
|
|
207
207
|
|
|
208
|
+
### MCP Server Functions
|
|
209
|
+
|
|
210
|
+
A function can be provisioned as an **MCP Server** in front of a **federation graph** by setting `mcp: true`. The MCP lambda has **no source code** — it is fully described by config: the selected `mcpGraph` (a federation lambda in the same project) is resolved to its internal router URL and **introspected** (single source of truth, no schema file), and the curated `mcpOperations` become MCP tools. Use the MCP runtime image and `newdeploy` + `minScale: 1` (MCP holds long-lived streamable-HTTP sessions).
|
|
211
|
+
|
|
212
|
+
```yaml
|
|
213
|
+
function:
|
|
214
|
+
name: my-mcp
|
|
215
|
+
route: mcp
|
|
216
|
+
method: ['GET', 'POST'] # streamable HTTP needs both
|
|
217
|
+
network: ['public']
|
|
218
|
+
env: nodejs-graphql-mcp # the MCP runtime image
|
|
219
|
+
|
|
220
|
+
mcp: true
|
|
221
|
+
mcpGraph: my-federation-gateway # an existing federation lambda in this project
|
|
222
|
+
|
|
223
|
+
# Curated operations exposed as MCP tools. The tool name is the OPERATION name (must be named);
|
|
224
|
+
# optional — the introspection/search/execute tools work without any.
|
|
225
|
+
mcpOperations:
|
|
226
|
+
- query: |
|
|
227
|
+
query GetUser($id: ID!) { user(id: $id) { id name email } }
|
|
228
|
+
|
|
229
|
+
# Static headers sent on EVERY upstream request (e.g. a fixed API key / service token).
|
|
230
|
+
mcpHeaders:
|
|
231
|
+
- name: X-Api-Key
|
|
232
|
+
value: replace-me
|
|
233
|
+
|
|
234
|
+
# Extra request headers forwarded from the caller (Authorization is ALWAYS forwarded).
|
|
235
|
+
mcpForwardHeaders:
|
|
236
|
+
- name: X-Tenant-Id
|
|
237
|
+
|
|
238
|
+
scaleOptions:
|
|
239
|
+
executorType: newdeploy
|
|
240
|
+
minScale: 1
|
|
241
|
+
maxScale: 4
|
|
242
|
+
targetCpu: 70
|
|
243
|
+
|
|
244
|
+
environment:
|
|
245
|
+
name: nodejs-graphql-mcp
|
|
246
|
+
image: rxdi/fission-nodejs-graphql-mcp:0.0.2
|
|
247
|
+
builder: rxdi/fission-node-builder:1.0.8
|
|
248
|
+
poolSize: 0
|
|
249
|
+
region: EU_CENTRAL
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
gcli lambda:create --project <projectId> --spec ./lambforge.yaml
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
`--mcp` and `--mcpGraph <name>` are also available as CLI flags; the array fields
|
|
257
|
+
(`mcpOperations`, `mcpHeaders`, `mcpForwardHeaders`) are spec-only. A full annotated example lives in
|
|
258
|
+
[`example/mcp/lambforge.yaml`](./example/mcp/lambforge.yaml). Client connects at
|
|
259
|
+
`https://<host>/<projectId>/<route>/mcp`.
|
|
260
|
+
|
|
208
261
|
### Conditional Configuration (Environment-Aware Specs)
|
|
209
262
|
|
|
210
263
|
A single spec can describe **many deploy variants** without duplicating the file. The bundler/loader understands a small set of conditional tags that are resolved at load time from external environment variables, plus native YAML references (`&anchor` / `*alias`) and merge keys (`<<`) for de-duplication.
|
|
@@ -213,13 +266,13 @@ This is how you ship the **same code to two different targets** — e.g. the leg
|
|
|
213
266
|
|
|
214
267
|
#### Supported tags
|
|
215
268
|
|
|
216
|
-
| Tag
|
|
217
|
-
|
|
|
218
|
-
| `!env`
|
|
219
|
-
| `!env`
|
|
220
|
-
| `!switch` | `!switch { var, default, cases }`
|
|
221
|
-
| `!if`
|
|
222
|
-
| `!if`
|
|
269
|
+
| Tag | Form | Resolves to |
|
|
270
|
+
| --------- | ------------------------------------------ | ----------------------------------------------------------------- |
|
|
271
|
+
| `!env` | `!env VAR` | `process.env.VAR` (or `null` when unset) |
|
|
272
|
+
| `!env` | `!env [VAR, default]` | `process.env.VAR ?? default` |
|
|
273
|
+
| `!switch` | `!switch { var, default, cases }` | `cases[process.env[var] ?? default]` |
|
|
274
|
+
| `!if` | `!if { when, then, else }` | `then` when `when` is truthy, else `else` |
|
|
275
|
+
| `!if` | `!if { var, equals, default, then, else }` | `then` when `process.env[var] ?? default === equals`, else `else` |
|
|
223
276
|
|
|
224
277
|
Notes:
|
|
225
278
|
|
|
@@ -287,8 +340,18 @@ function:
|
|
|
287
340
|
scaleOptions:
|
|
288
341
|
<<: *baseScale # merge in the shared baseline…
|
|
289
342
|
# …and override per environment
|
|
290
|
-
minScale:
|
|
291
|
-
|
|
343
|
+
minScale:
|
|
344
|
+
!switch {
|
|
345
|
+
var: DEPLOY_ENV,
|
|
346
|
+
default: dev,
|
|
347
|
+
cases: { prod: 2, staging: 1, dev: 0 },
|
|
348
|
+
}
|
|
349
|
+
maxScale:
|
|
350
|
+
!switch {
|
|
351
|
+
var: DEPLOY_ENV,
|
|
352
|
+
default: dev,
|
|
353
|
+
cases: { prod: 10, staging: 4, dev: 2 },
|
|
354
|
+
}
|
|
292
355
|
```
|
|
293
356
|
|
|
294
357
|
##### 3. Region / image / builder selection (strings with sane defaults)
|
|
@@ -384,11 +447,18 @@ function:
|
|
|
384
447
|
name: graphql-server-lambdas
|
|
385
448
|
route: graphql-server-lambdas
|
|
386
449
|
file: ./src/main.ts
|
|
387
|
-
network:
|
|
450
|
+
network:
|
|
451
|
+
!switch {
|
|
452
|
+
var: DEPLOY_ENV,
|
|
453
|
+
default: prod,
|
|
454
|
+
cases: { dev: ['public'], prod: ['private'] },
|
|
455
|
+
}
|
|
388
456
|
scaleOptions:
|
|
389
457
|
<<: *baseScale
|
|
390
|
-
minScale:
|
|
391
|
-
|
|
458
|
+
minScale:
|
|
459
|
+
!switch { var: DEPLOY_ENV, default: dev, cases: { prod: 2, dev: 0 } }
|
|
460
|
+
maxScale:
|
|
461
|
+
!switch { var: DEPLOY_ENV, default: dev, cases: { prod: 10, dev: 2 } }
|
|
392
462
|
|
|
393
463
|
options:
|
|
394
464
|
bundler:
|
package/package.json
CHANGED
package/release/index.js
CHANGED
|
@@ -36183,6 +36183,19 @@ buildBashScript
|
|
|
36183
36183
|
customUploadFileId
|
|
36184
36184
|
federation
|
|
36185
36185
|
subgraphs
|
|
36186
|
+
mcp
|
|
36187
|
+
mcpGraph
|
|
36188
|
+
mcpOperations {
|
|
36189
|
+
name
|
|
36190
|
+
query
|
|
36191
|
+
}
|
|
36192
|
+
mcpHeaders {
|
|
36193
|
+
name
|
|
36194
|
+
value
|
|
36195
|
+
}
|
|
36196
|
+
mcpForwardHeaders {
|
|
36197
|
+
name
|
|
36198
|
+
}
|
|
36186
36199
|
envSecrets
|
|
36187
36200
|
scaleOptions {
|
|
36188
36201
|
minCpu
|
|
@@ -284493,6 +284506,12 @@ var init_helpers2 = __esm({
|
|
|
284493
284506
|
network: cmd.network || payload.network || ["public", "private"],
|
|
284494
284507
|
federation: cmd.federation ?? !!payload.federation,
|
|
284495
284508
|
subgraphs: cmd.subgraphs || payload.subgraphs || [],
|
|
284509
|
+
/* MCP server — operations/headers come from the spec (yaml/json); mcp/mcpGraph also accept flags */
|
|
284510
|
+
mcp: cmd.mcp ?? !!payload.mcp,
|
|
284511
|
+
mcpGraph: cmd.mcpGraph || payload.mcpGraph || "",
|
|
284512
|
+
mcpOperations: payload.mcpOperations || [],
|
|
284513
|
+
mcpHeaders: payload.mcpHeaders || [],
|
|
284514
|
+
mcpForwardHeaders: payload.mcpForwardHeaders || [],
|
|
284496
284515
|
customUploadFileId: cmd.customUploadFileId || payload.customUploadFileId || "",
|
|
284497
284516
|
scaleOptions: {
|
|
284498
284517
|
executorType: cmd.executorType || payload.scaleOptions?.executorType || "poolmgr",
|
|
@@ -316305,6 +316324,14 @@ function registerLambdaCommands(program2) {
|
|
|
316305
316324
|
"--subgraphs <subgraphs...>",
|
|
316306
316325
|
"Lambda names (within the project) to expose as subgraphs of the federation gateway"
|
|
316307
316326
|
],
|
|
316327
|
+
[
|
|
316328
|
+
"--mcp",
|
|
316329
|
+
"Provision this lambda as an Apollo MCP Server in front of a federation graph"
|
|
316330
|
+
],
|
|
316331
|
+
[
|
|
316332
|
+
"--mcpGraph <mcpGraph>",
|
|
316333
|
+
"Federation gateway lambda name the MCP server connects to (operations/headers via spec yaml)"
|
|
316334
|
+
],
|
|
316308
316335
|
[
|
|
316309
316336
|
"--executorType <executorType>",
|
|
316310
316337
|
"Executor type for execution; one of 'poolmgr', 'newdeploy'"
|