@edgegap/mcp 0.5.6 โ†’ 0.6.1

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
@@ -157,7 +157,7 @@ To keep your API token on your own machine, run the server locally instead. Leav
157
157
  }
158
158
  ```
159
159
 
160
- Needs Node 18+. Pin a version in production (`@edgegap/mcp@0.5.6`) rather than floating on latest. Registered in the official MCP registry as `dev.edgegap/mcp`.
160
+ Needs Node 18+. Pin a version in production (`@edgegap/mcp@0.6.1`) rather than floating on latest. Registered in the official MCP registry as `dev.edgegap/mcp`.
161
161
 
162
162
  The local server can also limit what an agent can do. These variables have no effect on the hosted endpoint at `mcp.edgegap.dev`:
163
163
 
@@ -167,6 +167,7 @@ The local server can also limit what an agent can do. These variables have no ef
167
167
  | `EDGEGAP_READ_ONLY` | `0` | Set to `1` and the eight mutating tools are never registered, so the agent cannot be talked into calling them. |
168
168
  | `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). |
169
169
  | `EDGEGAP_MAX_DURATION_MINUTES` | `60` | Ceiling on `max_duration` the agent may set on a version. |
170
+ | `EDGEGAP_MAX_AGENT_DEPLOYMENTS` | `5` | `edgegap_deploy` refuses while this many deployments tagged `edgegap-mcp` are running. `0` turns the cap off. |
170
171
  | `EDGEGAP_TIMEOUT_MS` | `30000` | Per-request HTTP timeout. |
171
172
 
172
173
  ## ๐Ÿ“š Skills
