@edgegap/mcp 0.14.1 → 0.14.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/README.md +1 -1
- package/dist/outputs.js +1 -0
- package/dist/tools.js +79 -30
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -213,7 +213,7 @@ To keep your API token on your own machine, run the server locally instead. Leav
|
|
|
213
213
|
}
|
|
214
214
|
```
|
|
215
215
|
|
|
216
|
-
Needs Node 18+. Pin a version in production (`@edgegap/mcp@0.14.
|
|
216
|
+
Needs Node 18+. Pin a version in production (`@edgegap/mcp@0.14.2`) rather than floating on latest. Registered in the official MCP registry as `dev.edgegap/mcp`.
|
|
217
217
|
|
|
218
218
|
The local server can also limit what an agent can do. These variables have no effect on the hosted endpoint at `mcp.edgegap.dev`:
|
|
219
219
|
|
package/dist/outputs.js
CHANGED
package/dist/tools.js
CHANGED
|
@@ -301,6 +301,12 @@ function errorHint(err, notFound, forbidden) {
|
|
|
301
301
|
case 409:
|
|
302
302
|
return 'a resource with that name already exists. Pick a different name or reuse the existing one.';
|
|
303
303
|
case 422:
|
|
304
|
+
// require_cached_locations on a version without force_cache (live, 2026-10-28).
|
|
305
|
+
if (/caching disabled|enable caching/i.test(err.apiMessage)) {
|
|
306
|
+
return ('require_cached_locations needs image caching on the version. Turn it on with edgegap_update_app_version ' +
|
|
307
|
+
'force_cache: true and wait for caching_percent (edgegap_get_app_version) to rise, or deploy without ' +
|
|
308
|
+
'require_cached_locations.');
|
|
309
|
+
}
|
|
304
310
|
return 'Edgegap could not allocate a server for the requested location or resources. Try different user coordinates, or lower cpu_units/memory_mb.';
|
|
305
311
|
case 424:
|
|
306
312
|
return 'Edgegap could not pull the container image. Check docker_repository, docker_image, docker_tag, and registry credentials.';
|
|
@@ -407,10 +413,11 @@ function compactDeployment(d) {
|
|
|
407
413
|
}
|
|
408
414
|
/** The version fields every version tool shows. Never the registry token. */
|
|
409
415
|
function compactVersion(v) {
|
|
416
|
+
const ref = [v.docker_repository, v.docker_image].filter(Boolean).join('/');
|
|
410
417
|
return {
|
|
411
418
|
name: v.name,
|
|
412
419
|
active: v.is_active,
|
|
413
|
-
image:
|
|
420
|
+
image: v.docker_tag ? `${ref}:${v.docker_tag}` : ref,
|
|
414
421
|
// Whether a login is set, never the login itself: the API returns the
|
|
415
422
|
// registry token in version responses.
|
|
416
423
|
registry_credentials_set: Boolean(v.private_username && v.private_token),
|
|
@@ -924,8 +931,8 @@ export function registerTools(server, client, config, auth, options = {}) {
|
|
|
924
931
|
tool('edgegap_get_app_version', {
|
|
925
932
|
title: 'Get one application version',
|
|
926
933
|
description: 'Read one version in full: image, resources, ports, max_duration, whether image caching ' +
|
|
927
|
-
'(force_cache) and verify_image are on, restart policy,
|
|
928
|
-
'(values are never shown). Use it before edgegap_update_app_version or edgegap_deploy ' +
|
|
934
|
+
'(force_cache) and verify_image are on, restart policy, the Endpoint Storage its logs go to, and the names ' +
|
|
935
|
+
'of its env vars (values are never shown). Use it before edgegap_update_app_version or edgegap_deploy ' +
|
|
929
936
|
'to check what a version will do.',
|
|
930
937
|
inputSchema: {
|
|
931
938
|
application: z.string().describe('Application name.'),
|
|
@@ -943,6 +950,7 @@ export function registerTools(server, client, config, auth, options = {}) {
|
|
|
943
950
|
verify_image: v.verify_image,
|
|
944
951
|
restart_policy: v.restart_policy,
|
|
945
952
|
termination_grace_period_seconds: v.termination_grace_period_seconds,
|
|
953
|
+
endpoint_storage: v.endpoint_storage || undefined,
|
|
946
954
|
time_to_deploy_seconds: v.time_to_deploy,
|
|
947
955
|
env: v.envs?.map((e) => ({ key: e.key, hidden: e.is_hidden ?? false })),
|
|
948
956
|
...autoStop(v.max_duration),
|
|
@@ -1403,7 +1411,8 @@ export function registerTools(server, client, config, auth, options = {}) {
|
|
|
1403
1411
|
require_cached_locations: z
|
|
1404
1412
|
.boolean()
|
|
1405
1413
|
.optional()
|
|
1406
|
-
.describe('Only place it where the image is already cached: starts faster, fewer places to choose from.'
|
|
1414
|
+
.describe('Only place it where the image is already cached: starts faster, fewer places to choose from. Needs ' +
|
|
1415
|
+
'force_cache on the version (edgegap_update_app_version); without it the API refuses the deploy.'),
|
|
1407
1416
|
webhook_on_ready: z.string().optional().describe('https URL Edgegap POSTs to when the server is ready.'),
|
|
1408
1417
|
webhook_on_error: z.string().optional().describe('https URL Edgegap POSTs to when the deployment fails.'),
|
|
1409
1418
|
webhook_on_terminated: z.string().optional().describe('https URL Edgegap POSTs to when the deployment ends.'),
|
|
@@ -1492,19 +1501,30 @@ export function registerTools(server, client, config, auth, options = {}) {
|
|
|
1492
1501
|
`(EDGEGAP_MAX_DEPLOYS_PER_RUN=${perRun}). Nothing was sent. Stop what is running and ask the developer; ` +
|
|
1493
1502
|
'restarting the MCP server resets the count.');
|
|
1494
1503
|
}
|
|
1495
|
-
|
|
1504
|
+
// Edgegap has no per-deployment time limit: a deployment runs until
|
|
1505
|
+
// stopped or until its version's max_duration (default 1440 minutes,
|
|
1506
|
+
// a full day). Read it first so the agent knows how long an
|
|
1507
|
+
// unstopped test server will keep billing. A dry run reads it too,
|
|
1508
|
+
// so it previews the refusals below, but only with a token already
|
|
1509
|
+
// in hand (a dry run must not trigger the token prompt); if the read
|
|
1510
|
+
// fails, it still shows the request and says what it could not check.
|
|
1511
|
+
let version;
|
|
1512
|
+
try {
|
|
1513
|
+
if (args.dry_run && !auth.current)
|
|
1514
|
+
throw new Error('no API token in this session yet');
|
|
1515
|
+
version = await client.getAppVersion(args.application, args.version);
|
|
1516
|
+
}
|
|
1517
|
+
catch (err) {
|
|
1518
|
+
if (!args.dry_run)
|
|
1519
|
+
throw err;
|
|
1496
1520
|
const dry = client.dryRun();
|
|
1497
1521
|
await send(dry.client);
|
|
1498
1522
|
return dryRunResult(dry.requests, [
|
|
1499
1523
|
`Tagged "${AGENT_TAG}" automatically.`,
|
|
1500
|
-
|
|
1524
|
+
`Could not read the version (${err instanceof Error ? err.message.split('\n')[0] : String(err)}), so ` +
|
|
1525
|
+
'the docker tag, max_duration and running-deployment checks did not run. A real deploy runs them.',
|
|
1501
1526
|
]);
|
|
1502
1527
|
}
|
|
1503
|
-
// Edgegap has no per-deployment time limit: a deployment runs until
|
|
1504
|
-
// stopped or until its version's max_duration (default 1440 minutes,
|
|
1505
|
-
// a full day). Read it first so the agent knows how long an
|
|
1506
|
-
// unstopped test server will keep billing.
|
|
1507
|
-
const version = await client.getAppVersion(args.application, args.version);
|
|
1508
1528
|
if (version.docker_tag !== undefined && badTag(version.docker_tag)) {
|
|
1509
1529
|
return fail(`Refused: version "${args.version}" uses docker_tag "${version.docker_tag}". ${TAG_FIX} ` +
|
|
1510
1530
|
'Then create a new version with edgegap_create_app_version and deploy that.');
|
|
@@ -1534,32 +1554,49 @@ export function registerTools(server, client, config, auth, options = {}) {
|
|
|
1534
1554
|
'using edgegap_stop_deployment, then deploy again.');
|
|
1535
1555
|
}
|
|
1536
1556
|
}
|
|
1537
|
-
|
|
1557
|
+
if (args.dry_run) {
|
|
1558
|
+
const dry = client.dryRun();
|
|
1559
|
+
await send(dry.client);
|
|
1560
|
+
const stop = autoStop(version.max_duration);
|
|
1561
|
+
return dryRunResult(dry.requests, [
|
|
1562
|
+
`Tagged "${AGENT_TAG}" automatically.`,
|
|
1563
|
+
...(longRunning ? ['long_running: allowed by allow_long_running.'] : []),
|
|
1564
|
+
typeof stop.auto_stop_after_minutes === 'number'
|
|
1565
|
+
? `Auto-stop: after ${stop.auto_stop_after_minutes} minutes (the version's max_duration).`
|
|
1566
|
+
: `Auto-stop: ${stop.auto_stop}.`,
|
|
1567
|
+
]);
|
|
1568
|
+
}
|
|
1569
|
+
// A refused deploy can still leave a deployment behind (a 422 "not
|
|
1570
|
+
// enough space" did, 2026-10-28) with no request_id in the error.
|
|
1571
|
+
// The lookup looks back a minute for clock skew, which also catches
|
|
1572
|
+
// deploys of the same version made just before this one (live,
|
|
1573
|
+
// 2026-10-28), so note those first and leave them out afterwards.
|
|
1538
1574
|
const sentAt = new Date(Date.now() - 60_000).toISOString();
|
|
1575
|
+
const recentQuery = {
|
|
1576
|
+
query: JSON.stringify({
|
|
1577
|
+
filters: [
|
|
1578
|
+
{ field: 'application', operator: 'eq', value: args.application },
|
|
1579
|
+
{ field: 'version', operator: 'eq', value: args.version },
|
|
1580
|
+
{ field: 'tags', operator: 'in', value: [AGENT_TAG] },
|
|
1581
|
+
{ field: 'created_at', operator: 'gte', value: sentAt },
|
|
1582
|
+
],
|
|
1583
|
+
}),
|
|
1584
|
+
limit: 100,
|
|
1585
|
+
};
|
|
1586
|
+
const recentIds = () => client
|
|
1587
|
+
.listDeployments(recentQuery)
|
|
1588
|
+
.then((r) => (r.data ?? []).map((d) => d.request_id).filter(Boolean))
|
|
1589
|
+
.catch(() => []);
|
|
1590
|
+
const before = new Set(await recentIds());
|
|
1591
|
+
deploysSent++;
|
|
1539
1592
|
let res;
|
|
1540
1593
|
try {
|
|
1541
1594
|
res = await send(client);
|
|
1542
1595
|
}
|
|
1543
1596
|
catch (err) {
|
|
1544
|
-
// A refused deploy can still leave a deployment behind (a 422
|
|
1545
|
-
// "not enough space" did, 2026-10-28) with no request_id in the
|
|
1546
|
-
// error. Name it so the agent can stop it.
|
|
1547
1597
|
if (!(err instanceof EdgegapApiError))
|
|
1548
1598
|
throw err;
|
|
1549
|
-
const left = await
|
|
1550
|
-
.listDeployments({
|
|
1551
|
-
query: JSON.stringify({
|
|
1552
|
-
filters: [
|
|
1553
|
-
{ field: 'application', operator: 'eq', value: args.application },
|
|
1554
|
-
{ field: 'version', operator: 'eq', value: args.version },
|
|
1555
|
-
{ field: 'tags', operator: 'in', value: [AGENT_TAG] },
|
|
1556
|
-
{ field: 'created_at', operator: 'gte', value: sentAt },
|
|
1557
|
-
],
|
|
1558
|
-
}),
|
|
1559
|
-
limit: 10,
|
|
1560
|
-
})
|
|
1561
|
-
.then((r) => (r.data ?? []).map((d) => d.request_id).filter(Boolean))
|
|
1562
|
-
.catch(() => []);
|
|
1599
|
+
const left = (await recentIds()).filter((id) => !before.has(id));
|
|
1563
1600
|
if (left.length === 0)
|
|
1564
1601
|
throw err;
|
|
1565
1602
|
throw new EdgegapApiError(err.status, `${err.apiMessage}\nThe API still created ${left.length === 1 ? 'a deployment' : 'deployments'} for this ` +
|
|
@@ -2583,7 +2620,11 @@ export function registerTools(server, client, config, auth, options = {}) {
|
|
|
2583
2620
|
inputSchema: {
|
|
2584
2621
|
endpoint_storage: z.string().min(1).describe('Endpoint Storage name, from edgegap_list_endpoint_storage.'),
|
|
2585
2622
|
name: z.string().min(1).describe('Name for the profile, e.g. "maps".'),
|
|
2586
|
-
source: z
|
|
2623
|
+
source: z
|
|
2624
|
+
.string()
|
|
2625
|
+
.min(1)
|
|
2626
|
+
.describe('Path in the bucket, starting with "/" and without a trailing "/", e.g. "/maps" or "/config/server.json". ' +
|
|
2627
|
+
'Letters, digits, "_", "-", "+" and "." only.'),
|
|
2587
2628
|
source_type: z.enum(['File', 'Folder']).describe('Whether source is a file or a folder.'),
|
|
2588
2629
|
destination: z.string().min(1).describe('Absolute path in the container, e.g. "/data/maps".'),
|
|
2589
2630
|
dry_run: dryRunParam,
|
|
@@ -2592,6 +2633,14 @@ export function registerTools(server, client, config, auth, options = {}) {
|
|
|
2592
2633
|
}, async (args) => guard(auth, async () => {
|
|
2593
2634
|
if (!args.destination.startsWith('/'))
|
|
2594
2635
|
return fail('destination must be an absolute container path, e.g. "/data/maps".');
|
|
2636
|
+
// The API's pattern is ^((\/{1}[A-z0-9-+.]+)*)*$ (live, 2026-10-28): "maps/" is refused.
|
|
2637
|
+
const bucketPath = /^(\/[A-Za-z0-9_+.-]+)+$/;
|
|
2638
|
+
if (!bucketPath.test(args.source)) {
|
|
2639
|
+
const suggestion = `/${args.source.split('/').filter(Boolean).join('/')}`;
|
|
2640
|
+
return fail(`source "${args.source.slice(0, 80)}" is not a bucket path Edgegap accepts: start it with "/", drop any ` +
|
|
2641
|
+
`trailing "/", and use only letters, digits, "_", "-", "+" and "." in each part` +
|
|
2642
|
+
(bucketPath.test(suggestion) ? `, e.g. "${suggestion}".` : '.'));
|
|
2643
|
+
}
|
|
2595
2644
|
const body = { name: args.name, source: args.source, source_type: args.source_type, destination: args.destination };
|
|
2596
2645
|
if (args.dry_run) {
|
|
2597
2646
|
const dry = client.dryRun();
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edgegap/mcp",
|
|
3
3
|
"mcpName": "dev.edgegap/mcp",
|
|
4
|
-
"version": "0.14.
|
|
4
|
+
"version": "0.14.2",
|
|
5
5
|
"description": "Check, push, and deploy game servers on Edgegap from your coding agent, with relays for P2P games. Runs locally; your API token never leaves your machine.",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"prebuild": "rm -rf dist",
|