@xns-cloud/relayer-mcp 0.12.0 → 0.14.3
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/PRIVACY.md +21 -9
- package/README.md +50 -24
- package/manifest.json +5 -6
- package/package.json +3 -5
- package/src/index.js +4 -2
- package/src/lib/dockerUtil.js +34 -1
- package/src/lib/ensureToken.js +89 -4
- package/src/lib/nodeVersion.js +3 -3
- package/src/lib/oidcAuth.js +28 -17
- package/src/lib/serverInstructions.js +11 -0
- package/src/tools/checkClaimStatus.js +1 -1
- package/src/tools/checkEmailVerified.js +1 -1
- package/src/tools/checkPrerequisites.js +120 -5
- package/src/tools/checkRelayerHealth.js +64 -10
- package/src/tools/configureVpd.js +1 -1
- package/src/tools/describeSettings.js +2 -6
- package/src/tools/getHostTags.js +1 -1
- package/src/tools/installRelayer.js +262 -75
- package/src/tools/manageBackups.js +4 -2
- package/src/tools/restartService.js +1 -1
- package/src/tools/setupCliCredentials.js +264 -72
- package/src/tools/startClaim.js +1 -1
- package/src/tools/startRegistration.js +1 -1
- package/src/tools/updateSettings.js +1 -1
- package/src/tools/verifyStorage.js +2 -1
- package/src/templates/docker-compose.yml +0 -85
package/PRIVACY.md
CHANGED
|
@@ -17,7 +17,10 @@ conversation, your prompts, or the agent's tool calls.
|
|
|
17
17
|
## The server collects nothing
|
|
18
18
|
|
|
19
19
|
There is no analytics, no telemetry, no crash reporting, and no usage counter in this
|
|
20
|
-
package. It does not phone home.
|
|
20
|
+
package. It does not phone home. The one tag it sends is on the default compose download of
|
|
21
|
+
`install_relayer`, fetched as `docker-compose.yml?src=mcp`: `src=mcp` is an anonymous source
|
|
22
|
+
tag, the same fixed word for every user and carrying no identifier, used to count downloads by
|
|
23
|
+
source. The `.env` download and a `compose_url` you pass carry no tag.
|
|
21
24
|
|
|
22
25
|
## What leaves your machine, and where it goes
|
|
23
26
|
|
|
@@ -28,7 +31,7 @@ Only through the ordinary, visible operation of the tools you ask the agent to r
|
|
|
28
31
|
| Creating an account, signing in | Your credentials, entered by you in your own browser | `auth.xns.tech` (Keycloak) |
|
|
29
32
|
| Claiming a Relayer to your account | The claim session and the installation's identity | `console.xns.tech` |
|
|
30
33
|
| Reading or changing settings, host selection, backups | The setting values you ask to read or change | `console.xns.tech` |
|
|
31
|
-
| Installing or updating the Relayer | An anonymous download of the Docker Compose bundle and images | `releases.
|
|
34
|
+
| Installing or updating the Relayer | An anonymous download of the Docker Compose bundle and images; the default compose URL carries the source tag `?src=mcp`, with no identifier | `releases.xns.tech`; the `prom/node-exporter` image comes from Docker Hub |
|
|
32
35
|
|
|
33
36
|
The agent never handles your password. Sign-in happens in your browser against our identity
|
|
34
37
|
service; the extension receives only a short-lived access token.
|
|
@@ -48,13 +51,22 @@ Both are yours to delete at any time.
|
|
|
48
51
|
|
|
49
52
|
## Network boundary
|
|
50
53
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
No tool sends your sign-in token to a Relayer on the public internet. `setup_cli_credentials`
|
|
55
|
+
takes no address: it sends the token only to the server's own Relayer UI (by default
|
|
56
|
+
`http://localhost:8888`). `verify_storage` runs the Relayer host it is given through an allowlist
|
|
57
|
+
that permits only `localhost`, loopback, RFC 1918 private ranges (`10/8`, `172.16/12`,
|
|
58
|
+
`192.168/16`), and `*.local` (`src/lib/hostAllowlist.js`). Two inputs are not limited to
|
|
59
|
+
private addresses: the `host` of `check_relayer_health`, which gets plain HTTP health probes;
|
|
60
|
+
and the S3 `endpoint` of `verify_storage` (by default port 9000 on the Docker host), which gets the
|
|
61
|
+
round-trip test as S3 requests signed with a throwaway key (or the keys you pass). A signed
|
|
62
|
+
request carries the access key id and a signature, never the secret. The tool deletes a
|
|
63
|
+
throwaway key after the test, pass or fail; if that deletion fails, the reply carries a
|
|
64
|
+
`cleanup_warning` and the key stays until you remove it. The `compose_url` of
|
|
65
|
+
`install_relayer`, which is downloaded and run by Docker as root, is limited the same way
|
|
66
|
+
plus `https://releases.xns.tech` and `file://` URLs; any other host is refused before
|
|
67
|
+
anything is downloaded. Apart from those, the only public hosts contacted are the
|
|
68
|
+
three XNS services named above and, for the `prom/node-exporter` image that an install
|
|
69
|
+
pulls, Docker Hub.
|
|
58
70
|
|
|
59
71
|
## Stopping it
|
|
60
72
|
|
package/README.md
CHANGED
|
@@ -4,38 +4,50 @@
|
|
|
4
4
|
[](./LICENSE)
|
|
5
5
|
[](https://nodejs.org/)
|
|
6
6
|
|
|
7
|
-
MCP server for [XNS
|
|
7
|
+
S3-compatible cloud object storage from XNS, set up and managed by your AI assistant. This is the MCP server for [XNS](https://xns.tech). Provides 15 tools that let an AI agent set up the Relayer, the small gateway that runs on your own machine, and manage it day to day over stdio.
|
|
8
|
+
|
|
9
|
+
In Claude, use two plugins: `xns-relayer` registers this server and `xns-storage` adds the step-by-step skills. In Claude Code, run:
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
/plugin marketplace add xns-cloud/xns-storage-plugin
|
|
13
|
+
/plugin install xns-storage@xns-cloud
|
|
14
|
+
/plugin install xns-relayer@xns-cloud
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
then say: set up XNS storage
|
|
18
|
+
|
|
19
|
+
For any other MCP client, run the server with npx:
|
|
8
20
|
|
|
9
21
|
```bash
|
|
10
22
|
npx @xns-cloud/relayer-mcp@latest
|
|
11
23
|
```
|
|
12
24
|
|
|
13
|
-
**Pricing:**
|
|
25
|
+
**Pricing:** $6.00 per TB per month. $0 egress, uncapped. 30-day minimum retention, no early-delete fee. See [xns.tech/pricing](https://xns.tech/pricing).
|
|
14
26
|
|
|
15
27
|
## Requirements
|
|
16
28
|
|
|
17
29
|
On Ubuntu 24.04 or Debian 12, one command sets up everything:
|
|
18
30
|
|
|
19
31
|
```bash
|
|
20
|
-
curl -fsSL https://releases.
|
|
32
|
+
curl -fsSL 'https://releases.xns.tech/relayer/install.sh?src=github' | sh
|
|
21
33
|
```
|
|
22
34
|
|
|
23
|
-
The script installs Docker Engine and the compose plugin, adds you to the `docker` group, starts the Relayer in `/opt/xns-relayer`, and waits for the dashboard at `http://localhost:8888`. If Claude Code is present, it also installs Node.js
|
|
35
|
+
The script installs Docker Engine and the compose plugin, adds you to the `docker` group, starts the Relayer in `/opt/xns-relayer`, and waits for the dashboard at `http://localhost:8888`. If Claude Code is present, it also installs Node.js 24 when Node is missing or older and registers this MCP. Log out and back in afterward so the `docker` group applies. On macOS or Windows it installs nothing and points you to Docker Desktop.
|
|
24
36
|
|
|
25
37
|
Without the script, the MCP needs:
|
|
26
38
|
|
|
27
|
-
- **Node.js
|
|
39
|
+
- **Node.js 24+** — see [Installing Node.js 24](#installing-nodejs-24) if your distro ships an older version.
|
|
28
40
|
- **Docker Engine** — on the same machine that runs the MCP. `install_relayer` refuses when the Docker daemon is on another machine (see [Remote Docker hosts](#remote-docker-hosts)).
|
|
29
41
|
|
|
30
|
-
### Installing Node.js
|
|
42
|
+
### Installing Node.js 24
|
|
31
43
|
|
|
32
|
-
Ubuntu's default apt repository only ships Node 18, which is too old. Two ways to get Node
|
|
44
|
+
Ubuntu's default apt repository only ships Node 18, which is too old. Two ways to get Node 24:
|
|
33
45
|
|
|
34
46
|
**nvm** (recommended — no root required):
|
|
35
47
|
|
|
36
48
|
```bash
|
|
37
49
|
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
|
|
38
|
-
\. "$HOME/.nvm/nvm.sh" && nvm install
|
|
50
|
+
\. "$HOME/.nvm/nvm.sh" && nvm install 24
|
|
39
51
|
```
|
|
40
52
|
|
|
41
53
|
**NodeSource** (system-wide): follow <https://github.com/nodesource/distributions#installation-instructions>.
|
|
@@ -46,24 +58,36 @@ If you start the MCP on an older Node, it exits immediately with this same guida
|
|
|
46
58
|
|
|
47
59
|
The Relayer runs as a Docker container and persists its data in a Docker volume. If the MCP is running inside an ephemeral environment (a sandbox container, a CI runner, or a throwaway VM), any installation performed there will be lost when that environment exits. `check_prerequisites` detects this automatically and reports it as a warning with a concrete next step — it never blocks the flow.
|
|
48
60
|
|
|
49
|
-
**If your environment is ephemeral**, run the MCP on a persistent Docker host instead (install Node.js
|
|
61
|
+
**If your environment is ephemeral**, run the MCP on a persistent Docker host instead (install Node.js 24 there and point your MCP client at it). Alternatively, hand the install step to a human operator on the target machine and continue onboarding from `check_relayer_health` onwards.
|
|
50
62
|
|
|
51
63
|
## Install
|
|
52
64
|
|
|
53
65
|
On Ubuntu 24.04 or Debian 12, one command installs the Relayer and registers this MCP when Claude Code is present:
|
|
54
66
|
|
|
55
67
|
```bash
|
|
56
|
-
curl -fsSL https://releases.
|
|
68
|
+
curl -fsSL 'https://releases.xns.tech/relayer/install.sh?src=github' | sh
|
|
57
69
|
```
|
|
58
70
|
|
|
59
|
-
|
|
71
|
+
When Claude Code is present, the script also registers this server with it.
|
|
60
72
|
|
|
61
|
-
|
|
73
|
+
To set it up yourself instead:
|
|
74
|
+
|
|
75
|
+
**Claude Code** (with the plugins: `xns-relayer` registers this server, `xns-storage` adds the skills):
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
/plugin marketplace add xns-cloud/xns-storage-plugin
|
|
79
|
+
/plugin install xns-storage@xns-cloud
|
|
80
|
+
/plugin install xns-relayer@xns-cloud
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Without the plugins, register it by hand:
|
|
62
84
|
|
|
63
85
|
```bash
|
|
64
86
|
claude mcp add --scope user relayer -- npx @xns-cloud/relayer-mcp@latest
|
|
65
87
|
```
|
|
66
88
|
|
|
89
|
+
Do not add the `xns-relayer` plugin beside a `relayer` registration, whether you or the install script made it: with both, the 15 tools load twice. The `xns-storage` plugin carries no server, so it can go beside either.
|
|
90
|
+
|
|
67
91
|
**Claude Desktop / any MCP client** — add to your `claude_desktop_config.json` (or equivalent):
|
|
68
92
|
|
|
69
93
|
```json
|
|
@@ -96,17 +120,17 @@ No separate install step required — npx fetches the package on demand.
|
|
|
96
120
|
|
|
97
121
|
| # | Tool | Purpose |
|
|
98
122
|
|---|------|---------|
|
|
99
|
-
| 1 | `check_prerequisites` | Verify Docker (local or remote), the compose plugin, Docker socket access (when it is denied, whether the `docker` group membership is missing or not yet live), ports (8888, 9000, 9443), an existing installation, free disk (10 GB on the Docker root and the install directory), and network connectivity. Each failure names the command that fixes it; ports held by a running `xns-relayer` pass. |
|
|
123
|
+
| 1 | `check_prerequisites` | Verify Docker (local or remote), the compose plugin, Docker socket access (when it is denied, whether the `docker` group membership is missing or not yet live), ports (8888, 9000, 9443), an existing installation, free disk (10 GB on the Docker root and the install directory), the root mount's propagation for the Docker daemon (a private `/`, the WSL2 default, leaves the containers stuck in "Created"), and network connectivity. Each failure names the command that fixes it; ports held by a running `xns-relayer` pass. |
|
|
100
124
|
| 2 | `start_registration` | Get the browser sign-up URL for creating an XNS account — the agent never handles credentials. |
|
|
101
125
|
| 3 | `check_email_verified` | Poll email verification status (15s interval, 30-min timeout). |
|
|
102
|
-
| 4 | `install_relayer` | Fetch the canonical release channel bundle — relayer + Prometheus/Grafana monitoring stack (`https://releases.
|
|
103
|
-
| 5 | `check_relayer_health` | Poll UI, S3, HostIO, and the monitoring sidecars (10s interval, 300s timeout). A missing monitoring stack reports as degraded without blocking the flow. Targets the Docker host automatically. |
|
|
126
|
+
| 4 | `install_relayer` | Fetch the canonical release channel bundle — relayer + Prometheus/Grafana monitoring stack (`https://releases.xns.tech/relayer/release/docker-compose.yml?src=mcp` and its `.env`, anonymous pull, no `docker login`; `?src=mcp` is an anonymous source tag used to count downloads by source, with no identifier, and the `.env` and a `compose_url` override carry no tag) — add the ports to that `.env`, and start the containers. If the release files cannot be downloaded or used it stops, says why and what to do, and installs nothing. A failure names its cause (port in use, image pull refused, Docker stopped, out of disk, Docker socket permission) and the fix. **Fresh installs only** — see [Fresh installs vs. existing deployments](#fresh-installs-vs-existing-deployments). The user authors nothing; `compose_url` is an optional override for custom installs. |
|
|
127
|
+
| 5 | `check_relayer_health` | Poll UI, S3, HostIO, and the monitoring sidecars (10s interval, 300s timeout). A missing monitoring stack reports as degraded without blocking the flow. Before the owner claims the Relayer and signs in, the S3 gateway is not started yet, so the tool returns `awaiting_claim: true` when the UI answers, the Docker CLI reaches the checked host, and the `xns-relayer` container holds no Muse token yet. When the token cannot be read (no such container, Docker unreachable), S3 down stays unhealthy. Targets the Docker host automatically. |
|
|
104
128
|
| 6 | `start_claim` | Initiate a claim session — returns a URL for browser confirmation. |
|
|
105
129
|
| 7 | `check_claim_status` | Poll claim state (STATE_1 / STATE_2 / STATE_3). |
|
|
106
130
|
| 8 | `get_host_tags` | Retrieve available host tags for VPD configuration, plus the currently applied data/parity selection (read-back with an `is_default` flag). |
|
|
107
131
|
| 9 | `configure_vpd` | Set data/parity host selection via CEL expressions. `dry_run: true` previews the matched host counts without applying (requires a Relayer build with the HostIO evaluate endpoint; older builds report `preview_supported: false`). |
|
|
108
132
|
| 10 | `verify_storage` | Round-trip S3 test (create bucket, put object, get object) against the S3 gateway. Provisions a temporary scoped IAM credential automatically from your OIDC session — no manual key management needed. The tool attempts to remove test data and the throwaway credential after the test; a `cleanup_warning` is reported if any resource could not be removed. `relayer_ui_url` must point at a loopback or private-network host. |
|
|
109
|
-
| 11 | `setup_cli_credentials` | Provision S3 IAM credentials and
|
|
133
|
+
| 11 | `setup_cli_credentials` | Provision S3 IAM credentials and save them in `~/.xns/credentials` for the XNS CLI. The Relayer user it makes, `xns-cli`, can read, write and delete in every bucket. Takes an optional `ui_port` (default 8888) for a Relayer installed on another UI port; the host is always this machine. Profiles in the file that hold keys are kept: the new keys go in `default` if it is absent or holds none (a `default` without keys is replaced), otherwise in a new profile that the reply names. |
|
|
110
134
|
| 12 | `describe_settings` | List the adjustable settings — worker/concurrency tuning, backup schedule, cost center (CCID) — with current values, defaults, and guidance. The MCP deliberately exposes only this curated set, never the full advanced catalog. |
|
|
111
135
|
| 13 | `update_settings` | Apply a map of setting changes (whitelist-enforced). Returns `require_restart`. **Requires relayer-ui >= 3.43.3** — older servers can clobber the database password on config round-trips. |
|
|
112
136
|
| 14 | `restart_service` | Restart `hostio`, `gateway`, `s3gateway`, `database`, or all services. Disruptive; pairs with `check_relayer_health` to verify recovery. |
|
|
@@ -119,7 +143,8 @@ No separate install step required — npx fetches the package on demand.
|
|
|
119
143
|
3. User clicks email verification link; agent polls (Tool 3).
|
|
120
144
|
4. Agent installs and starts Relayer containers (Tool 4) — it writes the
|
|
121
145
|
released compose + `.env` itself; the user is never asked for a compose URL.
|
|
122
|
-
5. Agent polls health until UI
|
|
146
|
+
5. Agent polls health until the UI is up (Tool 5); the S3 gateway starts once the
|
|
147
|
+
Relayer is claimed and its owner signs in to the Relayer web UI.
|
|
123
148
|
6. Agent initiates claim; user opens claim URL in browser (Tools 6 + 7).
|
|
124
149
|
7. Agent signs in via OIDC to configure host preferences (Tools 8 + 9).
|
|
125
150
|
8. Agent verifies S3 storage is working (Tool 10).
|
|
@@ -133,7 +158,7 @@ After onboarding, tools 12-15 cover routine adjustments: `describe_settings` →
|
|
|
133
158
|
|
|
134
159
|
## Fresh installs vs. existing deployments
|
|
135
160
|
|
|
136
|
-
`install_relayer` performs **fresh installs only** — it does not upgrade an existing deployment in place. Docker container names are unique per daemon, so any existing `xns-relayer` container (running **or stopped**, any channel — including an alpha-channel install from `releases.
|
|
161
|
+
`install_relayer` performs **fresh installs only** — it does not upgrade an existing deployment in place. Docker container names are unique per daemon, so any existing `xns-relayer` container (running **or stopped**, any channel — including an alpha-channel install from `releases.xns.tech`) blocks the install. Both `check_prerequisites` and `install_relayer` detect this and tell you before anything breaks.
|
|
137
162
|
|
|
138
163
|
To replace an existing deployment:
|
|
139
164
|
|
|
@@ -147,7 +172,7 @@ then run `install_relayer` again. To keep the existing deployment, skip `install
|
|
|
147
172
|
|
|
148
173
|
`install_relayer` writes `docker-compose.yml` and `.env` on the machine running the MCP, then runs `docker compose up` against whichever daemon the Docker CLI points at. When that daemon is on another machine (`DOCKER_HOST=ssh://…` or `tcp://…`, or an SSH Docker context), it refuses before writing or starting anything, and the error names the Docker host.
|
|
149
174
|
|
|
150
|
-
To install, run the MCP on the Docker host (Node.js
|
|
175
|
+
To install, run the MCP on the Docker host (Node.js 24 there, MCP client pointed at it) and run `install_relayer` again. Or unset `DOCKER_HOST` / switch to the default Docker context to install on the machine running the MCP.
|
|
151
176
|
|
|
152
177
|
`check_prerequisites` reports the same condition as a failed `install_file_location` check. Health checks still work against a remote daemon: the MCP honors `DOCKER_HOST` and the active Docker context, `check_relayer_health` and `verify_storage` probe the remote host's ports 8888/9000 instead of localhost, and `check_prerequisites` skips the local port probes. `check_relayer_health` accepts a `host` override, and `verify_storage` an `endpoint` override, for setups the auto-detection can't see (port forwards, NAT).
|
|
153
178
|
|
|
@@ -155,17 +180,18 @@ To install, run the MCP on the Docker host (Node.js 20 there, MCP client pointed
|
|
|
155
180
|
|
|
156
181
|
| Symptom | Cause | Fix |
|
|
157
182
|
|---|---|---|
|
|
158
|
-
| MCP exits with "requires Node.js
|
|
183
|
+
| MCP exits with "requires Node.js 24 or newer" | Distro Node is too old (Ubuntu apt ships Node 18) | [Installing Node.js 24](#installing-nodejs-24) |
|
|
159
184
|
| `install_relayer` reports an existing `xns-relayer` container | A previous deployment (any channel) owns the container name | [Fresh installs vs. existing deployments](#fresh-installs-vs-existing-deployments) |
|
|
160
185
|
| Port 8888/9000 already in use | Another service on the Docker host (another S3-compatible service squatting 9000) | Stop it, or install with custom ports: `install_relayer` `ui_port` / `s3_port` (health checks accept the same). After a failed `install_relayer`, remove the leftover container with `docker rm -f xns-relayer` before retrying |
|
|
161
186
|
| Port 9443 already in use | Another service on the Docker host holds the S3 HTTPS port the release compose publishes | Stop that service (`sudo ss -ltnp 'sport = :9443'` names it); `ui_port` / `s3_port` do not move 9443. Then `docker rm -f xns-relayer` and retry |
|
|
162
187
|
| Docker socket permission denied | You were added to the `docker` group after this session started, or not at all | `sudo usermod -aG docker $USER` if needed, then log out and back in |
|
|
163
188
|
| Docker is not running | The Docker daemon is stopped | `sudo systemctl start docker` |
|
|
164
189
|
| Not enough disk space | Under 10 GB free on the Docker root or the install directory | Free space there, then re-run |
|
|
165
|
-
| Image pull refused | `releases.
|
|
190
|
+
| Image pull refused | `releases.xns.tech` unreachable, or a stale registry login | Check the connection; `docker logout releases.xns.tech` |
|
|
166
191
|
| Health checks fail but containers run on a remote Docker host | Ports 8888/9000 not reachable from the management node | Open them, or pass `host` / `endpoint` overrides |
|
|
167
192
|
| `install_relayer` fails with "The Docker daemon is on <host>, not this machine" | `DOCKER_HOST` or an SSH/TCP Docker context points at another machine, and the install files would be written here instead | Run the MCP on that host and re-run, or unset `DOCKER_HOST` / use the default Docker context ([Remote Docker hosts](#remote-docker-hosts)) |
|
|
168
193
|
| `install_relayer` fails with "Failed to create directory …" | The install path needs root on the machine running the MCP (common on macOS/Windows workstations for paths under `/opt`), or a regular file sits at or along it | Pass a writable `install_path`; the exact OS error is in the MCP server's stderr log |
|
|
194
|
+
| `install_relayer` stops with '… nothing was installed' | The release files could not be downloaded, were incomplete, do not support the requested `bind_address`, or could not be held in the temporary folder | The message names it; then run `install_relayer` again |
|
|
169
195
|
|
|
170
196
|
## Authentication
|
|
171
197
|
|
|
@@ -180,7 +206,7 @@ npm install
|
|
|
180
206
|
npm test
|
|
181
207
|
```
|
|
182
208
|
|
|
183
|
-
Requires Node.js
|
|
209
|
+
Requires Node.js 24+.
|
|
184
210
|
|
|
185
211
|
## Note on `relayer-native` client
|
|
186
212
|
|
|
@@ -193,10 +219,10 @@ server is in [PRIVACY.md](./PRIVACY.md).
|
|
|
193
219
|
|
|
194
220
|
The short version:
|
|
195
221
|
|
|
196
|
-
- **No telemetry.** No analytics, crash reporting, or usage counters. It does not phone home.
|
|
222
|
+
- **No telemetry.** No analytics, crash reporting, or usage counters. It does not phone home. The one tag it adds: `install_relayer` fetches the default compose file as `docker-compose.yml?src=mcp`, a fixed source tag with no identifier, used to count downloads by source.
|
|
197
223
|
- **Tokens live in memory only.** OIDC access tokens are never written to disk; they are discarded when the process exits.
|
|
198
224
|
- **The agent never sees your password.** Sign-in happens in your own browser against `auth.xns.tech`.
|
|
199
|
-
- **
|
|
225
|
+
- **Credentials stay on your network.** `verify_storage` runs the Relayer host you pass through an allowlist (`localhost`, loopback, RFC 1918, `*.local`) before sending a token, and `setup_cli_credentials` takes no URL and sends its token only to the server's own Relayer UI. `check_relayer_health` sends plain HTTP health probes, with no credentials, to the Docker host or the `host` you pass, which is not limited to private addresses, `install_relayer` downloads a `compose_url` override only from https on `releases.xns.tech`, a `file://` URL, or a loopback, private-network or `.local` host, and the S3 test in `verify_storage` goes to the `endpoint` you pass (requests are signed, so the secret key is never sent). Otherwise the public hosts contacted are the three XNS services `auth.xns.tech`, `console.xns.tech` and `releases.xns.tech`, and Docker Hub for the `prom/node-exporter` image that an install pulls.
|
|
200
226
|
- **Your stored objects never pass through it.** The Relayer you host handles your data directly.
|
|
201
227
|
|
|
202
228
|
## Desktop extension (MCPB)
|
package/manifest.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"manifest_version": "0.3",
|
|
3
3
|
"name": "relayer-mcp",
|
|
4
|
-
"display_name": "XNS
|
|
5
|
-
"version": "0.
|
|
6
|
-
"description": "
|
|
7
|
-
"long_description": "XNS
|
|
4
|
+
"display_name": "XNS Cloud Storage",
|
|
5
|
+
"version": "0.14.3",
|
|
6
|
+
"description": "S3-compatible cloud object storage from XNS, set up and managed by your AI assistant.",
|
|
7
|
+
"long_description": "XNS is S3-compatible cloud object storage. $6.00 per TB per month. $0 egress, uncapped. 30-day minimum retention, no early-delete fee. You reach it through the Relayer, a small gateway that runs on your own machine, so the S3 endpoint and keys stay on hardware you control. This extension gives Claude 15 tools that walk the whole lifecycle — check prerequisites, register an XNS account, install the Relayer via Docker Compose, claim it to your account, choose which hosts store your data (VPD), verify an S3 round trip, provision CLI credentials, then handle day-2 work: settings, service restarts, and configuration backups.\n\nThe server runs locally on your machine and talks to your Relayer over loopback or your private network only — connections to public addresses are refused by design. Sign-in happens in your browser against XNS's identity service; the agent never sees your password.",
|
|
8
8
|
"author": {
|
|
9
9
|
"name": "SCP Corp",
|
|
10
10
|
"url": "https://xns.tech"
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"s3",
|
|
22
22
|
"object-storage",
|
|
23
23
|
"backup",
|
|
24
|
-
"self-hosted",
|
|
25
24
|
"docker",
|
|
26
25
|
"devops"
|
|
27
26
|
],
|
|
@@ -109,7 +108,7 @@
|
|
|
109
108
|
"linux"
|
|
110
109
|
],
|
|
111
110
|
"runtimes": {
|
|
112
|
-
"node": ">=
|
|
111
|
+
"node": ">=24.0.0"
|
|
113
112
|
}
|
|
114
113
|
}
|
|
115
114
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xns-cloud/relayer-mcp",
|
|
3
3
|
"mcpName": "tech.xns/relayer",
|
|
4
|
-
"version": "0.
|
|
5
|
-
"description": "
|
|
4
|
+
"version": "0.14.3",
|
|
5
|
+
"description": "S3-compatible cloud object storage from XNS, set up and managed by your AI assistant.",
|
|
6
6
|
"author": "SCP Corp",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"homepage": "https://xns.tech",
|
|
@@ -35,7 +35,6 @@
|
|
|
35
35
|
"ai-agent",
|
|
36
36
|
"stdio",
|
|
37
37
|
"docker",
|
|
38
|
-
"self-hosted",
|
|
39
38
|
"storage",
|
|
40
39
|
"backup",
|
|
41
40
|
"s3-compatible",
|
|
@@ -46,13 +45,12 @@
|
|
|
46
45
|
"agentic"
|
|
47
46
|
],
|
|
48
47
|
"engines": {
|
|
49
|
-
"node": ">=
|
|
48
|
+
"node": ">=24"
|
|
50
49
|
},
|
|
51
50
|
"files": [
|
|
52
51
|
"src/index.js",
|
|
53
52
|
"src/lib/",
|
|
54
53
|
"src/tools/",
|
|
55
|
-
"src/templates/",
|
|
56
54
|
"LICENSE",
|
|
57
55
|
"NOTICE",
|
|
58
56
|
"manifest.json",
|
package/src/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
// Node
|
|
4
|
+
// Node 24+ guard — runs BEFORE the SDK loads so users on older runtimes get a
|
|
5
5
|
// remediation message instead of a SyntaxError from a dependency.
|
|
6
6
|
const { checkNodeVersion } = require('./lib/nodeVersion');
|
|
7
7
|
const nodeCheck = checkNodeVersion(process.versions.node);
|
|
@@ -17,10 +17,12 @@ const { StdioServerTransport } = require('@modelcontextprotocol/sdk/server/stdio
|
|
|
17
17
|
// package, and the registry card cannot drift apart (CONTRACT-1, E-A2 review).
|
|
18
18
|
// package.json mcpName is the immutable registry identity, pinned by
|
|
19
19
|
// registryIdentity.test.js.
|
|
20
|
+
// The instructions go back in the initialize reply, so a client learns what
|
|
21
|
+
// XNS is and which tool to run first before it lists the tools.
|
|
20
22
|
const server = new McpServer({
|
|
21
23
|
name: require('../package.json').mcpName,
|
|
22
24
|
version: require('../package.json').version,
|
|
23
|
-
});
|
|
25
|
+
}, { instructions: require('./lib/serverInstructions') });
|
|
24
26
|
|
|
25
27
|
// Register all 15 tools
|
|
26
28
|
require('./tools/checkPrerequisites')(server);
|
package/src/lib/dockerUtil.js
CHANGED
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
const net = require('net');
|
|
4
4
|
const { execFile: nodeExecFile } = require('child_process');
|
|
5
5
|
|
|
6
|
+
// Where the Relayer image keeps the Muse token it starts its storage services with.
|
|
7
|
+
const MUSE_TOKEN_PATH = '/relayer/conf/hostioauth';
|
|
8
|
+
|
|
6
9
|
// Every loopback spelling a Docker endpoint can carry: localhost, the whole
|
|
7
10
|
// 127/8 block, the 0.0.0.0 / [::] wildcards, [::1], and IPv4-mapped 127/8
|
|
8
11
|
// ([::ffff:127.0.0.1], which URL normalizes to [::ffff:7f00:1]).
|
|
@@ -234,6 +237,36 @@ function createDockerUtil(options = {}) {
|
|
|
234
237
|
}
|
|
235
238
|
}
|
|
236
239
|
|
|
240
|
+
/**
|
|
241
|
+
* Whether the Relayer in a container holds its Muse token. The image starts
|
|
242
|
+
* HostIO, the gateway and the S3 gateway only once the owner has claimed
|
|
243
|
+
* the Relayer and signed in to its web UI, which writes the token to
|
|
244
|
+
* /relayer/conf/hostioauth; until then those services are waiting, not
|
|
245
|
+
* failing.
|
|
246
|
+
*
|
|
247
|
+
* The answer comes from stdout, so a Docker CLI warning on stderr does
|
|
248
|
+
* not change it.
|
|
249
|
+
*
|
|
250
|
+
* @param {string} name - Exact container name
|
|
251
|
+
* @returns {Promise<boolean|null>} true token present, false not yet,
|
|
252
|
+
* null unknown (no such container, not running, docker unreachable,
|
|
253
|
+
* timed out)
|
|
254
|
+
*/
|
|
255
|
+
async function hasMuseToken(name) {
|
|
256
|
+
try {
|
|
257
|
+
const { stdout } = await docker(
|
|
258
|
+
['exec', String(name), 'sh', '-c', `if [ -s ${MUSE_TOKEN_PATH} ]; then echo present; else echo absent; fi`],
|
|
259
|
+
{ timeout: 10000 },
|
|
260
|
+
);
|
|
261
|
+
const answer = stdout.trim();
|
|
262
|
+
if (answer === 'present') return true;
|
|
263
|
+
if (answer === 'absent') return false;
|
|
264
|
+
return null;
|
|
265
|
+
} catch {
|
|
266
|
+
return null;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
237
270
|
/**
|
|
238
271
|
* Resolve which machine the Docker daemon actually runs on.
|
|
239
272
|
*
|
|
@@ -259,7 +292,7 @@ function createDockerUtil(options = {}) {
|
|
|
259
292
|
}
|
|
260
293
|
}
|
|
261
294
|
|
|
262
|
-
return { docker, composeUp, isContainerRunning, findContainer, containerHostPorts, containerProject, getDockerHost };
|
|
295
|
+
return { docker, composeUp, isContainerRunning, findContainer, containerHostPorts, containerProject, hasMuseToken, getDockerHost };
|
|
263
296
|
}
|
|
264
297
|
|
|
265
298
|
module.exports = { createDockerUtil, parseDockerEndpoint, redactEndpoint, classifyDockerFailure };
|
package/src/lib/ensureToken.js
CHANGED
|
@@ -3,6 +3,43 @@
|
|
|
3
3
|
const { acquireToken, refreshToken } = require('./oidcAuth');
|
|
4
4
|
const sharedTokenState = require('./tokenState');
|
|
5
5
|
|
|
6
|
+
// One pending browser sign-in per token state, shared by every tool that
|
|
7
|
+
// builds a token manager on that state. Keyed by the state module so
|
|
8
|
+
// injected test state stays isolated from the real one.
|
|
9
|
+
const pendingSignIns = new WeakMap();
|
|
10
|
+
|
|
11
|
+
// Why the last sign-in failed after its link was handed out, per token state.
|
|
12
|
+
// The next link message reports it once, so the person is not sent round new
|
|
13
|
+
// links with no word about why the last one did not work.
|
|
14
|
+
const lastSignInFailures = new WeakMap();
|
|
15
|
+
|
|
16
|
+
// A fixed reason for why a sign-in stopped. The raw error can carry the
|
|
17
|
+
// provider's response body, so only these sentences reach the person; the
|
|
18
|
+
// full text goes to the server log.
|
|
19
|
+
function signInFailureReason(err) {
|
|
20
|
+
const message = err && err.message ? String(err.message) : '';
|
|
21
|
+
if (/^OIDC sign-in timed out/.test(message)) return 'it timed out before the browser came back';
|
|
22
|
+
const oidc = message.match(/^OIDC error: ([a-z_]{1,64})$/);
|
|
23
|
+
if (oidc) return `the sign-in server returned ${oidc[1]}`;
|
|
24
|
+
const exchange = message.match(/^Token exchange failed \(HTTP (\d{3})\)/);
|
|
25
|
+
if (exchange) return `the token exchange failed (HTTP ${exchange[1]})`;
|
|
26
|
+
return 'it stopped with an error (see the server log)';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// The sign-in link redirects to 127.0.0.1:<port> on the machine running this
|
|
30
|
+
// server, so the browser has to reach that port.
|
|
31
|
+
function signInLinkMessage(url) {
|
|
32
|
+
const message = `Open this link in a browser on this machine to sign in to XNS (on WSL the Windows browser works), then call this tool again: ${url}`;
|
|
33
|
+
let port = '';
|
|
34
|
+
try {
|
|
35
|
+
port = new URL(new URL(url).searchParams.get('redirect_uri')).port;
|
|
36
|
+
} catch {
|
|
37
|
+
return message;
|
|
38
|
+
}
|
|
39
|
+
if (!port) return message;
|
|
40
|
+
return `${message}\nIf your browser is on another machine, first forward the port with: ssh -L ${port}:127.0.0.1:${port} <this machine>`;
|
|
41
|
+
}
|
|
42
|
+
|
|
6
43
|
/**
|
|
7
44
|
* Create an ensureToken function with injectable deps for testing.
|
|
8
45
|
* Used by getHostTags and configureVpd — both need OIDC token
|
|
@@ -51,10 +88,58 @@ function createTokenManager(options = {}) {
|
|
|
51
88
|
}
|
|
52
89
|
}
|
|
53
90
|
|
|
54
|
-
// Full OIDC sign-in
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
91
|
+
// Full OIDC sign-in — join one already waiting for the person, if any
|
|
92
|
+
let pending = pendingSignIns.get(_tokenState);
|
|
93
|
+
if (pending) return raceSignInOrLink(pending);
|
|
94
|
+
|
|
95
|
+
pending = startSignIn();
|
|
96
|
+
pendingSignIns.set(_tokenState, pending);
|
|
97
|
+
pending.signIn.then(
|
|
98
|
+
() => { clearPending(pending); },
|
|
99
|
+
(err) => {
|
|
100
|
+
if (pending.linkHandedOut) {
|
|
101
|
+
console.error(`[sign-in] the sign-in did not finish: ${err && err.message ? err.message : String(err)}`);
|
|
102
|
+
lastSignInFailures.set(_tokenState, signInFailureReason(err));
|
|
103
|
+
}
|
|
104
|
+
clearPending(pending);
|
|
105
|
+
},
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
return raceSignInOrLink(pending);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Either the sign-in finishes, or the browser could not be opened and the
|
|
112
|
+
// person needs the link. The sign-in keeps running in that case. A call that
|
|
113
|
+
// joins a pending sign-in gets the same race, so it never waits blind.
|
|
114
|
+
function raceSignInOrLink(pending) {
|
|
115
|
+
return Promise.race([
|
|
116
|
+
pending.signIn,
|
|
117
|
+
pending.link.then((url) => {
|
|
118
|
+
pending.linkHandedOut = true;
|
|
119
|
+
const failure = lastSignInFailures.get(_tokenState);
|
|
120
|
+
lastSignInFailures.delete(_tokenState);
|
|
121
|
+
const prefix = failure ? `The last sign-in did not finish: ${failure}. ` : '';
|
|
122
|
+
const err = new Error(prefix + signInLinkMessage(url));
|
|
123
|
+
err.code = 'SIGNIN_LINK';
|
|
124
|
+
err.authorizeUrl = url;
|
|
125
|
+
throw err;
|
|
126
|
+
}),
|
|
127
|
+
]);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function startSignIn() {
|
|
131
|
+
let reportLink;
|
|
132
|
+
const link = new Promise((resolve) => { reportLink = resolve; });
|
|
133
|
+
const signIn = _acquireToken({ ...oidcOpts, onBrowserOpenFailed: reportLink })
|
|
134
|
+
.then((newState) => {
|
|
135
|
+
_tokenState.set(newState);
|
|
136
|
+
return newState.access_token;
|
|
137
|
+
});
|
|
138
|
+
return { signIn, link };
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function clearPending(pending) {
|
|
142
|
+
if (pendingSignIns.get(_tokenState) === pending) pendingSignIns.delete(_tokenState);
|
|
58
143
|
}
|
|
59
144
|
|
|
60
145
|
/**
|
package/src/lib/nodeVersion.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// (Ubuntu's default apt repo ships Node 18) so the friendly message below is
|
|
5
5
|
// what the user sees, not a SyntaxError from a dependency.
|
|
6
6
|
|
|
7
|
-
const MIN_MAJOR =
|
|
7
|
+
const MIN_MAJOR = 24;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Check a Node.js version string against the package's engines floor.
|
|
@@ -20,10 +20,10 @@ function checkNodeVersion(version) {
|
|
|
20
20
|
const message = [
|
|
21
21
|
`relayer-mcp requires Node.js ${MIN_MAJOR} or newer — you are running v${version}.`,
|
|
22
22
|
'',
|
|
23
|
-
"Ubuntu's default apt repository only ships Node 18. Install Node
|
|
23
|
+
"Ubuntu's default apt repository only ships Node 18. Install Node 24 with nvm:",
|
|
24
24
|
'',
|
|
25
25
|
' curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash',
|
|
26
|
-
' \\. "$HOME/.nvm/nvm.sh" && nvm install
|
|
26
|
+
' \\. "$HOME/.nvm/nvm.sh" && nvm install 24',
|
|
27
27
|
'',
|
|
28
28
|
'Or via NodeSource: https://github.com/nodesource/distributions#installation-instructions',
|
|
29
29
|
'',
|
package/src/lib/oidcAuth.js
CHANGED
|
@@ -29,7 +29,9 @@ const DEFAULT_SIGNIN_TIMEOUT_MS = 1800000; // 30 minutes
|
|
|
29
29
|
* @param {object} [opts.httpClient] - Injected HTTP client (testing)
|
|
30
30
|
* @param {function} [opts.openBrowser] - Injected browser opener (testing)
|
|
31
31
|
* @param {function} [opts.createServer] - Injected http.createServer (testing)
|
|
32
|
-
* @
|
|
32
|
+
* @param {function} [opts.onBrowserOpenFailed] - Called with the authorize URL when the
|
|
33
|
+
* browser cannot be opened; the loopback listener keeps waiting for the callback
|
|
34
|
+
* @returns {Promise<{access_token: string, expires_at: number, refresh_token: string}>}
|
|
33
35
|
*/
|
|
34
36
|
async function acquireToken(opts = {}) {
|
|
35
37
|
const clientId = opts.clientId || DEFAULT_CLIENT_ID;
|
|
@@ -55,6 +57,7 @@ async function acquireToken(opts = {}) {
|
|
|
55
57
|
openBrowser,
|
|
56
58
|
createServer: _createServer,
|
|
57
59
|
timeoutMs: opts.timeoutMs,
|
|
60
|
+
onBrowserOpenFailed: opts.onBrowserOpenFailed,
|
|
58
61
|
});
|
|
59
62
|
|
|
60
63
|
// 5. Exchange code for tokens
|
|
@@ -79,7 +82,6 @@ async function acquireToken(opts = {}) {
|
|
|
79
82
|
access_token: data.access_token,
|
|
80
83
|
refresh_token: data.refresh_token,
|
|
81
84
|
expires_at: Date.now() + (data.expires_in * 1000),
|
|
82
|
-
authorize_url: undefined, // already consumed
|
|
83
85
|
};
|
|
84
86
|
}
|
|
85
87
|
|
|
@@ -157,13 +159,25 @@ function captureAuthCode(opts) {
|
|
|
157
159
|
const srv = createServer((req, res) => {
|
|
158
160
|
const url = new URL(req.url, `http://127.0.0.1`);
|
|
159
161
|
|
|
162
|
+
// Validate the OIDC state first (CSRF). Any local process or web page can
|
|
163
|
+
// reach this port, so a request with a missing or wrong state is answered
|
|
164
|
+
// with 400 and ignored; it must not end the shared sign-in.
|
|
165
|
+
const returnedState = url.searchParams.get('state');
|
|
166
|
+
if (!returnedState || returnedState !== expectedState) {
|
|
167
|
+
res.writeHead(400, { 'Content-Type': 'text/html; charset=utf-8' });
|
|
168
|
+
res.end('<html><body><h1>Invalid state parameter</h1><p>This request does not belong to the current sign-in.</p></body></html>');
|
|
169
|
+
return; // Keep waiting for the real redirect
|
|
170
|
+
}
|
|
171
|
+
|
|
160
172
|
const error = url.searchParams.get('error');
|
|
161
173
|
if (error) {
|
|
162
174
|
res.writeHead(400, { 'Content-Type': 'text/html; charset=utf-8' });
|
|
163
175
|
res.end('<html><body><h1>Authentication failed</h1><p>You can close this window.</p></body></html>');
|
|
164
176
|
clearTimeout(timeoutHandle);
|
|
165
177
|
srv.close();
|
|
166
|
-
|
|
178
|
+
// Only the error code reaches the caller; error_description is free text.
|
|
179
|
+
const errorCode = /^[a-z_]{1,64}$/.test(error) ? error : 'unknown';
|
|
180
|
+
return reject(new Error(`OIDC error: ${errorCode}`));
|
|
167
181
|
}
|
|
168
182
|
|
|
169
183
|
const code = url.searchParams.get('code');
|
|
@@ -173,16 +187,6 @@ function captureAuthCode(opts) {
|
|
|
173
187
|
return; // Don't close server — wait for the real redirect
|
|
174
188
|
}
|
|
175
189
|
|
|
176
|
-
// R5-STATE-1: Validate OIDC state parameter to prevent CSRF
|
|
177
|
-
const returnedState = url.searchParams.get('state');
|
|
178
|
-
if (returnedState !== expectedState) {
|
|
179
|
-
res.writeHead(400, { 'Content-Type': 'text/html; charset=utf-8' });
|
|
180
|
-
res.end('<html><body><h1>Invalid state parameter</h1><p>Possible CSRF attack. Please try again.</p></body></html>');
|
|
181
|
-
clearTimeout(timeoutHandle);
|
|
182
|
-
srv.close();
|
|
183
|
-
return reject(new Error('OIDC callback state mismatch — possible CSRF. Please try again.'));
|
|
184
|
-
}
|
|
185
|
-
|
|
186
190
|
res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
|
|
187
191
|
res.end('<html><body><h1>Authentication successful</h1><p>You can close this window and return to the agent.</p></body></html>');
|
|
188
192
|
clearTimeout(timeoutHandle);
|
|
@@ -227,10 +231,17 @@ function captureAuthCode(opts) {
|
|
|
227
231
|
reject(new Error(`OIDC sign-in timed out after ${Math.round(timeoutMs / 60000)} minutes. Please try again.`));
|
|
228
232
|
}, timeoutMs);
|
|
229
233
|
|
|
230
|
-
// Open browser
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
+
// Open the browser. When that fails (no desktop, SSH, WSL) the person
|
|
235
|
+
// can still sign in by hand, so hand the URL to the caller and keep
|
|
236
|
+
// the listener waiting for the callback.
|
|
237
|
+
const reportOpenFailure = () => {
|
|
238
|
+
if (typeof opts.onBrowserOpenFailed === 'function') opts.onBrowserOpenFailed(authorizeUrl);
|
|
239
|
+
};
|
|
240
|
+
try {
|
|
241
|
+
Promise.resolve(openBrowser(authorizeUrl)).catch(reportOpenFailure);
|
|
242
|
+
} catch {
|
|
243
|
+
reportOpenFailure();
|
|
244
|
+
}
|
|
234
245
|
});
|
|
235
246
|
});
|
|
236
247
|
}
|