@@ -177,10 +178,13 @@ The server includes the [Edgegap agent skills](https://github.com/edgegap/edgega
177
178
  | --- | --- |
178
179
  | `edgegap` | Start here for any engine other than Unity or Unreal Engine, or platform questions. Routes to the rest. |
179
180
  | `edgegap-unity` | Unity end to end: server build, matchmaker, client, end-to-end test. |
181
+ | `edgegap-ngo` | Unity with Netcode for GameObjects end to end: server start and self-stop, Find Match panel, Boss Room adapter, matchmaker. |
180
182
  | `edgegap-fishnet` | Unity with FishNet end to end: headless server, Bayou/WebGL, matchmaker, end-to-end test. |
181
183
  | `edgegap-purrnet` | Unity with PurrNet end to end: dedicated server, connect panel, matchmaker, end-to-end test. |
184
+ | `edgegap-fusion` | Unity with Photon Fusion 2 end to end: IL2CPP Linux server, server bound to 0.0.0.0, Edgegap deployment, BR200 kit. |
182
185
  | `edgegap-manus` | Browser games built with Manus: backend matchmaking, Steam sign-in, signed join tokens, Node WebSocket server. |
183
186
  | `edgegap-unreal` | Unreal Engine end to end: source engine, Linux server, matchmaker, end-to-end test. |
187
+ | `edgegap-eos-voice` | Voice chat for an Unreal game on Edgegap with EOS Voice: server-side room tokens, match and team rooms. |
184
188
  | `edgegap-server-design` | Authoritative server design and the deployment lifecycle. |
185
189
  | `edgegap-containerize` | The container contract, Dockerfiles, registries, app versions. |
186
190
  | `edgegap-local-testing` | Parity tests on your machine, then one smoke-test deployment. |
@@ -268,6 +272,10 @@ Your API token can do anything in your organization, so the server adds its own
268
272
  | No token in containers | A deploy or version is refused, with nothing sent, if your API token appears in an env var name or value, a tag, or a webhook URL. Env values are never echoed back. |
269
273
  | Agent tag | Every deployment gets the `edgegap-mcp` tag, even when the agent passes its own tags. `edgegap_list_deployments` with `only_agent_deployments: true` finds them all. |
270
274
  | Auto-stop | Every deploy reports when Edgegap will stop it: the version's `max_duration`, capped at `EDGEGAP_MAX_DURATION_MINUTES` (default 60) for versions the agent creates. Edgegap has no per-deployment time limit, so a version made elsewhere can run up to its own limit (1440 minutes by default); the result warns when it is over an hour or unlimited. |
275
+ | No moving image tags | `edgegap_create_app_version` refuses `latest` (any case), an empty tag, or a tag Docker would reject, with nothing sent: Edgegap caches images by tag, so a re-pushed tag can deploy a stale build. Deploying an existing version on `latest` is refused too, and so is asking for registry push commands for `latest`. |
276
+ | Image reference check | A `docker_image` that also holds a registry host, tag or digest (e.g. `registry.edgegap.com/proj/server:v2`) is refused, and the error gives the right `docker_repository` / `docker_image` / `docker_tag` split. `edgegap_validate_server_config` flags the same things. |
277
+ | Deployment cap | `edgegap_deploy` is refused while `EDGEGAP_MAX_AGENT_DEPLOYMENTS` (default 5) deployments tagged `edgegap-mcp` are already running, so a looping agent cannot pile up billing servers. The refusal says how to list and stop them. |
278
+ | Hidden secret env vars | Env vars whose names look like secrets (`TOKEN`, `SECRET`, `PASSWORD`, `API_KEY`, `CREDENTIAL`, `AUTH`โ€ฆ) are sent with `is_hidden`, so the dashboard does not show their values in plain text. |
271
279
  | Strict stop | `edgegap_stop_deployment` stops one deployment by its exact request ID. Empty IDs, wildcards and lists are refused. There is no bulk stop. |
272
280
  | Host on every result | Every result starts with the API host, e.g. `[api.edgegap.com]`, or `[custom ยท host]` when `EDGEGAP_BASE_URL` points elsewhere. A base URL naming `api.edgegap.com` must be exactly `https://api.edgegap.com`, or the server refuses to start. |
273
281
  | Redaction | The token is stripped from every error before it reaches the agent. |
@@ -316,7 +324,7 @@ docker build -t edgegap-mcp .
316
324
  docker run --rm -p 8080:8080 edgegap-mcp
317
325
  ```
318
326
 
319
- 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` and `EDGEGAP_MAX_DURATION_MINUTES` apply. Read [worker/DECISION.md](worker/DECISION.md) before exposing it beyond a private network.
327
+ 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.
320
328
 
321
329
  Prebuilt images are published to `ghcr.io/edgegap/edgegap-mcp`, tagged `main` and `sha-<commit>` on every push to `main`, plus the version on `v*` tags:
322
330
 
package/dist/config.js CHANGED
@@ -72,6 +72,7 @@ export function loadConfig(env = process.env) {
72
72
  readOnly: env.EDGEGAP_READ_ONLY === '1' || env.EDGEGAP_READ_ONLY === 'true',
73
73
  appAllowlist: parseList(env.EDGEGAP_APP_ALLOWLIST),
74
74
  maxDurationCeiling: parseIntEnv(env.EDGEGAP_MAX_DURATION_MINUTES, 60),
75
+ maxAgentDeployments: parseIntEnv(env.EDGEGAP_MAX_AGENT_DEPLOYMENTS, 5),
75
76
  requestTimeoutMs: parseIntEnv(env.EDGEGAP_TIMEOUT_MS, 30_000),
76
77
  };
77
78
  }
package/dist/hosted.js CHANGED
@@ -9,21 +9,24 @@
9
9
  import { stripTokenPrefix } from './config.js';
10
10
  const TOKEN_URL = 'https://app.edgegap.com/user-settings?tab=tokens';
