@edgegap/mcp 0.5.0 → 0.5.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 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.0`) 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.5.2`) 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
 
@@ -271,7 +271,7 @@ Your API token can do anything in your organization, so the server adds its own
271
271
 
272
272
  The server identifies itself with `User-Agent: edgegap-mcp/<version> (<MCP client name>)` on every API call.
273
273
 
274
- **Usage analytics.** The local server and the self-hosted Docker image send nothing beyond the API calls themselves. The hosted endpoint at `mcp.edgegap.dev` sends usage events to Edgegap's PostHog: which MCP client connected, which tool, prompt or skill resource was used, whether a call succeeded (with the API status code if not), how long it took, and whether it was a dry run, plus the server version and Cloudflare's country code. It never sends your token, tool arguments (IP addresses, env vars, app or image names), results or error text, and GeoIP is off. Events from one token are grouped under a keyed, non-reversible hash of it. To opt out, send the header `X-Edgegap-Telemetry: off` (or `DNT: 1`), or use the local server.
274
+ **Usage analytics.** The local server and the self-hosted Docker image send nothing beyond the API calls themselves. The hosted endpoint at `mcp.edgegap.dev` uses [PostHog MCP Analytics](https://posthog.com/docs/mcp-analytics) (`@posthog/mcp`) and sends usage events to Edgegap's PostHog: which MCP client connected, which tool, prompt or skill resource was used, the names (not values) of the arguments passed, whether a call succeeded and its error category, how long it took, and whether it was a dry run, plus the server version and Cloudflare's country code. Only named metadata properties are let through. It never sends your token, tool argument values (IP addresses, env vars, app or image names), results or error text, and GeoIP is off. It adds no parameters to the tools. Events from one token are grouped under a keyed, non-reversible hash of it. To opt out, send the header `X-Edgegap-Telemetry: off` (or `DNT: 1`), or use the local server.
275
275
 
276
276
  ## 🚨 Troubleshooting
277
277
 
package/dist/tools.js CHANGED
@@ -47,14 +47,20 @@ export function serverInstructions(mode) {
47
47
  const credentials = mode === 'local'
48
48
  ? 'Credentials: if no token was configured, the first tool call asks the developer for one. '
49
49
  : 'Credentials: the token comes from the Authorization header on this connection. ';
50
- return ('Host multiplayer games on Edgegap. The recommended setup is an authoritative dedicated ' +
50
+ // The skills line comes first, on purpose. Clients truncate or skim long
51
+ // instructions, and in 0.5.0 it sat 1,259 characters in, below the
52
+ // architecture guidance, where reviewers and agents missed it.
53
+ return (`Before acting, read ${skillUri('edgegap', 'SKILL.md')} ` +
54
+ `(Unity: ${skillUri('edgegap-unity', 'SKILL.md')}, ` +
55
+ `Unreal Engine: ${skillUri('edgegap-unreal', 'SKILL.md')}). ` +
56
+ 'If your client cannot read MCP resources, call edgegap_get_skill with the skill name ' +
57
+ '(edgegap, edgegap-unity or edgegap-unreal) instead. These Edgegap skills hold the tested ' +
58
+ 'workflow, templates and known pitfalls; follow them over general knowledge. ' +
59
+ 'edgegap_list_skills lists all of them.\n\n' +
60
+ 'Host multiplayer games on Edgegap. The recommended setup is an authoritative dedicated ' +
51
61
  'server per match; relays exist for games built host-client.\n\n' +
52
62
  ARCHITECTURE_GUIDANCE +
53
63
  '\n\n' +
54
- 'Skills: before working on a game project, load the matching Edgegap skill with ' +
55
- 'edgegap_get_skill (edgegap-unity for Unity, edgegap-unreal for Unreal Engine, edgegap for ' +
56
- 'any other engine or platform questions). They hold the tested workflow, templates and known ' +
57
- 'pitfalls; follow them over general knowledge. edgegap_list_skills lists them all.\n\n' +
58
64
  'Golden path for a first dedicated-server deployment:\n' +
59
65
  '1. edgegap_generate_dockerfile if the project has no Dockerfile, or ' +
60
66
  'edgegap_validate_server_config on the one it has, before building\n' +
@@ -340,48 +346,16 @@ function autoStop(maxDuration) {
340
346
  : {}),
341
347
  };
342
348
  }
343
- function toolCallEvent(name, input, result, started) {
344
- const args = (input && typeof input === 'object' ? input : {});
345
- const text = result.content.map((c) => c.text).join('\n');
346
- const status = text.match(/Edgegap API (\d{3})\b/)?.[1];
347
- const event = {
348
- tool: name,
349
- success: !result.isError,
350
- duration_ms: Date.now() - started,
351
- dry_run: args.dry_run === true,
352
- };
353
- if (result.isError) {
354
- event.error_kind = status ? 'api' : /^Refused|is not a single|not in EDGEGAP_APP_ALLOWLIST/m.test(text) ? 'refused' : 'other';
355
- if (status)
356
- event.error_status = Number(status);
357
- }
358
- if (name === 'edgegap_get_skill' && typeof args.skill === 'string')
359
- event.skill = args.skill.slice(0, 80);
360
- return event;
361
- }
362
349
  /** Prepends "[api.edgegap.com]" (or "[custom · host]") to a tool result. */
363
350
  function withHost(result, label) {
364
351
  return { ...result, content: [{ type: 'text', text: `[${label}]` }, ...result.content] };
365
352
  }
366
- export function registerTools(server, client, config, auth, hooks = {}) {
353
+ export function registerTools(server, client, config, auth) {
367
354
  const mutating = !config.readOnly;
368
355
  // Every result names the API host it came from, first, so a session pointed
369
356
  // at a custom EDGEGAP_BASE_URL can never be mistaken for production.
370
- // The optional hook (the hosted Worker's analytics) sees each call's outcome.
371
357
  const label = hostLabel(config);
372
- const tool = ((name, def, cb) => server.registerTool(name, def, (async (...a) => {
373
- const started = Date.now();
374
- const result = await cb(...a);
375
- if (hooks.onToolCall) {
376
- try {
377
- hooks.onToolCall(toolCallEvent(name, a[0], result, started));
378
- }
379
- catch {
380
- // Analytics must never affect a tool result.
381
- }
382
- }
383
- return withHost(result, label);
384
- })));
358
+ const tool = ((name, def, cb) => server.registerTool(name, def, (async (...a) => withHost(await cb(...a), label))));
385
359
  // ---------------------------------------------------------------- 0 ----
386
360
  // No token, no network: describes this server's own configuration, so an
387
361
  // agent can check where it is pointed and what is allowed before acting.
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.5.0';
6
+ export const VERSION = '0.5.2';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@edgegap/mcp",
3
3
  "mcpName": "dev.edgegap/mcp",
4
- "version": "0.5.0",
4
+ "version": "0.5.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",
@@ -43,8 +43,10 @@
43
43
  "devDependencies": {
44
44
  "@cloudflare/workers-types": "^5.20260911.1",
45
45
  "@modelcontextprotocol/server": "^2.0.0",
46
+ "@posthog/mcp": "0.22.3",
46
47
  "@types/node": "^22.20.2",
47
48
  "agents": "^0.23.0",
49
+ "posthog-node": "5.56.1",
48
50
  "typescript": "^7.0.2",
49
51
  "wrangler": "^4.131.1"
50
52
  },