@edgegap/mcp 0.10.0 → 0.11.0

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 CHANGED
@@ -78,10 +78,16 @@ claude mcp add --transport http edgegap https://mcp.edgegap.dev/mcp \
78
78
 
79
79
  #### ChatGPT Codex
80
80
 
81
- ```bash
82
- codex mcp add edgegap --url https://mcp.edgegap.dev/mcp
81
+ Codex reads the token from an environment variable and sends it as `Authorization: Bearer <token>`, which the hosted endpoint accepts. In `~/.codex/config.toml`:
82
+
83
+ ```toml
84
+ [mcp_servers.edgegap]
85
+ url = "https://mcp.edgegap.dev/mcp"
86
+ bearer_token_env_var = "EDGEGAP_API_TOKEN"
83
87
  ```
84
88
 
89
+ Then set `EDGEGAP_API_TOKEN` to your token in the environment Codex starts from.
90
+
85
91
  #### Claude Desktop and claude.ai
86
92
 
87
93
  Custom connectors in claude.ai and Claude Desktop cannot send an `Authorization` header, so the hosted endpoint never receives your token from them: the connector shows as connected, but every tool call fails. Use the [Local Server](#local-server) instead.
@@ -161,14 +167,14 @@ To keep your API token on your own machine, run the server locally instead. Leav
161
167
  }
162
168
  ```
163
169
 
164
- Needs Node 18+. Pin a version in production (`@edgegap/mcp@0.10.0`) rather than floating on latest. Registered in the official MCP registry as `dev.edgegap/mcp`.
170
+ Needs Node 18+. Pin a version in production (`@edgegap/mcp@0.11.0`) rather than floating on latest. Registered in the official MCP registry as `dev.edgegap/mcp`.
165
171
 
166
172
  The local server can also limit what an agent can do. These variables have no effect on the hosted endpoint at `mcp.edgegap.dev`:
167
173
 
168
174
  | Variable | Default | Purpose |
169
175
  | --- | --- | --- |
170
176
  | `EDGEGAP_API_TOKEN` | *(prompted)* | API token. Optional: omit it and you're asked at first use. The `token ` prefix is added for you. Never pass it as a command-line argument. |