11
11
  /**
12
- * Edgegap API tokens are UUIDs. The strict form is the real test; the loose
13
- * form exists so a future token format does not silently stop working here.
12
+ * Edgegap API tokens are UUIDs: the dashboard issues one kind of token, and the
13
+ * API docs show it as "token xxxxxxxx-e458-4592-b607-c2c28afd8b62". Anything
14
+ * else in the header is not an Edgegap token.
14
15
  *
15
16
  * The point of this check is NOT security โ€” an invalid token fails upstream
16
17
  * anyway. It is to tell a foreign credential apart from an Edgegap one BEFORE
17
18
  * relaying it, so the developer gets "your client sent its own token" instead
18
- * of Edgegap's generic 401. JWTs are the common case: they are what MCP clients
19
- * mint for themselves, and they always carry dots, which a UUID never does.
19
+ * of Edgegap's generic 401, and telemetry records auth_problem "foreign". MCP
20
+ * clients mint JWTs for themselves (dots, never in a UUID) but also plain
21
+ * opaque strings, which an earlier, looser check let through to the API.
22
+ *
23
+ * If Edgegap ever issues another token format, add it here: until then the
24
+ * hosted server refuses it as foreign. The stdio server (npx @edgegap/mcp)
25
+ * does not run this check.
20
26
  */
21
- const STRICT_UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
22
- const LOOSE_OPAQUE = /^[A-Za-z0-9_-]{16,200}$/;
27
+ const EDGEGAP_TOKEN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
23
28
  function looksLikeEdgegapToken(value) {
24
- if (STRICT_UUID.test(value))
25
- return true;
26
- return LOOSE_OPAQUE.test(value);
29
+ return EDGEGAP_TOKEN.test(value);
27
30
  }
