@0xmaxma/claude-gateway 1.6.4 → 1.6.6
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/config.template.json +14 -1
- package/dist/api/apps-router.d.ts.map +1 -1
- package/dist/api/apps-router.js +108 -0
- package/dist/api/apps-router.js.map +1 -1
- package/dist/apps/compose-generator.d.ts +15 -0
- package/dist/apps/compose-generator.d.ts.map +1 -1
- package/dist/apps/compose-generator.js +29 -0
- package/dist/apps/compose-generator.js.map +1 -1
- package/dist/apps/installer.d.ts +211 -1
- package/dist/apps/installer.d.ts.map +1 -1
- package/dist/apps/installer.js +768 -4
- package/dist/apps/installer.js.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +35 -0
- package/dist/types.d.ts.map +1 -1
- package/mcp/tools/apps/client.ts +16 -0
- package/mcp/tools/apps/module.ts +78 -1
- package/mcp/tools/apps/skills/create-app-yaml/SKILL.md +3 -0
- package/mcp/tools/apps/skills/install-app/SKILL.md +11 -2
- package/package.json +1 -1
package/mcp/tools/apps/module.ts
CHANGED
|
@@ -78,7 +78,7 @@ export class AppsModule implements ToolModule {
|
|
|
78
78
|
},
|
|
79
79
|
{
|
|
80
80
|
name: 'inspect_app',
|
|
81
|
-
description: 'Preview an install source WITHOUT installing: fetch and parse the app.yaml and return the required secrets (secretKeys, must be provided) and auto-generated secrets (generatedKeys, filled by the gateway), plus name, version, ports, and warnings. Call this BEFORE install_app for a GitHub URL — such apps have no registry entry, so browse_registry cannot reveal their required secrets. Pass github_url (+ optional commit), registry_app (+ optional version), or local_path.',
|
|
81
|
+
description: 'Preview an install source WITHOUT installing: fetch and parse the app.yaml and return the required secrets (secretKeys, must be provided) and auto-generated secrets (generatedKeys, filled by the gateway), plus name, version, ports, and warnings. Also returns secretDefaults — defaults for prompt-with-default secrets declared as KEY=!default:<value>: the key is still in secretKeys (prompted/editable) but this default pre-fills the field and is written to .env when left blank. Call this BEFORE install_app for a GitHub URL — such apps have no registry entry, so browse_registry cannot reveal their required secrets. Pass github_url (+ optional commit), registry_app (+ optional version), or local_path.',
|
|
82
82
|
inputSchema: {
|
|
83
83
|
type: 'object',
|
|
84
84
|
properties: {
|
|
@@ -149,6 +149,58 @@ export class AppsModule implements ToolModule {
|
|
|
149
149
|
additionalProperties: false,
|
|
150
150
|
},
|
|
151
151
|
},
|
|
152
|
+
{
|
|
153
|
+
name: 'docker_housekeeping',
|
|
154
|
+
description: 'Reclaim leaked Docker build cache and dangling images left behind by app install/update. mode "report" (default) returns a read-only reclaim report: reclaimable build cache, dangling image count, and orphan volume names. mode "prune" executes ONLY the safe reclaim (build cache older than the configured window + dangling <none> images) — it NEVER removes another app\'s tagged images, and NEVER deletes a volume. Orphan volumes are reported but never auto-deleted (they can hold real app data).',
|
|
155
|
+
inputSchema: {
|
|
156
|
+
type: 'object',
|
|
157
|
+
properties: {
|
|
158
|
+
mode: {
|
|
159
|
+
type: 'string',
|
|
160
|
+
enum: ['report', 'prune'],
|
|
161
|
+
description: 'report (default) = read-only reclaim report; prune = execute the safe reclaim (build cache + dangling images only)',
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
additionalProperties: false,
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: 'backup_app',
|
|
169
|
+
description: 'Back up an installed app — a permission-safe snapshot of its Docker named volumes, bind-mount data directories under the app dir, and config (.env/app.yaml) into a single archive. The app is briefly stopped for a consistent snapshot and restarted afterward. Returns a jobId; poll with poll_install_job. Older backups beyond the retention limit are pruned automatically.',
|
|
170
|
+
inputSchema: {
|
|
171
|
+
type: 'object',
|
|
172
|
+
properties: {
|
|
173
|
+
name: { type: 'string', description: 'App name to back up' },
|
|
174
|
+
},
|
|
175
|
+
required: ['name'],
|
|
176
|
+
additionalProperties: false,
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
name: 'restore_app',
|
|
181
|
+
description: "Restore an app's Docker named volumes, bind-mount data directories under the app dir, and config from a prior backup, then start it on the restored data. Restoring a backup from a different app version is allowed but may warn about schema/migration mismatch. Returns a jobId; poll with poll_install_job. Use list_backups to pick a backup_id.",
|
|
182
|
+
inputSchema: {
|
|
183
|
+
type: 'object',
|
|
184
|
+
properties: {
|
|
185
|
+
name: { type: 'string', description: 'App name to restore' },
|
|
186
|
+
backup_id: { type: 'string', description: 'Backup id to restore (from list_backups)' },
|
|
187
|
+
},
|
|
188
|
+
required: ['name', 'backup_id'],
|
|
189
|
+
additionalProperties: false,
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
name: 'list_backups',
|
|
194
|
+
description: "List an app's backups, newest first: each entry has id, createdAt, sizeBytes, and appVersion. Use the id with restore_app.",
|
|
195
|
+
inputSchema: {
|
|
196
|
+
type: 'object',
|
|
197
|
+
properties: {
|
|
198
|
+
name: { type: 'string', description: 'App name' },
|
|
199
|
+
},
|
|
200
|
+
required: ['name'],
|
|
201
|
+
additionalProperties: false,
|
|
202
|
+
},
|
|
203
|
+
},
|
|
152
204
|
];
|
|
153
205
|
}
|
|
154
206
|
|
|
@@ -227,6 +279,31 @@ export class AppsModule implements ToolModule {
|
|
|
227
279
|
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
228
280
|
}
|
|
229
281
|
|
|
282
|
+
case 'docker_housekeeping': {
|
|
283
|
+
const mode = (args['mode'] as 'report' | 'prune' | undefined) ?? 'report';
|
|
284
|
+
const data = await client.housekeeping(mode);
|
|
285
|
+
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
case 'backup_app': {
|
|
289
|
+
const appName = args['name'] as string;
|
|
290
|
+
const data = await client.backup(appName);
|
|
291
|
+
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
case 'restore_app': {
|
|
295
|
+
const appName = args['name'] as string;
|
|
296
|
+
const backupId = args['backup_id'] as string;
|
|
297
|
+
const data = await client.restore(appName, backupId);
|
|
298
|
+
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
case 'list_backups': {
|
|
302
|
+
const appName = args['name'] as string;
|
|
303
|
+
const data = await client.listBackups(appName);
|
|
304
|
+
return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
|
|
305
|
+
}
|
|
306
|
+
|
|
230
307
|
default:
|
|
231
308
|
return {
|
|
232
309
|
content: [{ type: 'text', text: `Unknown tool: ${name}` }],
|
|
@@ -80,6 +80,9 @@ Rules for port type:
|
|
|
80
80
|
Rules for environment variables:
|
|
81
81
|
- If the Dockerfile has `ENV FOO=bar` → `FOO=bar` (has default)
|
|
82
82
|
- If you see `ARG FOO` or `ENV FOO` with no value → `FOO` (secret, no default — installer prompts for it)
|
|
83
|
+
- If the value has a **sensible default the operator should still be able to override** (e.g. `NEXTAUTH_URL`, a public base URL, a tunable timeout) → `FOO=!default:<value>`. It is prompted like a bare key (visible and editable in the install UI, pre-filled with `<value>`), but if the operator leaves it blank the default is written to `.env` — so the app never boots with an empty required field.
|
|
84
|
+
- The value is taken verbatim and may contain `:` and `/` — e.g. `NEXTAUTH_URL=!default:http://localhost:3737`.
|
|
85
|
+
- Prefer this over a bare `FOO` whenever a good default exists, and over a static `FOO=value` whenever the operator should be able to change it at install.
|
|
83
86
|
- If the value is a **per-install random string** the user cannot meaningfully supply (session secret, DB password, internal API token) → `FOO=!generate:<encoding>:<bytes>`. The installer fills it with a fresh random value automatically, so the install never stalls asking for it.
|
|
84
87
|
- Encodings: `hex`, `base64`, `base64url` (use `base64url` when the value is embedded in a URL or connection string — it has no `+` `/` `=`). Length is `8`–`512` bytes.
|
|
85
88
|
- Examples: `NEXTAUTH_SECRET=!generate:base64:32`, `DB_PASSWORD=!generate:base64url:24`
|
|
@@ -54,23 +54,32 @@ Call `inspect_app` with the same source you will install (`github_url` [+ `commi
|
|
|
54
54
|
- `generatedKeys` — secrets the gateway **auto-generates** at install time
|
|
55
55
|
(declared as `KEY=!generate:...`). Do **not** prompt for these; just note they
|
|
56
56
|
will be generated.
|
|
57
|
+
- `secretDefaults` — defaults for prompt-with-default secrets (declared as
|
|
58
|
+
`KEY=!default:<value>`). These keys still appear in `secretKeys`, so prompt for
|
|
59
|
+
them — but **pre-fill the default** and tell the user they can keep it. If they
|
|
60
|
+
leave it blank, the default is written to `.env` (operator value → default →
|
|
61
|
+
empty).
|
|
57
62
|
|
|
58
63
|
This is essential for a **GitHub-URL** install: such apps have no registry entry,
|
|
59
64
|
so `browse_registry` cannot reveal their secrets — only `inspect_app` can.
|
|
60
65
|
|
|
61
|
-
If `inspect_app` reports `secretKeys`, prompt the user for each
|
|
66
|
+
If `inspect_app` reports `secretKeys`, prompt the user for each (showing the
|
|
67
|
+
default from `secretDefaults` when one exists):
|
|
62
68
|
|
|
63
69
|
```
|
|
64
70
|
This app requires the following environment variables:
|
|
65
71
|
MY_API_KEY — (no default)
|
|
66
72
|
SOME_TOKEN — (no default)
|
|
73
|
+
NEXTAUTH_URL — default: http://localhost:3737 (press enter to keep)
|
|
67
74
|
|
|
68
75
|
Please provide values, e.g.:
|
|
69
76
|
MY_API_KEY=xxx
|
|
70
77
|
SOME_TOKEN=yyy
|
|
71
78
|
```
|
|
72
79
|
|
|
73
|
-
Wait for the user's reply. Parse key=value pairs.
|
|
80
|
+
Wait for the user's reply. Parse key=value pairs. For a key with a default, an
|
|
81
|
+
omitted or blank value means "use the default" — do not send an empty string
|
|
82
|
+
expecting the app to fail.
|
|
74
83
|
|
|
75
84
|
If `secretKeys` is empty (only `generatedKeys`, or no secrets at all), proceed
|
|
76
85
|
immediately — do not invent secrets or ask for ones the app did not declare.
|