@edgegap/mcp 0.1.4 → 0.2.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/LICENSE +201 -201
- package/README.md +341 -230
- package/dist/client.js +31 -0
- package/dist/dockerfile.js +185 -0
- package/dist/index.js +6 -25
- package/dist/matchmaker.js +101 -0
- package/dist/serverconfig.js +255 -0
- package/dist/tools.js +541 -5
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,230 +1,341 @@
|
|
|
1
|
-
# edgegap-mcp
|
|
2
|
-
|
|
3
|
-
An MCP server for Edgegap that lets a coding agent take a developer from "I
|
|
4
|
-
have a
|
|
5
|
-
developer reading the API reference
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
[
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
|
116
|
-
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
can
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
1
|
+
# edgegap-mcp
|
|
2
|
+
|
|
3
|
+
An MCP server for Edgegap that lets a coding agent take a developer from "I
|
|
4
|
+
have a headless server build" to "players are connected to it" without the
|
|
5
|
+
developer reading the API reference: writing and checking the Dockerfile,
|
|
6
|
+
pushing to Edgegap's registry, and deploying an authoritative dedicated server.
|
|
7
|
+
Relays are there too, for games built host-client, but they are not the default
|
|
8
|
+
— see [Dedicated servers vs relays](#dedicated-servers-vs-relays).
|
|
9
|
+
|
|
10
|
+
Nineteen tools, hand-picked. Not generated from the OpenAPI spec — see
|
|
11
|
+
[Design decisions](#design-decisions) for why.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
Two ways to run it. Pick based on how much you care about where your token
|
|
16
|
+
goes — see [Where your token goes](#where-your-token-goes).
|
|
17
|
+
|
|
18
|
+
### Remote endpoint
|
|
19
|
+
|
|
20
|
+
Hosted by Edgegap as a Cloudflare Worker. Nothing to install.
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"mcpServers": {
|
|
25
|
+
"edgegap": {
|
|
26
|
+
"type": "http",
|
|
27
|
+
"url": "https://mcp.edgegap.dev/mcp",
|
|
28
|
+
"headers": { "Authorization": "token YOUR_API_TOKEN" }
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Also works as a custom connector in claude.ai: add
|
|
35
|
+
`https://mcp.edgegap.dev/mcp` and supply the same token.
|
|
36
|
+
|
|
37
|
+
### Local
|
|
38
|
+
|
|
39
|
+
Runs on your own machine, spawned by your editor. One line in your MCP client
|
|
40
|
+
config, nothing to clone, nothing to build.
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"mcpServers": {
|
|
45
|
+
"edgegap": {
|
|
46
|
+
"command": "npx",
|
|
47
|
+
"args": ["-y", "@edgegap/mcp"]
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Works in Claude Code, Cursor, Codex, and VS Code. Pin a version in production
|
|
54
|
+
(`@edgegap/mcp@0.1.5`) rather than floating on latest.
|
|
55
|
+
|
|
56
|
+
Registered in the official MCP registry as `dev.edgegap/mcp`.
|
|
57
|
+
|
|
58
|
+
> **Node version:** the local server needs Node 18+. Deploying your own copy of
|
|
59
|
+
> the Cloudflare Worker needs Node 22+, because `wrangler` requires it.
|
|
60
|
+
|
|
61
|
+
## Where your token goes
|
|
62
|
+
|
|
63
|
+
This differs by mode, and the difference is the reason both modes exist.
|
|
64
|
+
|
|
65
|
+
**Local.** The server runs as a process on your own computer. The first tool
|
|
66
|
+
call asks you for a token, shows what it authorises, and requires an explicit
|
|
67
|
+
acknowledgement before accepting it. Where that token then lives, exhaustively:
|
|
68
|
+
|
|
69
|
+
- one variable in that process's memory, for the life of your editor session
|
|
70
|
+
|
|
71
|
+
That is the whole list. Not on disk. Not in a config file. Not in logs. Not on
|
|
72
|
+
any Edgegap server — the only thing sent to Edgegap is the API call itself,
|
|
73
|
+
exactly as if you had run `curl`. Closing your editor revokes this server's
|
|
74
|
+
access completely.
|
|
75
|
+
|
|
76
|
+
**Remote.** Your token is sent to `mcp.edgegap.dev` on every request and
|
|
77
|
+
forwarded from there to the Edgegap API. It transits infrastructure Edgegap
|
|
78
|
+
operates. The worker holds it for the life of the request and does not persist
|
|
79
|
+
it, but that is a "we don't store it" claim rather than a "we never see it"
|
|
80
|
+
claim. The two are different, and only local mode makes the second one.
|
|
81
|
+
|
|
82
|
+
Generate a token at <https://app.edgegap.com/user-settings?tab=tokens>.
|
|
83
|
+
|
|
84
|
+
In local mode, setting `EDGEGAP_API_TOKEN` takes precedence over the prompt,
|
|
85
|
+
for CI and for clients that cannot show prompts. Do not pass a token as a
|
|
86
|
+
command-line argument — arguments are visible to other processes via `ps`, and
|
|
87
|
+
the server warns if it detects one.
|
|
88
|
+
|
|
89
|
+
**Which to use.** Remote for a first try, a demo, or a supervised session where
|
|
90
|
+
setup friction matters more than custody. Local for anything unattended,
|
|
91
|
+
anything in an organization with a live game in it, and anything where you
|
|
92
|
+
would rather not extend trust you don't have to. The guardrails described below
|
|
93
|
+
exist only in local mode.
|
|
94
|
+
|
|
95
|
+
## Read this before connecting an agent
|
|
96
|
+
|
|
97
|
+
**The Edgegap API token cannot be scoped.** One token authorises every
|
|
98
|
+
application, every version, every running deployment, and your usage across the
|
|
99
|
+
whole organization. There is no deploy-only token and no per-application token.
|
|
100
|
+
|
|
101
|
+
Consequences worth being deliberate about:
|
|
102
|
+
|
|
103
|
+
- An agent holding this token can stop production deployments, not just the
|
|
104
|
+
test ones it created.
|
|
105
|
+
- Prompt injection reaching the agent — from a repo file, an issue, a fetched
|
|
106
|
+
page — reaches the token too.
|
|
107
|
+
- Anything the agent logs, echoes, or sends to a model provider is a place the
|
|
108
|
+
token could end up. This server does not log it, but it cannot control what
|
|
109
|
+
the rest of the agent does.
|
|
110
|
+
- On the remote endpoint, the same unscoped token is additionally handled by
|
|
111
|
+
Edgegap's worker on every call.
|
|
112
|
+
|
|
113
|
+
Recommended setup, in decreasing order of caution:
|
|
114
|
+
|
|
115
|
+
| Situation | Setup |
|
|
116
|
+
| --- | --- |
|
|
117
|
+
| Unattended or autonomous agent | Local mode. Separate non-production organization, plus `EDGEGAP_READ_ONLY=1` |
|
|
118
|
+
| Supervised agent, live game in the org | Local mode. `EDGEGAP_APP_ALLOWLIST` scoped to the app being worked on, plus `EDGEGAP_MAX_DURATION_MINUTES`. Read [Scope of the allowlist](#scope-of-the-allowlist) first — deployments that are already running are not covered |
|
|
119
|
+
| Solo developer, no production workload | Either mode. Defaults are fine; revoke the token when finished |
|
|
120
|
+
|
|
121
|
+
The allowlist and read-only flag are enforced in the local server, which means
|
|
122
|
+
they protect against an agent that makes a mistake, not against one that has
|
|
123
|
+
been compromised into calling the API directly. They narrow the blast radius;
|
|
124
|
+
they do not remove it.
|
|
125
|
+
|
|
126
|
+
### Scope of the allowlist
|
|
127
|
+
|
|
128
|
+
`EDGEGAP_APP_ALLOWLIST` is enforced by the five tools that take an application
|
|
129
|
+
name: `edgegap_create_app`, `edgegap_list_app_versions`,
|
|
130
|
+
`edgegap_create_app_version`, `edgegap_deploy`, and
|
|
131
|
+
`edgegap_build_matchmaker_config`.
|
|
132
|
+
|
|
133
|
+
Relay sessions and the container registry belong to the organization, not to an
|
|
134
|
+
application, so the relay and registry tools are not covered by it either.
|
|
135
|
+
|
|
136
|
+
It is **not** enforced by the five tools keyed on `request_id`:
|
|
137
|
+
`edgegap_get_deployment`, `edgegap_wait_for_deployment`,
|
|
138
|
+
`edgegap_list_deployments`, `edgegap_stop_deployment`, and
|
|
139
|
+
`edgegap_get_deployment_logs`. An agent running with an allowlist set can list
|
|
140
|
+
every deployment in the organization and then inspect, read the logs of, or stop
|
|
141
|
+
any of them — including deployments belonging to applications outside the list.
|
|
142
|
+
|
|
143
|
+
So the allowlist scopes what an agent can **create and deploy into**, not what it
|
|
144
|
+
can **touch once running**. That is narrower than earlier versions of this
|
|
145
|
+
document implied.
|
|
146
|
+
|
|
147
|
+
For a stronger guarantee today, use `EDGEGAP_READ_ONLY=1`, which never registers
|
|
148
|
+
the mutating tools at all, or point the agent at a separate non-production
|
|
149
|
+
organization. Both are unaffected by this gap.
|
|
150
|
+
|
|
151
|
+
Reported by Syed Anas Mohiuddin, September 2026.
|
|
152
|
+
|
|
153
|
+
### Environment variables
|
|
154
|
+
|
|
155
|
+
These configure the local server. On the remote endpoint they are set by
|
|
156
|
+
Edgegap and cannot be changed per developer — if you need any of them, run
|
|
157
|
+
locally.
|
|
158
|
+
|
|
159
|
+
| Variable | Default | Purpose |
|
|
160
|
+
| --- | --- | --- |
|
|
161
|
+
| `EDGEGAP_API_TOKEN` | *(prompted)* | API token. Optional — omit it and the developer is asked at first use. The `token ` prefix is added for you. |
|
|
162
|
+
| `EDGEGAP_READ_ONLY` | `0` | Set to `1` and the eight mutating tools (●, below) are never registered. The agent cannot see them, so it cannot be talked into calling them. |
|
|
163
|
+
| `EDGEGAP_APP_ALLOWLIST` | *(empty)* | Comma-separated application names. When set, the five application-keyed tools refuse to touch anything else. Does **not** scope the five `request_id`-keyed tools — see [Scope of the allowlist](#scope-of-the-allowlist). |
|
|
164
|
+
| `EDGEGAP_MAX_DURATION_MINUTES` | `60` | Ceiling on `max_duration` the agent may set on a version. Caps runaway cost from an unattended agent. |
|
|
165
|
+
| `EDGEGAP_TIMEOUT_MS` | `30000` | Per-request HTTP timeout. |
|
|
166
|
+
|
|
167
|
+
## Dedicated servers vs relays
|
|
168
|
+
|
|
169
|
+
Edgegap hosts multiplayer games two ways, and they are not interchangeable.
|
|
170
|
+
**This server recommends a dedicated server by default**, and tells the agent so
|
|
171
|
+
in its instructions, in the tool descriptions, and in every relay result.
|
|
172
|
+
|
|
173
|
+
| | Dedicated (authoritative) server | Relay |
|
|
174
|
+
| --- | --- | --- |
|
|
175
|
+
| What Edgegap runs | Your headless server build, near the players | Only a traffic forwarder; no game code |
|
|
176
|
+
| Who owns the game state | The server | One player's game (the host) |
|
|
177
|
+
| Cheating | Much harder: the server decides | The host can change anything |
|
|
178
|
+
| Fairness | Every player is one hop from the server | The host has zero latency; everyone else has two hops |
|
|
179
|
+
| Host quits | Match continues | Match ends, unless the game implements host migration |
|
|
180
|
+
| Limited by | The server's allocated CPU and memory | The host's PC and home upload bandwidth |
|
|
181
|
+
| Needs | A server image (`edgegap_generate_dockerfile` writes the Dockerfile) | Netcode built as a listen server (host-client) |
|
|
182
|
+
| Tools | `edgegap_deploy`, matchmaker | `edgegap_create_relay_session` |
|
|
183
|
+
|
|
184
|
+
Agents left alone tend to pick relays because they need no server image. That
|
|
185
|
+
saves the agent work, not the developer's game, so the relay tool tells the
|
|
186
|
+
agent to use it only when the developer has chosen host-client, or the netcode
|
|
187
|
+
is already a listen server and moving to a dedicated server is not an option —
|
|
188
|
+
and to ask when that is unclear.
|
|
189
|
+
|
|
190
|
+
## Tools
|
|
191
|
+
|
|
192
|
+
Nineteen tools, grouped by where they fall on the path. The same set in both
|
|
193
|
+
modes; `EDGEGAP_READ_ONLY=1` hides the ● ones.
|
|
194
|
+
|
|
195
|
+
**Before the first deploy** — getting a headless build into a correct image and
|
|
196
|
+
into a registry, which is where agent-driven onboarding actually stalls.
|
|
197
|
+
|
|
198
|
+
| Tool | Mutating | What it's for |
|
|
199
|
+
| --- | --- | --- |
|
|
200
|
+
| `edgegap_generate_dockerfile` | | Write a Dockerfile for this project's build: its build folder, binary or start script, ports and launch arguments, with the right headless flags, non-root user (Unreal), CRLF fix for start scripts, and matching EXPOSE lines. Lists anything it had to assume, returns the ports for `edgegap_create_app_version`, and is checked against the validator before it is returned. Unity, Unreal, Godot, or any other engine. No API call. |
|
|
201
|
+
| `edgegap_validate_server_config` | | Static check of an existing Dockerfile, ports, resources and tag against Edgegap's requirements: linux/amd64, Unreal not running as root, Unity `-batchmode -nographics`, loopback binds, EXPOSE vs. version ports, protocol vs. netcode transport, `latest` tags. Returns a known-good Dockerfile for the engine when the one checked fails. No API call. |
|
|
202
|
+
| `edgegap_get_registry_credentials` | ● | Push credentials for the org's private `registry.edgegap.com` project, plus the exact login/build/push commands and the values to pass to `edgegap_create_app_version`. Provisions the project on first use. |
|
|
203
|
+
| `edgegap_list_registry_tags` | | Confirm a pushed tag landed before registering it. |
|
|
204
|
+
|
|
205
|
+
**Dedicated servers** — the recommended way to host a match.
|
|
206
|
+
|
|
207
|
+
| Tool | Mutating | What it's for |
|
|
208
|
+
| --- | --- | --- |
|
|
209
|
+
| `edgegap_list_apps` | | Orient before doing anything. Prevents duplicate applications. |
|
|
210
|
+
| `edgegap_create_app` | ● | Create the container for versions. |
|
|
211
|
+
| `edgegap_list_app_versions` | | Find a deployable version, or copy settings from a working one. |
|
|
212
|
+
| `edgegap_create_app_version` | ● | Register a container image with CPU, memory, and ports. |
|
|
213
|
+
| `edgegap_deploy` | ● | Start one authoritative server near specified players. |
|
|
214
|
+
| `edgegap_get_deployment` | | Single status read. |
|
|
215
|
+
| `edgegap_wait_for_deployment` | | Poll to ready with backoff, then return the connection address. |
|
|
216
|
+
| `edgegap_list_deployments` | | Find orphaned servers from earlier sessions. |
|
|
217
|
+
| `edgegap_stop_deployment` | ● | Graceful SIGTERM, one deployment at a time. |
|
|
218
|
+
| `edgegap_get_deployment_logs` | | Container output and crash exit code after a failure. |
|
|
219
|
+
|
|
220
|
+
**Matchmaking** — puts players into dedicated servers.
|
|
221
|
+
|
|
222
|
+
| Tool | Mutating | What it's for |
|
|
223
|
+
| --- | --- | --- |
|
|
224
|
+
| `edgegap_build_matchmaker_config` | | Generate a basic matchmaker configuration (teams, team size, optional latency rule and expansions) checked against the application version it deploys. Edgegap has no API for creating a matchmaker, so the developer uploads the result in the dashboard. |
|
|
225
|
+
|
|
226
|
+
**Relays** — only for games built host-client; not a game server. See
|
|
227
|
+
[Dedicated servers vs relays](#dedicated-servers-vs-relays).
|
|
228
|
+
|
|
229
|
+
| Tool | Mutating | What it's for |
|
|
230
|
+
| --- | --- | --- |
|
|
231
|
+
| `edgegap_create_relay_session` | ● | Open a relay session for a set of player IPs, wait until it is ready, and return the relay address, ports, and per-player authorization tokens, plus the trade-offs to raise with the developer. |
|
|
232
|
+
| `edgegap_get_relay_session` | | Re-read a session. |
|
|
233
|
+
| `edgegap_authorize_relay_user` | ● | Add a player who joins after the session was created. |
|
|
234
|
+
| `edgegap_delete_relay_session` | ● | Close a session. |
|
|
235
|
+
|
|
236
|
+
## Design decisions
|
|
237
|
+
|
|
238
|
+
**Curated, not generated.** The Edgegap API has roughly sixty operations.
|
|
239
|
+
Auto-generating one tool per operation puts all sixty descriptions into the
|
|
240
|
+
agent's context on every turn and measurably degrades tool selection. These
|
|
241
|
+
cover the path that converts a new developer — including the steps before the
|
|
242
|
+
first deploy, which are where that path used to end.
|
|
243
|
+
|
|
244
|
+
**`wait_for_deployment` is a tool, not a loop.** Left to itself an agent will
|
|
245
|
+
call a status endpoint in a tight loop, burn turns, and give up early. Folding
|
|
246
|
+
the polling and backoff into one call removes the most common failure in
|
|
247
|
+
agent-driven deploys.
|
|
248
|
+
|
|
249
|
+
**Errors are written for self-correction.** A 424 comes back saying the image
|
|
250
|
+
could not be pulled and which fields to check. A 422 says to try different
|
|
251
|
+
coordinates or lower the resource request. The agent can act on these without a
|
|
252
|
+
round trip to the human.
|
|
253
|
+
|
|
254
|
+
**Local validation before the wire.** The memory-to-CPU ratio and the missing
|
|
255
|
+
player location are caught here rather than surfacing as an opaque 400.
|
|
256
|
+
`edgegap_validate_server_config` extends this to the image itself, before a
|
|
257
|
+
build and push are spent discovering a problem.
|
|
258
|
+
|
|
259
|
+
**Generated Dockerfiles are validated before they are returned.**
|
|
260
|
+
`edgegap_generate_dockerfile` runs its own output through
|
|
261
|
+
`edgegap_validate_server_config` and refuses to return anything that fails, so
|
|
262
|
+
the two tools cannot disagree. Every value it writes into the Dockerfile (paths,
|
|
263
|
+
binary name, launch arguments) is restricted to characters that cannot start a
|
|
264
|
+
new instruction or escape into a shell. The Unity template leaves out the `env`
|
|
265
|
+
dump from Edgegap's plugin Dockerfile, which writes hidden environment variables
|
|
266
|
+
into container logs.
|
|
267
|
+
|
|
268
|
+
**The same instructions on both transports.** The hosted Worker used to start
|
|
269
|
+
without server instructions, so hosted agents never saw the golden path. Both
|
|
270
|
+
entry points now use `serverInstructions()` from `src/tools.ts`.
|
|
271
|
+
|
|
272
|
+
**The registry token is handed to the agent; the API token never is.** The agent
|
|
273
|
+
has to run `docker login`, so the registry token is returned in the tool result.
|
|
274
|
+
It is scoped to the org's registry project, and the returned command reads it
|
|
275
|
+
from an environment variable over `--password-stdin` so it stays off command
|
|
276
|
+
lines and out of shell history. The tool is hidden in read-only mode.
|
|
277
|
+
|
|
278
|
+
**The registry credentials endpoint is not in the public spec.** It is
|
|
279
|
+
`GET /v1/wizard/registry-credentials`, the same call the Unity plugin makes,
|
|
280
|
+
preceded by `POST /v1/wizard/init-quick-start` when the project is not yet
|
|
281
|
+
provisioned.
|
|
282
|
+
|
|
283
|
+
**Bulk operations are deliberately absent.** `stop` takes one `request_id`.
|
|
284
|
+
There is no bulk-stop tool, because an agent with a filter expression and a bug
|
|
285
|
+
can stop a production fleet.
|
|
286
|
+
|
|
287
|
+
**Both a hosted endpoint and a local package.** The hosted endpoint removes
|
|
288
|
+
every step between finding this server and calling a tool, which is where most
|
|
289
|
+
developers drop out. The local package is the only way to run the server
|
|
290
|
+
without extending custody of an unscoped token to a third party, including us.
|
|
291
|
+
Neither one dominates the other, so both ship. See `worker/DECISION.md` for the
|
|
292
|
+
longer version.
|
|
293
|
+
|
|
294
|
+
## Scope
|
|
295
|
+
|
|
296
|
+
Not exposed, on purpose: private fleets, smart fleets, endpoint storage,
|
|
297
|
+
ACL/whitelist entries, deployment tags, metrics, registry tag deletion, DNS
|
|
298
|
+
configuration, and matchmaker lifecycle (start, stop, delete).
|
|
299
|
+
|
|
300
|
+
These belong to studios already operating on the platform, not to a developer
|
|
301
|
+
getting a first game online. Dockerfile generation and validation, registry
|
|
302
|
+
push, a basic matchmaker config, and relays were moved in scope because agents
|
|
303
|
+
hit them before the first deploy, not after.
|
|
304
|
+
|
|
305
|
+
## Known limitation: asking for the token at all
|
|
306
|
+
|
|
307
|
+
This applies to local mode, where the token is collected through elicitation
|
|
308
|
+
rather than read from config.
|
|
309
|
+
|
|
310
|
+
The MCP specification says servers should not use elicitation to collect
|
|
311
|
+
sensitive data, and an API token is sensitive. This server does it anyway,
|
|
312
|
+
because requiring a token in a config file before anything works is the largest
|
|
313
|
+
drop in the onboarding funnel, and the whole point of the server is to remove
|
|
314
|
+
setup friction.
|
|
315
|
+
|
|
316
|
+
That is a deliberate trade rather than a pattern to copy. What makes it
|
|
317
|
+
defensible is the set of mitigations in `src/auth.ts` — memory-only storage,
|
|
318
|
+
plain-language disclosure, required acknowledgement, redaction from all output,
|
|
319
|
+
and the environment variable always winning when present. Removing any of them
|
|
320
|
+
breaks the trade.
|
|
321
|
+
|
|
322
|
+
The real fix is on Edgegap's side and would improve both modes: scoped,
|
|
323
|
+
revocable, deploy-only credentials, issued through OAuth rather than pasted as
|
|
324
|
+
a secret. Until those exist, the interactive prompt is a workaround and is
|
|
325
|
+
labelled as one in the code.
|
|
326
|
+
|
|
327
|
+
## Development
|
|
328
|
+
|
|
329
|
+
```bash
|
|
330
|
+
npm run typecheck
|
|
331
|
+
node smoke.mjs # handshake, tool registration, read-only mode
|
|
332
|
+
node guards.mjs # local validation and allowlist enforcement
|
|
333
|
+
node elicit.mjs # token prompt: accept, refuse acknowledgement, decline, no support
|
|
334
|
+
node newtools.mjs # validator, registry, relay, matchmaker tools against a local mock API
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
None of these reach Edgegap. `newtools.mjs` points `EDGEGAP_BASE_URL` at a
|
|
338
|
+
mock server on localhost. `elicit.mjs` asserts that the prompt states
|
|
339
|
+
the org-wide scope, that the acknowledgement is required, that the token never
|
|
340
|
+
appears in tool output, and that declining produces a stop-and-report message
|
|
341
|
+
rather than a retry loop.
|
package/dist/client.js
CHANGED
|
@@ -112,4 +112,35 @@ export class EdgegapClient {
|
|
|
112
112
|
getDeploymentLogs(requestId, format = 'text') {
|
|
113
113
|
return this.request('GET', 'v1', `/v1/deployment/${encodeURIComponent(requestId)}/container-logs`, { query: { format } });
|
|
114
114
|
}
|
|
115
|
+
// --- Container registry -------------------------------------------------
|
|
116
|
+
/**
|
|
117
|
+
* Push credentials for the organization's project on registry.edgegap.com.
|
|
118
|
+
* Not in the published OpenAPI spec: this is the endpoint the Unity plugin
|
|
119
|
+
* uses, and it can fail until init-quick-start has provisioned the project.
|
|
120
|
+
*/
|
|
121
|
+
getRegistryCredentials() {
|
|
122
|
+
return this.request('GET', 'v1', '/v1/wizard/registry-credentials');
|
|
123
|
+
}
|
|
124
|
+
/** Provisions the registry project if needed. Idempotent; returns 204. */
|
|
125
|
+
initQuickStart(source) {
|
|
126
|
+
return this.request('POST', 'v1', '/v1/wizard/init-quick-start', { body: { source } });
|
|
127
|
+
}
|
|
128
|
+
/** imageName is "<project>/<image>"; the slash is part of the route. */
|
|
129
|
+
listRegistryTags(imageName, query = {}) {
|
|
130
|
+
const path = imageName.split('/').map(encodeURIComponent).join('/');
|
|
131
|
+
return this.request('GET', 'v1', `/v1/container-registry/images/${path}/tags`, { query });
|
|
132
|
+
}
|
|
133
|
+
// --- Relays -------------------------------------------------------------
|
|
134
|
+
createRelaySession(body) {
|
|
135
|
+
return this.request('POST', 'v1', '/v1/relays/sessions', { body });
|
|
136
|
+
}
|
|
137
|
+
getRelaySession(sessionId) {
|
|
138
|
+
return this.request('GET', 'v1', `/v1/relays/sessions/${encodeURIComponent(sessionId)}`);
|
|
139
|
+
}
|
|
140
|
+
authorizeRelayUser(body) {
|
|
141
|
+
return this.request('POST', 'v1', '/v1/relays/sessions:authorize-user', { body });
|
|
142
|
+
}
|
|
143
|
+
deleteRelaySession(sessionId) {
|
|
144
|
+
return this.request('DELETE', 'v1', `/v1/relays/sessions/${encodeURIComponent(sessionId)}`);
|
|
145
|
+
}
|
|
115
146
|
}
|