28
31
  export function extractToken(header) {
29
32
  if (!header)
@@ -48,9 +51,10 @@ export function unavailableMessage(problem) {
48
51
  'on your own machine and never sends it through Edgegap infrastructure.';
49
52
  if (problem === 'foreign') {
50
53
  return ('The Authorization header on this connection does not contain an Edgegap ' +
51
- 'API token โ€” it looks like a credential your MCP client issued for ' +
52
- 'itself. That happens with clients that connect by URL alone and have no ' +
53
- 'field for a custom header. This server was not going to relay it to the ' +
54
+ 'API token (those look like xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) โ€” it ' +
55
+ 'looks like a credential your MCP client issued for itself. That ' +
56
+ 'happens with clients that connect by URL alone and have no field for a ' +
57
+ 'custom header. This server was not going to relay it to the ' +
54
58
  'Edgegap API, because the only thing that produces is a confusing 401.\n\n' +
55
59
  'If your client cannot attach your own Edgegap token to the connection, ' +
56
60
  'it cannot use this hosted server: run the local one instead ' +
package/dist/image.js ADDED
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Image and env var rules shared by the write tools and the validator.
3
+ *
4
+ * Edgegap caches images by tag. A re-pushed "latest" (or any tag that moves)
5
+ * can deploy a stale build, and two deployments of the same version can run
6
+ * different code. Agents reach for "latest" by default, so it is refused, not
7
+ * just discouraged.
8
+ */
9
+ /** Docker's tag grammar: up to 128 characters, no leading dot or dash. */
10
+ const TAG_RE = /^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$/;
11
+ /** Why a tag cannot be used, or undefined when it can. */
12
+ export function badTag(tag) {
13
+ const t = tag.trim();
14
+ if (t === '')
15
+ return 'docker_tag is empty, which Docker treats as "latest"';
16
+ if (t.toLowerCase() === 'latest')
17
+ return `docker_tag "${tag}" moves with every push`;
18
+ if (!TAG_RE.test(tag)) {
19
+ return `docker_tag "${tag.slice(0, 40)}" is not a valid Docker tag (letters, digits, "_", "." and "-", up to 128, not starting with "." or "-")`;
20
+ }
21
+ return undefined;
22
+ }
23
+ export const TAG_FIX = 'Edgegap caches images by tag, so a moving tag can deploy a stale build. Push the image ' +
24
+ 'with a unique tag (a build ID, commit SHA or timestamp) and use that tag.';
25
+ /**
26
+ * Why docker_image is malformed, or undefined. The API takes the image in
27
+ * three fields; agents often put a whole reference in docker_image instead.
28
+ */
29
+ export function badImage(repository, image) {
30
+ const img = image.trim();
31
+ if (img === '')
32
+ return 'docker_image is empty.';
33
+ const first = img.split('/')[0];
34
+ const last = img.split('/').pop() ?? '';
35
+ const hasHost = img.includes('/') && (first.includes('.') || first.includes(':') || first === 'localhost');
36
+ const tagAt = last.search(/[:@]/);
37
+ if (!hasHost && tagAt === -1)
38
+ return undefined;
39
+ const host = hasHost ? first : repository.trim() || '<registry>';
40
+ const path = (hasHost ? img.slice(first.length + 1) : img).replace(/[:@].*$/, '');
41
+ const tag = tagAt === -1 ? '<build-id>' : last.slice(tagAt + 1).replace(/^sha256:.*/, '<build-id>');
42
+ return (`docker_image "${img.slice(0, 80)}" holds more than the image path. Split it: ` +
43
+ `docker_repository "${host}", docker_image "${path}", docker_tag "${tag}".`);
44
+ }
45
+ /**
46
+ * Env var names that usually carry a secret. Their values are sent with
47
+ * is_hidden, so the dashboard does not show them in plain text.
48
+ */
49
+ const SECRET_NAME_RE = /SECRET|TOKEN|PASSWORD|PASSWD|PRIVATE|CREDENTIAL|API_?KEY|ACCESS_?KEY|AUTH/i;
50
+ export function looksSecret(name) {
51
+ return SECRET_NAME_RE.test(name);
52
+ }
@@ -12,6 +12,7 @@
12
12
  * ships in its Unity and Unreal plugins, and from the constraints the API
13
13
  * enforces on app versions.
14
14
  */
15
+ import { badImage, badTag } from './image.js';
15
16
  export const PROTOCOLS = ['UDP', 'TCP', 'TCP/UDP', 'HTTP', 'HTTPS', 'WS', 'WSS'];
16
17
  /** Transport โ†’ protocol it needs on the wire. Keys are lowercase. */
17
18
  const NETCODE_PROTOCOL = {
@@ -252,8 +253,15 @@ export function validateServerConfig(input) {
252
253
  err('memory-ratio', `memory_mb (${input.memory_mb}) exceeds twice cpu_units (${input.cpu_units}). Edgegap rejects this.`, `Lower memory_mb to ${input.cpu_units * 2} or raise cpu_units.`);
253
254
  }
254
255
  // ----------------------------------------------------------------- Image --
255
- if (input.docker_tag !== undefined && (input.docker_tag === '' || input.docker_tag === 'latest')) {
256
- err('latest-tag', `docker_tag "${input.docker_tag || '(empty)'}" is not reproducible, and Edgegap caches images by tag, so a re-pushed "latest" can deploy a stale build.`, 'Tag every build uniquely, e.g. a build ID or timestamp.');
256
+ // Same rules edgegap_create_app_version enforces, so the validator never
257
+ // passes a version that the create tool then refuses.
258
+ const tagProblem = input.docker_tag === undefined ? undefined : badTag(input.docker_tag);
259
+ if (tagProblem) {
260
+ err('latest-tag', `${tagProblem}. Edgegap caches images by tag, so a re-pushed tag can deploy a stale build.`, 'Tag every build uniquely, e.g. a build ID or timestamp.');
261
+ }
262
+ const imageProblem = input.docker_image === undefined ? undefined : badImage(input.docker_repository ?? '', input.docker_image);
263
+ if (imageProblem) {
264
+ err('image-reference', imageProblem, 'docker_image is the path only; the registry and tag have their own fields.');
257
265
  }
258
266
  if (input.docker_repository?.includes('registry.edgegap.com') && input.docker_image && !input.docker_image.includes('/')) {
259
267
  err('missing-project', `docker_image "${input.docker_image}" has no project prefix. Images on registry.edgegap.com live under your project.`, 'Use "<project>/<image>"; edgegap_get_registry_credentials returns the project name.');