171
- | `EDGEGAP_READ_ONLY` | `0` | Set to `1` and the eight mutating tools are never registered, so the agent cannot be talked into calling them. |
177
+ | `EDGEGAP_READ_ONLY` | `0` | Set to `1` and the tools that change something (marked ● in [Tools](#-tools)) are never registered, so the agent cannot be talked into calling them. |
172
178
  | `EDGEGAP_APP_ALLOWLIST` | *(empty)* | Comma-separated application names. Limits what the agent can create and deploy into. Reading (listing apps and versions) is not limited, and neither is touching deployments once running. See [DESIGN.md](DESIGN.md#scope-of-the-allowlist). |
173
179
  | `EDGEGAP_MAX_DURATION_MINUTES` | `60` | Ceiling on `max_duration` the agent may set on a version. |
174
180
  | `EDGEGAP_MAX_AGENT_DEPLOYMENTS` | `5` | `edgegap_deploy` refuses while this many deployments tagged `edgegap-mcp` are running. `0` turns the cap off. |
@@ -201,7 +207,7 @@ They're served three ways, so every MCP client can reach them:
201
207
 
202
208
  - **Tools:** `edgegap_list_skills` and `edgegap_get_skill`, which loads a skill's `SKILL.md`, or one of its reference documents or templates with `file`.
203
209
  - **Prompts:** one per skill, named after it. In Claude Code they show up as slash commands, e.g. `/mcp__edgegap__edgegap-unity`.
204
- - **Resources:** one per file, at `edgegap-skill://<skill>/<path>`, e.g. `edgegap-skill://edgegap-unity/references/deploy.md`.
210
+ - **Resources:** each skill's `SKILL.md` is listed, at `edgegap-skill://<skill>/SKILL.md`; every other file is read through the `edgegap-skill://{skill}/{+path}` template, e.g. `edgegap-skill://edgegap-unity/references/deploy.md`.
205
211
 
206
212
  Each release bundles the skills at the commit pinned in `scripts/skills-pin.txt`; `edgegap_context` reports which pack is loaded. `edgegap_list_skills` also reads the latest pack version from GitHub (one version number, cached for an hour; `EDGEGAP_SKILLS_CHECK=off` turns it off) and says when a newer one is out, and `edgegap_get_skill` adds the same note under a skill's header.
207
213
 
@@ -235,7 +241,7 @@ Your agent picks the right tool from your request. You don't need to name them,
235
241
  | `edgegap_list_app_versions` | Lists versions with their image, resources, ports (with TLS Upgrade), and whether a registry login is set. |
236
242
  | `edgegap_get_app_version` | Reads one version in full: image, resources, ports, max duration, image caching, restart policy, and env var names (never values). |
237
243
  | `edgegap_create_app_version` ● | Registers a container image as a deployable version. Supports TLS Upgrade on WS and HTTP ports, which browser (WebGL) clients need for `wss://`. |
238
- | `edgegap_update_app_version` ● | Changes an existing version: a new image tag, on/off, max duration, registry login, image caching (`force_cache`), shutdown grace period. Only the fields passed change; running deployments keep the old settings. |
244
+ | `edgegap_update_app_version` ● | Changes an existing version: a new image tag, on/off, max duration, registry login, image caching (`force_cache`), shutdown grace period, ports, env vars. Only the fields passed change, but `ports` and `env` replace the whole list. Running deployments keep the old settings. |
239
245
  | `edgegap_list_locations` | Lists the cities Edgegap deploys to, or, for one version, only those with capacity right now. |
240
246
  | `edgegap_list_ping_beacons` | Lists the ping beacons game clients measure latency against before matchmaking. |
241
247
  | `edgegap_deploy` ● | Deploys an authoritative dedicated server close to your players. Always tagged `edgegap-mcp`, and reports when Edgegap will stop it. |
@@ -342,10 +348,10 @@ docker run --rm -p 8080:8080 edgegap-mcp
342
348
 
343
349
  Clients connect to `http://<host>:8080/mcp` with their own `Authorization` header, the same way they connect to the hosted endpoint. The image holds no credential, and `/health` answers without one. `PORT`, `HOST`, `EDGEGAP_READ_ONLY`, `EDGEGAP_APP_ALLOWLIST`, `EDGEGAP_MAX_DURATION_MINUTES` and `EDGEGAP_MAX_AGENT_DEPLOYMENTS` apply. Read [worker/DECISION.md](worker/DECISION.md) before exposing it beyond a private network.
344
350
 
345
- Prebuilt images for `linux/amd64` and `linux/arm64` are published to `ghcr.io/edgegap/edgegap-mcp`, tagged `main` and `sha-<commit>` on every push to `main`, plus the version on `v*` tags:
351
+ Prebuilt images for `linux/amd64` and `linux/arm64` are published to `ghcr.io/edgegap/llm-mcp-server` (and, for existing setups, the old name `ghcr.io/edgegap/edgegap-mcp`), tagged `main` and `sha-<commit>` on every push to `main`, plus the version on `v*` tags:
346
352
 
347
353
  ```bash
348
- docker run --rm -p 8080:8080 ghcr.io/edgegap/edgegap-mcp:main
354
+ docker run --rm -p 8080:8080 ghcr.io/edgegap/llm-mcp-server:main
349
355
  ```
350
356
 
351
357
  ## Development
@@ -0,0 +1,128 @@
1
+ /**
2
+ * Output schemas for the tools whose results have a stable shape. Clients that
3
+ * read structuredContent can rely on these fields; the JSON text in content is
4
+ * the same payload.
5
+ *
6
+ * Deliberately loose: every field is optional, and objects keep
7
+ * fields not listed here. The SDK rejects a successful result that does not
8
+ * match its tool's schema, so a schema stricter than the Edgegap API's own
9
+ * answers would turn a working call into an error. They document the fields
10
+ * agents use, rather than police them. ok() drops null fields, so no schema
11
+ * needs nullable (each one doubles the JSON Schema). Dry runs of write tools return their
12
+ * own fields (dry_run, sent, requests), which pass for the same reason.
13
+ */
14
+ import { z } from 'zod';
15
+ const str = z.string().optional();
16
+ const num = z.number().optional();
17
+ const bool = z.boolean().optional();
18
+ const strs = z.array(z.string()).optional();
19
+ const obj = (shape) => z.looseObject(shape).optional();
20
+ const list = (shape) => z.array(z.looseObject(shape)).optional();
21
+ /** total, and when a page is short: showing, truncated, next_step. */
22
+ const page = { total: num, showing: num, truncated: bool, next_step: str };
23
+ const port = { name: str, port: num, protocol: str, tls_upgrade: bool };
24
+ const version = {
25
+ name: str,
26
+ active: bool,
27
+ image: str,
28
+ registry_credentials_set: bool,
29
+ cpu_units: num,
30
+ memory_mb: num,
31
+ max_duration_minutes: num,
32
+ ports: list(port),
33
+ };
34
+ const deployment = {
35
+ request_id: str,
36
+ status: str,
37
+ running: bool,
38
+ ready: bool,
39
+ error: bool,
40
+ error_detail: str,
41
+ fqdn: str,
42
+ public_ip: str,
43
+ application: str,
44
+ version: str,
45
+ location: str,
46
+ elapsed_seconds: num,
47
+ ports: list({ name: str, connect: str, external: num, internal: num, protocol: str }),
48
+ next_step: str,
49
+ };
50
+ const series = obj({ latest: num, average: num, peak: num, samples: num, labels: strs, from: str, to: str });
51
+ /** Loose at the top level too: a raw shape becomes additionalProperties: false
52
+ * in JSON Schema, and clients that validate results reject extra fields. */
53
+ const out = (shape) => z.looseObject(shape);
54
+ const shapes = {
55
+ context: {
56
+ server: str,
57
+ transport: str,
58
+ api_host: str,
59
+ api_base_url: str,
60
+ read_only: bool,
61
+ max_duration_ceiling_minutes: num,
62
+ skills_pack: str,
63
+ forced_deploy_tag: str,
64
+ guardrails: obj({}),
65
+ },
66
+ listApps: { ...page, applications: list({ name: str, active: bool, last_updated: str }) },
67
+ listAppVersions: { application: str, ...page, versions: list(version) },
68
+ getAppVersion: {
69
+ application: str,
70
+ ...version,
71
+ force_cache: bool,
72
+ caching_percent: num,
73
+ verify_image: bool,
74
+ restart_policy: str,
75
+ termination_grace_period_seconds: num,
76
+ env: list({ key: str, hidden: bool }),
77
+ auto_stop_after_minutes: num,
78
+ auto_stop: str,
79
+ warning: str,
80
+ },
81
+ listLocations: {
82
+ filtered_for: str,
83
+ ...page,
84
+ locations: list({ city: str, region: str, country: str, continent: str, latitude: num, longitude: num }),
85
+ messages: strs,
86
+ },
87
+ listPingBeacons: { total: num, beacons: list({ host: str, udp_port: num, tcp_port: num, city: str, country: str, continent: str }) },
88
+ deploy: {
89
+ request_id: str,
90
+ status: str,
91
+ tags: strs,
92
+ auto_stop_after_minutes: num,
93
+ auto_stop: str,
94
+ warning: str,
95
+ resources: obj({ cpu_units: num, memory_mib: num }),
96
+ next_step: str,
97
+ },
98
+ deployment,
99
+ waitForDeployment: { ...deployment, waited_seconds: num },
100
+ listDeployments: { ...page, deployments: list({ request_id: str, ready: bool, fqdn: str, started: str, tags: strs }) },
101
+ metrics: {
102
+ request_id: str,
103
+ cpu: series,
104
+ cpu_throttle_rate: series,
105
+ memory: series,
106
+ network_receive: series,
107
+ network_transmit: series,
108
+ totals: obj({ received: num, transmitted: num, disk_read: num, disk_written: num }),
109
+ note: str,
110
+ },
111
+ listRegistryTags: {
112
+ image_name: str,
113
+ note: str,
114
+ ...page,
115
+ tags: list({ tag: str, pushed: str, size_mb: num, digest: str }),
116
+ },
117
+ listRelaySessions: {
118
+ ...page,
119
+ sessions: list({ session_id: str, status: str, ready: bool, linked: bool, players: num, relay: str, error: str }),
120
+ },
121
+ validateServerConfig: {
122
+ verdict: str,
123
+ engine: str,
124
+ errors: list({ severity: str, code: str, message: str, fix: str, line: num }),
125
+ warnings: list({ severity: str, code: str, message: str, fix: str, line: num }),
126
+ },
127
+ };
128
+ export const OUTPUT = Object.fromEntries(Object.entries(shapes).map(([k, v]) => [k, out(v)]));
package/dist/tools.js CHANGED
@@ -8,6 +8,7 @@
8
8
  * failure mode in agent flows is not a bad call, it is a call made out of order.
9
9
  */
10
10
  import { z } from 'zod';
11
+ import { ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';
11
12
  import { EdgegapApiError } from './client.js';
12
13
  import { assertAppAllowed, redact, hostLabel } from './config.js';
13
14
  import { VERSION } from './version.js';
@@ -16,6 +17,7 @@ import { validateServerConfig, PROTOCOLS, NETCODE_NAMES, } from './serverconfig.
16
17
  import { generateDockerfile, DockerfileInputError } from './dockerfile.js';
17
18
  import { buildMatchmakerConfig, DASHBOARD_URL } from './matchmaker.js';
18
19
  import { badImage, badTag, looksSecret, TAG_FIX } from './image.js';
20
+ import { OUTPUT } from './outputs.js';
19
21
  import { SKILLS_PACK, findSkill, findSkillFile, fileIndex, mimeType, skillUri } from './skills.js';
20
22
  import { SKILL_NAME_RE, compareVersions, latestPack, latestSkillVersions, servedPackStatus, skillsCheckFromEnv, } from './skillsversion.js';
21
23
  /**
@@ -110,8 +112,12 @@ const WS_PROTOCOLS = new Set(['WS', 'WEBSOCKET']);
110
112
  const TLS_PROTOCOLS = new Set(['WS', 'WEBSOCKET', 'HTTP']);
111
113
  const TERMINAL_OK = ['READY', 'STATUS_READY'];
112
114
  const TERMINAL_BAD = ['ERROR', 'STATUS_ERROR', 'TERMINATED', 'STATUS_TERMINATED'];
115
+ /** JSON.stringify replacer: null fields are left out, like undefined ones. The
116
+ * API sends many (fqdn before a deployment is placed, unset error_detail), and
117
+ * an absent field reads the same to an agent at fewer tokens. */
118
+ const dropNulls = (_key, value) => (value === null ? undefined : value);
113
119
  function ok(payload, notice) {
114
- const body = typeof payload === 'string' ? payload : JSON.stringify(payload, null, 2);
120
+ const body = typeof payload === 'string' ? payload : JSON.stringify(payload, dropNulls, 2);
115
121
  const structured = payload !== null && typeof payload === 'object' && !Array.isArray(payload)
116
122
  ? JSON.parse(body)
117
123
  : undefined;
@@ -497,6 +503,41 @@ function autoStop(maxDuration) {
497
503
  : {}),
498
504
  };
499
505
  }
506
+ /**
507
+ * Rewrites the SDK's "Input validation error: Invalid arguments for tool X:
508
+ * a: Invalid input: expected string, received undefined, b: ..." into one line
509
+ * per argument, plus the tool's required and optional parameters, so the agent
510
+ * can fix the call in one try. Undefined for any other message.
511
+ */
512
+ export function argumentError(message, inputs) {
513
+ const m = message.match(/Input validation error: Invalid arguments for tool (\S+?): ([\s\S]*)$/);
514
+ if (!m)
515
+ return undefined;
516
+ const [, toolName, detail] = m;
517
+ // Two wordings: SDK v1 (local) "expected string, received number at application",
518
+ // one per line; SDK v2 (hosted) "application: expected string, received number",
519
+ // comma-joined.
520
+ const problems = detail
521
+ .split('\n')
522
+ .flatMap((line) => line.split(/,\s+(?=[\w.[\]]+: )/))
523
+ .map((p) => p.trim())
524
+ .filter(Boolean)
525
+ .map((p) => {
526
+ const v2 = p.match(/^([\w.[\]]+): (?:Invalid input: )?expected (\w+), received (\w+)$/);
527
+ const v1 = p.match(/^(?:Invalid input: )?expected (\w+), received (\w+) at ([\w.[\]]+)$/);
528
+ const [field, want, got] = v2 ? [v2[1], v2[2], v2[3]] : v1 ? [v1[3], v1[1], v1[2]] : [];
529
+ if (!field)
530
+ return `- ${p}`;
531
+ return got === 'undefined' ? `- ${field}: missing (required)` : `- ${field}: must be ${want} (got ${got})`;
532
+ });
533
+ const shape = inputs.get(toolName) ?? {};
534
+ const required = Object.keys(shape).filter((k) => !shape[k].safeParse(undefined).success);
535
+ const optional = Object.keys(shape).filter((k) => !required.includes(k));
536
+ return (`Invalid arguments for ${toolName}. Nothing was sent.\n${problems.join('\n')}\n\n` +
537
+ `Required: ${required.join(', ') || 'none'}.` +
538
+ (optional.length ? ` Optional: ${optional.join(', ')}.` : '') +
539
+ ' Fix the arguments and call again.');
540
+ }
500
541
  /** Prepends "[api.edgegap.com]" (or "[custom · host]") to a tool result. */
501
542
  function withHost(result, label) {
502
543
  return { ...result, content: [{ type: 'text', text: `[${label}]` }, ...result.content] };
@@ -507,7 +548,23 @@ export function registerTools(server, client, config, auth, options = {}) {
507
548
  // at a custom EDGEGAP_BASE_URL can never be mistaken for production.
508
549
  const label = hostLabel(config);
509
550
  // ...and never carries the API token, whatever the API echoed back.
510
- const tool = ((name, def, cb) => server.registerTool(name, def, (async (...a) => withHost(scrubToken(await cb(...a), auth.current), label))));
551
+ const inputs = new Map();
552
+ const tool = ((name, def, cb) => {
553
+ inputs.set(name, (def.inputSchema) ?? {});
554
+ return server.registerTool(name, def, (async (...a) => withHost(scrubToken(await cb(...a), auth.current), label)));
555
+ });
556
+ // Errors the SDK raises itself (bad arguments, a handler that throws) skip
557
+ // the wrapper above. Both SDK versions route them through createToolError,
558
+ // so give those the same host label and token scrub, and turn argument
559
+ // errors into a list the agent can act on.
560
+ const sdk = server;
561
+ const sdkToolError = sdk.createToolError?.bind(server);
562
+ if (sdkToolError) {
563
+ sdk.createToolError = (message) => {
564
+ const friendly = argumentError(message, inputs);
565
+ return withHost(scrubToken(friendly ? fail(friendly) : sdkToolError(message), auth.current), label);
566
+ };
567
+ }
511
568
  // ---------------------------------------------------------------- 0 ----
512
569
  // No token, no network: describes this server's own configuration, so an
513
570
  // agent can check where it is pointed and what is allowed before acting.
@@ -519,6 +576,7 @@ export function registerTools(server, client, config, auth, options = {}) {
519
576
  'dry_run. Call it first when unsure what this session is allowed to do, or before ' +
520
577
  'anything billable. Makes no API call and never shows the token.',
521
578
  inputSchema: {},
579
+ outputSchema: OUTPUT.context,
522
580
  annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false },
523
581
  }, async () => {
524
582
  const hosted = config.transport === 'hosted';
@@ -570,6 +628,7 @@ export function registerTools(server, client, config, auth, options = {}) {
570
628
  limit: z.number().int().min(1).max(100).optional().describe('Results per page. Default 50.'),
571
629
  page: z.number().int().min(1).optional(),
572
630
  },
631
+ outputSchema: OUTPUT.listApps,
573
632
  annotations: { readOnlyHint: true, openWorldHint: true },
574
633
  }, async ({ limit, page }) => guard(auth, async () => {
575
634
  const res = await client.listApps({ limit: limit ?? 50, page });
@@ -649,6 +708,7 @@ export function registerTools(server, client, config, auth, options = {}) {
649
708
  inputSchema: {
650
709
  application: z.string().describe('Application name, as returned by edgegap_list_apps.'),
651
710
  },
711
+ outputSchema: OUTPUT.listAppVersions,
652
712
  annotations: { readOnlyHint: true, openWorldHint: true },
653
713
  }, async ({ application }) =>
654
714
  // Read-only, so not subject to EDGEGAP_APP_ALLOWLIST: the allowlist
@@ -669,6 +729,7 @@ export function registerTools(server, client, config, auth, options = {}) {
669
729
  application: z.string().describe('Application name.'),
670
730
  version: z.string().describe('Version name, as listed by edgegap_list_app_versions.'),
671
731
  },
732
+ outputSchema: OUTPUT.getAppVersion,
672
733
  annotations: { readOnlyHint: true, openWorldHint: true },
673
734
  }, async ({ application, version }) => guarded(auth, NOT_FOUND.app, async () => {
674
735
  const v = await client.getAppVersion(application, version);
@@ -855,8 +916,10 @@ export function registerTools(server, client, config, auth, options = {}) {
855
916
  'the shutdown grace period. Only the fields you pass change. Deployments already running ' +
856
917
  'keep their old settings; new deployments get the new ones. Same refusals as ' +
857
918
  'edgegap_create_app_version: "latest" or empty tags, a docker_image holding a host or ' +
858
- 'tag, and the API token in the registry login. Resources, ports and env vars cannot be ' +
859
- 'changed here; create a new version for those.',
919
+ 'tag, and the API token in the registry login or env vars. ports and env REPLACE the ' +
920
+ 'version\'s whole list (per the API): read the current ones with edgegap_get_app_version ' +
921
+ 'and pass every port or variable to keep. CPU and memory cannot be changed here; create a ' +
922
+ 'new version, or override them per deployment in edgegap_deploy.',
860
923
  inputSchema: {
861
924
  application: z.string().describe('Application name.'),
862
925
  version: z.string().describe('Version name to change.'),
@@ -880,6 +943,21 @@ export function registerTools(server, client, config, auth, options = {}) {
880
943
  .max(3600)
881
944
  .optional()
882
945
  .describe('Seconds between SIGTERM and SIGKILL when a deployment stops.'),
946
+ ports: z
947
+ .array(z.object({
948
+ port: z.number().int().min(1).max(59999).describe('Port the server listens on.'),
949
+ protocol: z.string().describe(`One of ${PROTOCOLS.join(', ')}. Most game servers use UDP.`),
950
+ name: z.string().optional().describe('Label, e.g. "gameport".'),
951
+ to_check: z.boolean().optional().describe('Readiness check on this port. Default true.'),
952
+ tls_upgrade: z.boolean().optional().describe('wss:// / https:// for browser clients. WS and HTTP ports only.'),
953
+ }))
954
+ .min(1)
955
+ .optional()
956
+ .describe('REPLACES every port on the version. Include the ports to keep, not only new ones.'),
957
+ env: z
958
+ .array(z.object({ key: z.string(), value: z.string() }))
959
+ .optional()
960
+ .describe('REPLACES every env var on the version; [] removes them all. Values are never echoed back.'),
883
961
  dry_run: dryRunParam,
884
962
  },
885
963
  annotations: { destructiveHint: false, idempotentHint: true, openWorldHint: true },
@@ -888,9 +966,18 @@ export function registerTools(server, client, config, auth, options = {}) {
888
966
  const leak = await tokenLeak(auth, args.dry_run, [
889
967
  ['registry_username', args.registry_username],
890
968
  ['registry_token', args.registry_token],
969
+ ...(args.env ?? []).flatMap((e) => [
970
+ [`env var name "${e.key.slice(0, 40)}"`, e.key],
971
+ [`the value of env var "${e.key.slice(0, 40)}"`, e.value],
972
+ ]),
891
973
  ]);
892
974
  if (leak)
893
975
  return leak;
976
+ const badTls = args.ports?.find((p) => p.tls_upgrade && !TLS_PROTOCOLS.has(p.protocol.toUpperCase()));
977
+ if (badTls) {
978
+ return fail(`Port ${badTls.port} is ${badTls.protocol}; tls_upgrade only works on WS and HTTP ports. ` +
979
+ 'Use protocol "WS" for a WebSocket server, or drop tls_upgrade.');
980
+ }
894
981
  if (args.docker_tag !== undefined) {
895
982
  const tagProblem = badTag(args.docker_tag);
896
983
  if (tagProblem)
@@ -915,6 +1002,14 @@ export function registerTools(server, client, config, auth, options = {}) {
915
1002
  force_cache: args.force_cache,
916
1003
  verify_image: args.verify_image,
917
1004
  termination_grace_period_seconds: args.termination_grace_period_seconds,
1005
+ ports: args.ports?.map((p) => ({
1006
+ port: p.port,
1007
+ protocol: p.protocol,
1008
+ name: p.name ?? 'gameport',
1009
+ to_check: p.to_check ?? true,
1010
+ tls_upgrade: p.tls_upgrade ?? false,
1011
+ })),
1012
+ envs: args.env?.map((e) => ({ key: e.key, value: e.value, is_hidden: looksSecret(e.key) })),
918
1013
  };
919
1014
  for (const k of Object.keys(body))
920
1015
  if (body[k] === undefined)
@@ -925,6 +1020,10 @@ export function registerTools(server, client, config, auth, options = {}) {
925
1020
  const notes = capped !== undefined && capped < (args.max_duration_minutes ?? 0)
926
1021
  ? [`max_duration capped to ${capped} minutes by EDGEGAP_MAX_DURATION_MINUTES.`]
927
1022
  : [];
1023
+ if (args.ports)
1024
+ notes.push(`ports replaced: the version now has exactly these ${args.ports.length}.`);
1025
+ if (args.env)
1026
+ notes.push(`env replaced: the version now has exactly these ${args.env.length} variables.`);
928
1027
  if (args.dry_run) {
929
1028
  const dry = client.dryRun();
930
1029
  await dry.client.updateAppVersion(args.application, args.version, body);
@@ -953,6 +1052,7 @@ export function registerTools(server, client, config, auth, options = {}) {
953
1052
  page: z.number().int().min(1).optional(),
954
1053
  limit: z.number().int().min(1).max(200).optional().describe('Default 100.'),
955
1054
  },
1055
+ outputSchema: OUTPUT.listLocations,
956
1056
  annotations: { readOnlyHint: true, openWorldHint: true },
957
1057
  }, async ({ application, version, page, limit }) => guarded(auth, NOT_FOUND.app, async () => {
958
1058
  if ((application === undefined) !== (version === undefined)) {
@@ -983,6 +1083,7 @@ export function registerTools(server, client, config, auth, options = {}) {
983
1083
  page: z.number().int().min(1).optional(),
984
1084
  limit: z.number().int().min(1).max(200).optional().describe('Default 100.'),
985
1085
  },
1086
+ outputSchema: OUTPUT.listPingBeacons,
986
1087
  annotations: { readOnlyHint: true, openWorldHint: true },
987
1088
  }, async ({ page, limit }) => guard(auth, async () => {
988
1089
  const res = await client.listBeacons({ page, limit: limit ?? 100 });
@@ -1028,10 +1129,16 @@ export function registerTools(server, client, config, auth, options = {}) {
1028
1129
  .int()
1029
1130
  .min(256)
1030
1131
  .optional()
1031
- .describe('Override the version CPU (with memory_mb). Not in the published v2 spec, so the API may ignore it; a version with the size you need is the reliable way.'),
1032
- memory_mb: z.number().int().min(256).optional().describe('Override the version memory (with cpu_units). Same caveat as cpu_units.'),
1132
+ .describe('Override the version\'s CPU for this deployment only, with memory_mb. 1024 = 1 vCPU.'),
1133
+ memory_mb: z
1134
+ .number()
1135
+ .int()
1136
+ .min(256)
1137
+ .optional()
1138
+ .describe('Override the version\'s memory for this deployment only, with cpu_units. At most 2x cpu_units.'),
1033
1139
  dry_run: dryRunParam,
1034
1140
  },
1141
+ outputSchema: OUTPUT.deploy,
1035
1142
  annotations: { destructiveHint: false, idempotentHint: false, openWorldHint: true },
1036
1143
  }, async (args) => guarded(auth, NOT_FOUND.app, async () => {
1037
1144
  assertAppAllowed(config, args.application);
@@ -1065,7 +1172,15 @@ export function registerTools(server, client, config, auth, options = {}) {
1065
1172
  is_hidden: looksSecret(e.key),
1066
1173
  }));
1067
1174
  }
1068
- if (args.cpu_units && args.memory_mb) {
1175
+ // The v2 API takes both or neither (DeploymentV2.resources).
1176
+ if ((args.cpu_units === undefined) !== (args.memory_mb === undefined)) {
1177
+ return fail('Pass both cpu_units and memory_mb to override the version\'s resources, or neither to use the version\'s.');
1178
+ }
1179
+ if (args.cpu_units !== undefined && args.memory_mb !== undefined) {
1180
+ if (args.memory_mb > args.cpu_units * 2) {
1181
+ return fail(`memory_mb (${args.memory_mb}) exceeds twice cpu_units (${args.cpu_units}). Edgegap rejects this. ` +
1182
+ `Lower memory_mb to ${args.cpu_units * 2} or raise cpu_units.`);
1183
+ }
1069
1184
  body.resources = { cpu_units: args.cpu_units, memory_mib: args.memory_mb };
1070
1185
  }
1071
1186
  if (args.dry_run) {
@@ -1106,13 +1221,7 @@ export function registerTools(server, client, config, auth, options = {}) {
1106
1221
  status: 'starting',
1107
1222
  tags,
1108
1223
  ...autoStop(version.max_duration),
1109
- // "resources" is not in the published v2 deploy schema
1110
- // (test/spec.mjs). Say so rather than promise the override.
1111
- resources_note: body.resources
1112
- ? 'cpu_units/memory_mb were sent, but the published v2 API does not document a per-deployment ' +
1113
- 'override, so the deployment may run with the version\'s size. For a different size, create a ' +
1114
- 'version with it.'
1115
- : undefined,
1224
+ resources: body.resources,
1116
1225
  next_step: `Call edgegap_wait_for_deployment with request_id ${res.request_id}.`,
1117
1226
  });
1118
1227
  }));
@@ -1126,6 +1235,7 @@ export function registerTools(server, client, config, auth, options = {}) {
1126
1235
  inputSchema: {
1127
1236
  request_id: z.string().describe('The request_id returned by edgegap_deploy.'),
1128
1237
  },
1238
+ outputSchema: OUTPUT.deployment,
1129
1239
  annotations: { readOnlyHint: true, openWorldHint: true },
1130
1240
  }, async ({ request_id }) => guarded(auth, NOT_FOUND.deployment, async () => {
1131
1241
  const d = await client.getDeployment(request_id);
@@ -1148,6 +1258,7 @@ export function registerTools(server, client, config, auth, options = {}) {
1148
1258
  .optional()
1149
1259
  .describe('How long to wait before giving up. Default 180.'),
1150
1260
  },
1261
+ outputSchema: OUTPUT.waitForDeployment,
1151
1262
  annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
1152
1263
  }, async ({ request_id, timeout_seconds }) => guarded(auth, NOT_FOUND.deployment, async () => {
1153
1264
  const budgetMs = (timeout_seconds ?? 180) * 1000;
@@ -1228,6 +1339,7 @@ export function registerTools(server, client, config, auth, options = {}) {
1228
1339
  .describe('e.g. [{field:"created_at",order:"asc"}] for oldest first.'),
1229
1340
  limit: z.number().int().min(1).max(100).optional().describe('Default 50.'),
1230
1341
  },
1342
+ outputSchema: OUTPUT.listDeployments,
1231
1343
  annotations: { readOnlyHint: true, openWorldHint: true },
1232
1344
  }, async ({ only_agent_deployments, filters: given, order_by, limit }) => guard(auth, async () => {
1233
1345
  let filters = given;
@@ -1335,6 +1447,7 @@ export function registerTools(server, client, config, auth, options = {}) {
1335
1447
  end_time: z.string().optional().describe('ISO 8601. Default: now, or when it stopped.'),
1336
1448
  step: z.string().optional().describe('Averaging step, e.g. "30s" or "5m". Default: the API\'s.'),
1337
1449
  },
1450
+ outputSchema: OUTPUT.metrics,
1338
1451
  annotations: { readOnlyHint: true, openWorldHint: true },
1339
1452
  }, async ({ request_id, start_time, end_time, step }) => guarded(auth, NOT_FOUND.deployment, async () => {
1340
1453
  const bad = checkRequestId(request_id);
@@ -1487,6 +1600,7 @@ export function registerTools(server, client, config, auth, options = {}) {
1487
1600
  docker_image: z.string().optional(),
1488
1601
  docker_tag: z.string().optional(),
1489
1602
  },
1603
+ outputSchema: OUTPUT.validateServerConfig,
1490
1604
  annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false },
1491
1605
  }, async (args) => {
1492
1606
  const { engine, errors, warnings } = validateServerConfig(args);
@@ -1621,6 +1735,7 @@ export function registerTools(server, client, config, auth, options = {}) {
1621
1735
  page: z.number().int().min(1).optional(),
1622
1736
  limit: z.number().int().min(1).max(100).optional().describe('Default 20.'),
1623
1737
  },
1738
+ outputSchema: OUTPUT.listRegistryTags,
1624
1739
  annotations: { readOnlyHint: true, openWorldHint: true },
1625
1740
  }, async ({ image_name, page, limit }) => guard(auth, async () => {
1626
1741
  // Agents often pass the full reference they pushed. Reduce it to what
@@ -1812,6 +1927,7 @@ export function registerTools(server, client, config, auth, options = {}) {
1812
1927
  'and delete them with edgegap_delete_relay_session. Authorization tokens are not listed; ' +
1813
1928
  'read one session with edgegap_get_relay_session.',
1814
1929
  inputSchema: {},
1930
+ outputSchema: OUTPUT.listRelaySessions,
1815
1931
  annotations: { readOnlyHint: true, openWorldHint: true },
1816
1932
  }, async () => guard(auth, async () => {
1817
1933
  const res = await client.listRelaySessions();
@@ -2023,14 +2139,11 @@ function registerSkills(server, tool, config, options) {
2023
2139
  title: 'List the Edgegap agent skills',
2024
2140
  description: 'List the Edgegap agent skills: tested, step-by-step workflows for getting a multiplayer ' +
2025
2141
  'game online on Edgegap, with templates (Dockerfiles, matchmaker configs, Unity C# and ' +
2026
- 'Unreal C++ drop-ins) and known pitfalls. Before working on a game project, load the ' +
2027
- 'matching skill with edgegap_get_skill: edgegap-ngo for Unity with Netcode for GameObjects, edgegap-fishnet for Unity with FishNet, ' +
2028
- 'edgegap-purrnet for Unity with PurrNet, edgegap-fusion for Unity with Photon Fusion 2, edgegap-unity for other Unity projects, edgegap-unreal for Unreal Engine ' +
2029
- '(edgegap-eos-voice to add voice chat to it), edgegap-fusion-simplefps for the Photon Simple FPS sample, edgegap-godot for Godot 4 with a Godot server, ' +
2030
- 'edgegap-colyseus for a Colyseus server, edgegap-nakama for a game with a Nakama backend, edgegap-playfab for a game that keeps PlayFab Matchmaking, ' +
2031
- 'edgegap-threejs for a Three.js or other browser game with its own Node.js server, ' +
2032
- 'edgegap-manus for a browser game built with Manus, edgegap for any other engine or platform questions; it routes to the rest. ' +
2033
- 'Also says whether a newer skills pack is on GitHub (reads one version number, no Edgegap API call).',
2142
+ 'Unreal C++ drop-ins) and known pitfalls. Each entry says which engine, netcode or backend ' +
2143
+ 'it is for, and the server instructions map projects to skills. Before working on a game ' +
2144
+ 'project, load the matching skill with edgegap_get_skill; "edgegap" covers any other engine ' +
2145
+ 'and routes to the rest. Also says whether a newer skills pack is on GitHub (reads one ' +
2146
+ 'version number, no Edgegap API call).',
2034
2147
  inputSchema: {},
2035
2148
  annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
2036
2149
  }, async () => {
@@ -2053,13 +2166,9 @@ function registerSkills(server, tool, config, options) {
2053
2166
  tool('edgegap_get_skill', {
2054
2167
  title: 'Load an Edgegap agent skill',
2055
2168
  description: 'Load one Edgegap agent skill: its SKILL.md (the workflow to follow) by default, or one of ' +
2056
- 'its reference documents or templates with file. Load the matching skill before acting on ' +
2057
- 'a game project — edgegap-ngo for Unity with Netcode for GameObjects, edgegap-fishnet for Unity with FishNet, ' +
2058
- 'edgegap-purrnet for Unity with PurrNet, edgegap-fusion for Unity with Photon Fusion 2, edgegap-unity for other Unity projects, edgegap-unreal for Unreal Engine ' +
2059
- '(edgegap-eos-voice for voice chat), edgegap-fusion-simplefps for the Photon Simple FPS sample, edgegap-godot for Godot 4 with a Godot server, ' +
2060
- 'edgegap-colyseus for a Colyseus server, edgegap-nakama for a Nakama backend, edgegap-playfab for PlayFab Matchmaking, ' +
2061
- 'edgegap-threejs for a Three.js/browser game with a Node.js server, ' +
2062
- 'edgegap-manus for a browser game built with Manus, edgegap otherwise — and fetch the references and templates it points to as you reach them. No API call.',
2169
+ 'its reference documents or templates with file. Load the skill that matches the project ' +
2170
+ 'before acting (the server instructions and edgegap_list_skills say which; "edgegap" when ' +
2171
+ 'unsure), then fetch the references and templates it points to as you reach them. No API call.',
2063
2172
  inputSchema: {
2064
2173
  // A string, not an enum: clients cache tool schemas, and a cached enum from an older
2065
2174
  // release would refuse a skill the router already points to. The handler checks the name.
@@ -2259,16 +2368,29 @@ function registerSkills(server, tool, config, options) {
2259
2368
  ],
2260
2369
  };
2261
2370
  });
2262
- // A resource per file.
2263
- for (const f of skill.files) {
2264
- const uri = skillUri(skill.name, f.path);
2265
- server.registerResource(`${skill.name}/${f.path}`, uri, {
2266
- title: f.path === 'SKILL.md' ? `${skill.name} skill` : `${skill.name}: ${f.path}`,
2267
- description: f.path === 'SKILL.md' ? skill.description : undefined,
2268
- mimeType: mimeType(f.path),
2269
- }, async () => ({ contents: [{ uri, mimeType: mimeType(f.path), text: f.content }] }));
2270
- }
2371
+ // Only each skill's SKILL.md is listed: 21 entries instead of every file
2372
+ // (257 in pack 0.15), which crowded clients' attach menus and resource
2373
+ // lists. The other files are read through the template below.
2374
+ const main = findSkillFile(skill);
2375
+ const uri = skillUri(skill.name, main.path);
2376
+ server.registerResource(`${skill.name}/${main.path}`, uri, { title: `${skill.name} skill`, description: skill.description, mimeType: mimeType(main.path) }, async () => ({ contents: [{ uri, mimeType: mimeType(main.path), text: main.content }] }));
2271
2377
  }
2378
+ // Any file in any skill, e.g. edgegap-skill://edgegap-unreal/assets/docker/Dockerfile.
2379
+ // {+path} keeps the slashes. Not listed (list: undefined): SKILL.md says
2380
+ // which files exist, and edgegap_get_skill lists them too.
2381
+ server.registerResource('edgegap-skill-file', new ResourceTemplate(`${skillUri('{skill}', '').replace(/\/$/, '')}/{+path}`, { list: undefined }), {
2382
+ title: 'Edgegap skill file',
2383
+ description: 'A reference document or template inside an Edgegap skill. SKILL.md lists the files it uses.',
2384
+ }, async (uri, vars) => {
2385
+ const skill = findSkill(String(vars.skill));
2386
+ const file = skill ? findSkillFile(skill, String(vars.path)) : undefined;
2387
+ if (!skill || !file) {
2388
+ throw new Error(skill
2389
+ ? `"${vars.path}" is not a file in the ${skill.name} skill. Its files are: ${skill.files.map((f) => f.path).join(', ')}`
2390
+ : `No skill named "${vars.skill}". The skills are: ${names.join(', ')}.`);
2391
+ }
2392
+ return { contents: [{ uri: uri.href, mimeType: mimeType(file.path), text: file.content }] };
2393
+ });
2272
2394
  }
2273
2395
  /**
2274
2396
  * What edgegap_get_registry_credentials says when Edgegap will not hand the
package/dist/version.js CHANGED
@@ -3,4 +3,4 @@
3
3
  * call, and by edgegap_context. Keep in step with package.json and server.json;
4
4
  * test/package.mjs fails the build when they disagree.
5
5
  */
6
- export const VERSION = '0.10.0';
6
+ export const VERSION = '0.11.0';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@edgegap/mcp",
3
3
  "mcpName": "dev.edgegap/mcp",
4
- "version": "0.10.0",
4
+ "version": "0.11.0",
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",
@@ -34,15 +34,15 @@
34
34
  "license": "Apache-2.0",
35
35
  "repository": {
36
36
  "type": "git",
37
- "url": "git+https://github.com/edgegap/edgegap-mcp.git"
37
+ "url": "git+https://github.com/edgegap/llm-mcp-server.git"
38
38
  },
39
- "homepage": "https://github.com/edgegap/edgegap-mcp#readme",
39
+ "homepage": "https://github.com/edgegap/llm-mcp-server#readme",
40
40
  "bugs": {
41
- "url": "https://github.com/edgegap/edgegap-mcp/issues"
41
+ "url": "https://github.com/edgegap/llm-mcp-server/issues"
42
42
  },
43
43
  "dependencies": {
44
44
  "@modelcontextprotocol/sdk": "^1.32.1",
45
- "zod": "^4.6.2"
45
+ "zod": "^4.6.7"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@cloudflare/workers-types": "^5.20260911.1",