@xns-cloud/relayer-mcp 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/PRIVACY.md CHANGED
@@ -28,7 +28,7 @@ Only through the ordinary, visible operation of the tools you ask the agent to r
28
28
  | Creating an account, signing in | Your credentials, entered by you in your own browser | `auth.xns.tech` (Keycloak) |
29
29
  | Claiming a Relayer to your account | The claim session and the installation's identity | `console.xns.tech` |
30
30
  | 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.scpri.me` |
31
+ | Installing or updating the Relayer | An anonymous download of the Docker Compose bundle and images | `releases.xns.tech`; the `prom/node-exporter` image comes from Docker Hub |
32
32
 
33
33
  The agent never handles your password. Sign-in happens in your browser against our identity
34
34
  service; the extension receives only a short-lived access token.
@@ -48,13 +48,19 @@ Both are yours to delete at any time.
48
48
 
49
49
  ## Network boundary
50
50
 
51
- The extension cannot be pointed at a Relayer on the public internet. Two mechanisms enforce
52
- that: the tools that accept a host or endpoint argument run it through an allowlist that
53
- permits only `localhost`, loopback, RFC 1918 private ranges (`10/8`, `172.16/12`,
54
- `192.168/16`), and `*.local` (`src/lib/hostAllowlist.js`); the remaining tools expose no URL
55
- parameter at all and are fixed to `localhost`. Either way there is no input that reaches a
56
- public Relayer. The only public hosts this software contacts are the three XNS services
57
- named above.
51
+ No tool sends your sign-in token to a Relayer on the public internet. The tools that send it
52
+ to a Relayer (`verify_storage`, `setup_cli_credentials`) run its host through an allowlist
53
+ that permits only `localhost`, loopback, RFC 1918 private ranges (`10/8`, `172.16/12`,
54
+ `192.168/16`), and `*.local` (`src/lib/hostAllowlist.js`). Three inputs are not limited to
55
+ private addresses: the `host` of `check_relayer_health`, which gets plain HTTP health probes;
56
+ the `compose_url` of `install_relayer`, from which the compose file is downloaded; and the S3
57
+ `endpoint` of `verify_storage` (by default port 9000 on the Docker host), which gets the
58
+ round-trip test as S3 requests signed with a throwaway key (or the keys you pass). A signed
59
+ request carries the access key id and a signature, never the secret. The tool deletes a
60
+ throwaway key after the test, pass or fail; if that deletion fails, the reply carries a
61
+ `cleanup_warning` and the key stays until you remove it. Apart from those, the only public hosts contacted are the
62
+ three XNS services named above and, for the `prom/node-exporter` image that an install
63
+ pulls, Docker Hub.
58
64
 
59
65
  ## Stopping it
60
66
 
package/README.md CHANGED
@@ -4,38 +4,49 @@
4
4
  [![license](https://img.shields.io/npm/l/@xns-cloud/relayer-mcp)](./LICENSE)
5
5
  [![node](https://img.shields.io/node/v/@xns-cloud/relayer-mcp)](https://nodejs.org/)
6
6
 
7
- MCP server for [XNS Relayer](https://xns.tech) — S3-compatible decentralized object storage. Provides 15 tools that let an AI agent drive the complete Relayer setup and day-2 management conversationally over stdio transport.
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 the `xns-storage` plugin: it registers this server and 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
+ ```
15
+
16
+ then say: set up XNS storage
17
+
18
+ For any other MCP client, run the server with npx:
8
19
 
9
20
  ```bash
10
21
  npx @xns-cloud/relayer-mcp@latest
11
22
  ```
12
23
 
13
- **Pricing:** [$6.00 per TB per month](https://xns.tech/pricing) — one rate, protection included, [$0 egress uncapped](https://xns.tech/pricing), [30-day minimum retention](https://xns.tech/pricing) with no separate early-delete fee.
24
+ **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
25
 
15
26
  ## Requirements
16
27
 
17
28
  On Ubuntu 24.04 or Debian 12, one command sets up everything:
18
29
 
19
30
  ```bash
20
- curl -fsSL https://releases.scpri.me/relayer/install.sh | sh
31
+ curl -fsSL https://releases.xns.tech/relayer/install.sh | sh
21
32
  ```
22
33
 
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 20 when Node is missing or older and registers this MCP. Log out and back in afterwards so the `docker` group applies. On macOS or Windows it installs nothing and points you to Docker Desktop.
34
+ 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
35
 
25
36
  Without the script, the MCP needs:
26
37
 
27
- - **Node.js 20+** — see [Installing Node.js 20](#installing-nodejs-20) if your distro ships an older version.
38
+ - **Node.js 24+** — see [Installing Node.js 24](#installing-nodejs-24) if your distro ships an older version.
28
39
  - **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
40
 
30
- ### Installing Node.js 20
41
+ ### Installing Node.js 24
31
42
 
32
- Ubuntu's default apt repository only ships Node 18, which is too old. Two ways to get Node 20:
43
+ Ubuntu's default apt repository only ships Node 18, which is too old. Two ways to get Node 24:
33
44
 
34
45
  **nvm** (recommended — no root required):
35
46
 
36
47
  ```bash
37
48
  curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
38
- \. "$HOME/.nvm/nvm.sh" && nvm install 20
49
+ \. "$HOME/.nvm/nvm.sh" && nvm install 24
39
50
  ```
40
51
 
41
52
  **NodeSource** (system-wide): follow <https://github.com/nodesource/distributions#installation-instructions>.
@@ -46,24 +57,35 @@ If you start the MCP on an older Node, it exits immediately with this same guida
46
57
 
47
58
  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
59
 
49
- **If your environment is ephemeral**, run the MCP on a persistent Docker host instead (install Node.js 20 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.
60
+ **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
61
 
51
62
  ## Install
52
63
 
53
64
  On Ubuntu 24.04 or Debian 12, one command installs the Relayer and registers this MCP when Claude Code is present:
54
65
 
55
66
  ```bash
56
- curl -fsSL https://releases.scpri.me/relayer/install.sh | sh
67
+ curl -fsSL https://releases.xns.tech/relayer/install.sh | sh
57
68
  ```
58
69
 
59
- To register the MCP by hand instead:
70
+ If you use Claude Code with the `xns-storage` plugin, remove the `relayer` registration the script made; the plugin registers its own.
60
71
 
61
- **Claude Code** (one command, if you registered nothing yet):
72
+ To set it up yourself instead:
73
+
74
+ **Claude Code** (with the plugin, which registers this server for you):
75
+
76
+ ```text
77
+ /plugin marketplace add xns-cloud/xns-storage-plugin
78
+ /plugin install xns-storage@xns-cloud
79
+ ```
80
+
81
+ Without the plugin, register it by hand:
62
82
 
63
83
  ```bash
64
84
  claude mcp add --scope user relayer -- npx @xns-cloud/relayer-mcp@latest
65
85
  ```
66
86
 
87
+ Do one or the other, not both: with both, the 15 tools load twice.
88
+
67
89
  **Claude Desktop / any MCP client** — add to your `claude_desktop_config.json` (or equivalent):
68
90
 
69
91
  ```json
@@ -99,8 +121,8 @@ No separate install step required — npx fetches the package on demand.
99
121
  | 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. |
100
122
  | 2 | `start_registration` | Get the browser sign-up URL for creating an XNS account — the agent never handles credentials. |
101
123
  | 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.scpri.me/relayer/release/docker-compose.yml` and its `.env`, anonymous pull, no `docker login`) — add the ports to that `.env`, and start the containers. Falls back to a bundled service-parity copy if either fetch fails. 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. |
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. |
124
+ | 4 | `install_relayer` | Fetch the canonical release channel bundle — relayer + Prometheus/Grafana monitoring stack (`https://releases.xns.tech/relayer/release/docker-compose.yml` and its `.env`, anonymous pull, no `docker login`) — 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. |
125
+ | 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
126
  | 6 | `start_claim` | Initiate a claim session — returns a URL for browser confirmation. |
105
127
  | 7 | `check_claim_status` | Poll claim state (STATE_1 / STATE_2 / STATE_3). |
106
128
  | 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). |
@@ -119,7 +141,8 @@ No separate install step required — npx fetches the package on demand.
119
141
  3. User clicks email verification link; agent polls (Tool 3).
120
142
  4. Agent installs and starts Relayer containers (Tool 4) — it writes the
121
143
  released compose + `.env` itself; the user is never asked for a compose URL.
122
- 5. Agent polls health until UI + S3 are up (Tool 5).
144
+ 5. Agent polls health until the UI is up (Tool 5); the S3 gateway starts once the
145
+ Relayer is claimed and its owner signs in to the Relayer web UI.
123
146
  6. Agent initiates claim; user opens claim URL in browser (Tools 6 + 7).
124
147
  7. Agent signs in via OIDC to configure host preferences (Tools 8 + 9).
125
148
  8. Agent verifies S3 storage is working (Tool 10).
@@ -133,7 +156,7 @@ After onboarding, tools 12-15 cover routine adjustments: `describe_settings` →
133
156
 
134
157
  ## Fresh installs vs. existing deployments
135
158
 
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.scpri.me`) blocks the install. Both `check_prerequisites` and `install_relayer` detect this and tell you before anything breaks.
159
+ `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
160
 
138
161
  To replace an existing deployment:
139
162
 
@@ -147,7 +170,7 @@ then run `install_relayer` again. To keep the existing deployment, skip `install
147
170
 
148
171
  `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
172
 
150
- To install, run the MCP on the Docker host (Node.js 20 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.
173
+ 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
174
 
152
175
  `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
176
 
@@ -155,17 +178,18 @@ To install, run the MCP on the Docker host (Node.js 20 there, MCP client pointed
155
178
 
156
179
  | Symptom | Cause | Fix |
157
180
  |---|---|---|
158
- | MCP exits with "requires Node.js 20 or newer" | Distro Node is too old (Ubuntu apt ships Node 18) | [Installing Node.js 20](#installing-nodejs-20) |
181
+ | 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
182
  | `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
183
  | 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
184
  | 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
185
  | 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
186
  | Docker is not running | The Docker daemon is stopped | `sudo systemctl start docker` |
164
187
  | 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.scpri.me` unreachable, or a stale registry login | Check the connection; `docker logout releases.scpri.me` |
188
+ | Image pull refused | `releases.xns.tech` unreachable, or a stale registry login | Check the connection; `docker logout releases.xns.tech` |
166
189
  | 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
190
  | `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
191
  | `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 |
192
+ | `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
193
 
170
194
  ## Authentication
171
195
 
@@ -180,7 +204,7 @@ npm install
180
204
  npm test
181
205
  ```
182
206
 
183
- Requires Node.js 20+.
207
+ Requires Node.js 24+.
184
208
 
185
209
  ## Note on `relayer-native` client
186
210
 
@@ -196,7 +220,7 @@ The short version:
196
220
  - **No telemetry.** No analytics, crash reporting, or usage counters. It does not phone home.
197
221
  - **Tokens live in memory only.** OIDC access tokens are never written to disk; they are discarded when the process exits.
198
222
  - **The agent never sees your password.** Sign-in happens in your own browser against `auth.xns.tech`.
199
- - **Private network only.** No tool can be pointed at a public Relayer: the ones taking a host argument run it through an allowlist (`localhost`, loopback, RFC 1918, `*.local`), and the rest expose no URL parameter and are fixed to `localhost`. The three XNS services it contacts are `auth.xns.tech`, `console.xns.tech`, and `releases.scpri.me`.
223
+ - **Credentials stay on your network.** The tools that send a token to a Relayer (`verify_storage`, `setup_cli_credentials`) run its host through an allowlist (`localhost`, loopback, RFC 1918, `*.local`). `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 from any `compose_url` you pass, 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
224
  - **Your stored objects never pass through it.** The Relayer you host handles your data directly.
201
225
 
202
226
  ## 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 Relayer",
5
- "version": "0.12.0",
6
- "description": "Set up and manage a self-hosted XNS Relayer — S3-compatible object storage — conversationally.",
7
- "long_description": "XNS Relayer is S3-compatible object storage you host yourself: $0 egress, uncapped, 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.",
4
+ "display_name": "XNS Cloud Storage",
5
+ "version": "0.13.0",
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": ">=20.0.0"
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.12.0",
5
- "description": "MCP server for XNS Relayer onboarding and day-2 management — drives Relayer setup, settings, and backups conversationally over stdio, npx-ready",
4
+ "version": "0.13.0",
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": ">=20"
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 20+ guard — runs BEFORE the SDK loads so users on older runtimes get a
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);
@@ -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 };
@@ -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 = 20;
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 20 with nvm:",
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 20',
26
+ ' \\. "$HOME/.nvm/nvm.sh" && nvm install 24',
27
27
  '',
28
28
  'Or via NodeSource: https://github.com/nodesource/distributions#installation-instructions',
29
29
  '',
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ // The text a client receives as `instructions` in the initialize reply: what
4
+ // XNS is, what the 15 tools do, the first tool to run, and where Claude users
5
+ // find the step-by-step skills. It must read correctly with no plugin installed.
6
+ module.exports = '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.'
7
+ + ' These 15 tools set the Relayer up and manage it: check the machine, create an XNS account in the browser, install and claim the Relayer, choose which hosts store the data, verify an S3 round trip, write CLI credentials, then change settings, restart services and back up the configuration.'
8
+ + ' Start with check_prerequisites.'
9
+ + " In Claude, the xns-storage plugin's skills (set-up-xns-storage and use-xns-storage) hold the step-by-step."
10
+ + ' In Claude Code, install it with /plugin marketplace add xns-cloud/xns-storage-plugin and then /plugin install xns-storage@xns-cloud.'
11
+ + ' The tools work the same without the plugin.';
@@ -27,7 +27,7 @@ module.exports = function registerCheckClaimStatus(server, options = {}) {
27
27
  server.registerTool(
28
28
  'check_claim_status',
29
29
  {
30
- title: 'check_claim_status',
30
+ title: 'Check claim status',
31
31
  description: 'Poll the status of a claim session. Checks every 10 seconds. States: STATE_1 (pending — user has not yet opened the claim URL), STATE_2 (in progress — user is completing the claim in browser), STATE_3 (completed — claim successful). Automatically proceeds when STATE_3 is reached.',
32
32
  inputSchema: {
33
33
  claim_id: z.string().describe('The claim_id returned by start_claim'),
@@ -30,7 +30,7 @@ module.exports = function registerCheckEmailVerified(server, options = {}) {
30
30
  server.registerTool(
31
31
  'check_email_verified',
32
32
  {
33
- title: 'check_email_verified',
33
+ title: 'Check email verification',
34
34
  description: 'Poll to check if the user has verified their email address. Automatically polls every 15 seconds for up to 30 minutes. Returns immediately if already verified. If the email has no account, indicates registration is needed.',
35
35
  inputSchema: {
36
36
  email: z.string().email().describe('Email address to check verification status'),
@@ -8,7 +8,7 @@ const { createDockerUtil, redactEndpoint, classifyDockerFailure } = require('../
8
8
  const { environmentProbe: defaultEnvironmentProbe } = require('../lib/environmentProbe');
9
9
 
10
10
  // The one-command install (installs Docker, the compose plugin and the Relayer).
11
- const INSTALL_COMMAND = 'curl -fsSL https://releases.scpri.me/relayer/install.sh | sh';
11
+ const INSTALL_COMMAND = 'curl -fsSL https://releases.xns.tech/relayer/install.sh | sh';
12
12
 
13
13
  // The container the install script and install_relayer start.
14
14
  const RELAYER_CONTAINER = 'xns-relayer';
@@ -238,7 +238,7 @@ module.exports = function registerCheckPrerequisites(server, options = {}) {
238
238
  server.registerTool(
239
239
  'check_prerequisites',
240
240
  {
241
- title: 'check_prerequisites',
241
+ title: 'Check prerequisites',
242
242
  description: 'Check system prerequisites for XNS Relayer installation: Docker installed and its daemon running (local or remote via DOCKER_HOST / ssh:// context), the Docker compose plugin, docker group access for this user, required ports (8888, 9000, 9443; a port held by the running xns-relayer container passes), no container from another project named prometheus or alertmanager, an existing xns-relayer installation, at least 10 GB free on the Docker root and the install directory, and network connectivity to console.xns.tech and auth.xns.tech. Also fails the check when the Docker daemon is on another machine (install_file_location), because install_relayer refuses in that case; run the MCP on the Docker host instead. Run this first before any other relayer tool.',
243
243
  inputSchema: {
244
244
  /* no parameters */
@@ -292,7 +292,7 @@ module.exports = function registerCheckPrerequisites(server, options = {}) {
292
292
  name: 'docker',
293
293
  passed: false,
294
294
  detail: 'Docker is not installed on this machine',
295
- remediation: `Run the one-command install, which installs Docker, the compose plugin and the Relayer: ${INSTALL_COMMAND} (Ubuntu 24.04 or Debian 12). To install on a different persistent machine, run this MCP on that machine (a Docker host with Node.js 20) rather than pointing at it remotely.`,
295
+ remediation: `Run the one-command install, which installs Docker, the compose plugin and the Relayer: ${INSTALL_COMMAND} (Ubuntu 24.04 or Debian 12). To install on a different persistent machine, run this MCP on that machine (a Docker host with Node.js 24) rather than pointing at it remotely.`,
296
296
  });
297
297
  } else if (remote) {
298
298
  // DECISION: a failing `docker info` against an ssh:// or tcp://
@@ -396,7 +396,7 @@ module.exports = function registerCheckPrerequisites(server, options = {}) {
396
396
  name: 'install_file_location',
397
397
  passed: false,
398
398
  detail: `The Docker daemon is on ${dockerHost.host}, not this machine. install_relayer will refuse: it writes docker-compose.yml and .env on this machine, not on ${dockerHost.host}.`,
399
- remediation: `Run the MCP on ${dockerHost.host} (install Node.js 20 there and point your MCP client at it), then run check_prerequisites and install_relayer from there. Or unset DOCKER_HOST / switch to the default Docker context to install on this machine.`,
399
+ remediation: `Run the MCP on ${dockerHost.host} (install Node.js 24 there and point your MCP client at it), then run check_prerequisites and install_relayer from there. Or unset DOCKER_HOST / switch to the default Docker context to install on this machine.`,
400
400
  });
401
401
  }
402
402
 
@@ -501,7 +501,7 @@ module.exports = function registerCheckPrerequisites(server, options = {}) {
501
501
  { url: 'https://auth.xns.tech/auth/realms/scprime/.well-known/openid-configuration', name: 'connectivity_auth', host: 'auth.xns.tech' },
502
502
  // The registry install_relayer pulls from (release channel, anonymous).
503
503
  // /v2/ is the registry version probe — 200 without credentials.
504
- { url: 'https://releases.scpri.me/v2/', name: 'connectivity_registry', host: 'releases.scpri.me' },
504
+ { url: 'https://releases.xns.tech/v2/', name: 'connectivity_registry', host: 'releases.xns.tech' },
505
505
  ];
506
506
  for (const { url, name, host } of connectivityChecks) {
507
507
  try {
@@ -11,6 +11,9 @@ const POLL_TIMEOUT_MS = 300000; // 300s (AC-13, QA-1)
11
11
  // Loopback aliases — all classify as "local", not a remote Docker host.
12
12
  const LOCAL_HOSTS = new Set(['localhost', '127.0.0.1', '[::1]']);
13
13
 
14
+ // The container install_relayer creates.
15
+ const RELAYER_CONTAINER = 'xns-relayer';
16
+
14
17
  /**
15
18
  * Normalize a user-supplied or detected host for URL composition: trim, strip
16
19
  * ANY accidental scheme prefix (http://, tcp://, ssh://…), bracket bare IPv6.
@@ -34,6 +37,21 @@ function normalizeHost(value) {
34
37
  return hostname.includes(':') && !hostname.startsWith('[') ? `[${hostname}]` : hostname;
35
38
  }
36
39
 
40
+ /**
41
+ * Whether two normalized hosts name the same machine (all loopback names match,
42
+ * case ignored).
43
+ *
44
+ * @param {string} a
45
+ * @param {string} b
46
+ * @returns {boolean}
47
+ */
48
+ function sameMachine(a, b) {
49
+ // Host names are case-insensitive: 'Docker-Box.lan' and 'docker-box.lan' are one machine.
50
+ const x = a.toLowerCase();
51
+ const y = b.toLowerCase();
52
+ return x === y || (LOCAL_HOSTS.has(x) && LOCAL_HOSTS.has(y));
53
+ }
54
+
37
55
  /**
38
56
  * Tool 5: check_relayer_health
39
57
  * AC-13: report healthy only when ui+s3+hostio healthy; name unhealthy component; 300s timeout.
@@ -54,8 +72,8 @@ module.exports = function registerCheckRelayerHealth(server, options = {}) {
54
72
  server.registerTool(
55
73
  'check_relayer_health',
56
74
  {
57
- title: 'check_relayer_health',
58
- description: 'Check the health of all Relayer services: UI (port 8888), S3 gateway (port 9000), HostIO, and the monitoring sidecars (Prometheus + Grafana containers). Polls every 10 seconds for up to 300 seconds. Reports each component status individually and names any unhealthy component; a missing monitoring stack reports as degraded (dashboards empty) without blocking the install flow. Targets the machine the Docker daemon runs on (auto-detected from the Docker context — supports remote ssh:// Docker hosts); pass host to override. Note: HostIO health status is unknown until OIDC authentication is completed.',
75
+ title: 'Check Relayer health',
76
+ description: 'Check the health of all Relayer services: UI (port 8888), S3 gateway (port 9000), HostIO, and the monitoring sidecars (Prometheus + Grafana containers). Polls every 10 seconds for up to 300 seconds. Reports each component status individually and names any unhealthy component; a missing monitoring stack reports as degraded (dashboards empty) without blocking the install flow. Targets the machine the Docker daemon runs on (auto-detected from the Docker context — supports remote ssh:// Docker hosts); pass host to override. Until the owner claims the Relayer and signs in to its web UI it reports awaiting_claim: the S3 gateway and HostIO start only then, so a fresh install is ready for start_claim once the UI answers. Note: HostIO health status is unknown until OIDC authentication is completed.',
59
77
  inputSchema: {
60
78
  poll: z.boolean().optional().default(true).describe('If true (default), poll until healthy or timeout. If false, check once.'),
61
79
  host: z.string().trim().min(1).optional().describe('Hostname/IP where the Relayer containers run. Default: auto-detected from the Docker context (localhost, or the remote host for ssh:// / tcp:// contexts).'),
@@ -76,6 +94,17 @@ module.exports = function registerCheckRelayerHealth(server, options = {}) {
76
94
  // Resolve where the containers actually run — once per call.
77
95
  const dockerHost = host ? { host, remote: !LOCAL_HOSTS.has(normalizeHost(host)) } : await docker.getDockerHost();
78
96
  const target = normalizeHost(dockerHost.host);
97
+
98
+ // The token check runs through the Docker CLI, so it only speaks
99
+ // for `target` when the CLI points at that machine. Resolved once,
100
+ // and only when a check needs it.
101
+ let dockerReachesTarget;
102
+ const tokenCheckApplies = async () => {
103
+ if (dockerReachesTarget === undefined) {
104
+ dockerReachesTarget = !host || sameMachine(target, normalizeHost((await docker.getDockerHost()).host));
105
+ }
106
+ return dockerReachesTarget;
107
+ };
79
108
  const uiBase = `http://${target}:${uiPort}`;
80
109
  const s3Base = `http://${target}:${s3Port}`;
81
110
 
@@ -98,6 +127,21 @@ module.exports = function registerCheckRelayerHealth(server, options = {}) {
98
127
  components.s3 = { healthy: false, status: null };
99
128
  }
100
129
 
130
+ // Until the owner claims the Relayer and signs in, it has no
131
+ // Muse token and keeps the S3 gateway (and HostIO) stopped,
132
+ // so S3 down on such a box is the expected state.
133
+ const awaitingClaim = components.ui.healthy === true
134
+ && components.s3.healthy !== true
135
+ && await tokenCheckApplies()
136
+ && await docker.hasMuseToken(RELAYER_CONTAINER) === false;
137
+ if (awaitingClaim) {
138
+ components.s3 = {
139
+ healthy: null,
140
+ status: components.s3.status,
141
+ note: 'Not started yet: the S3 gateway starts once the owner claims the Relayer (start_claim) and signs in to its web UI.',
142
+ };
143
+ }
144
+
101
145
  // HostIO — requires auth. Report null (unknown) not false (down).
102
146
  // TP-31: hostio = null before auth
103
147
  try {
@@ -131,18 +175,24 @@ module.exports = function registerCheckRelayerHealth(server, options = {}) {
131
175
  }),
132
176
  };
133
177
 
134
- // Healthy if UI and S3 are up. HostIO null (unknown) does NOT block.
135
- const coreHealthy = components.ui.healthy === true && components.s3.healthy === true;
136
- const allKnownHealthy = coreHealthy && components.hostio.healthy === true;
178
+ // Healthy if UI and S3 are up, or the UI is up and the Relayer
179
+ // awaits its claim. HostIO null (unknown) does NOT block.
180
+ const coreHealthy = components.ui.healthy === true
181
+ && (components.s3.healthy === true || awaitingClaim);
182
+ // A Relayer awaiting its claim is ready, not all healthy: S3 is not up yet.
183
+ const allKnownHealthy = components.ui.healthy === true
184
+ && components.s3.healthy === true
185
+ && components.hostio.healthy === true;
137
186
 
138
187
  const unhealthy = [];
139
188
  if (!components.ui.healthy) unhealthy.push(`UI (${target}:${uiPort})`);
140
- if (!components.s3.healthy) unhealthy.push(`S3 gateway (${target}:${s3Port})`);
189
+ if (components.s3.healthy !== true && !awaitingClaim) unhealthy.push(`S3 gateway (${target}:${s3Port})`);
141
190
 
142
191
  return {
143
192
  components,
144
193
  healthy: coreHealthy,
145
194
  all_healthy: allKnownHealthy,
195
+ awaiting_claim: awaitingClaim || undefined,
146
196
  // JSON.stringify drops undefined — degraded only appears when true.
147
197
  degraded: monitoringHealthy ? undefined : true,
148
198
  unhealthy: unhealthy.length > 0 ? unhealthy : undefined,
@@ -157,10 +207,16 @@ module.exports = function registerCheckRelayerHealth(server, options = {}) {
157
207
  ? ' DEGRADED: monitoring stack (Prometheus/Grafana) is not running — Monitoring dashboards will be empty.'
158
208
  : '');
159
209
 
210
+ const healthyMessage = (r) => (r.awaiting_claim
211
+ ? `The Relayer is installed and its web UI is up. Its S3 gateway and HostIO start once the owner claims it and signs in: if it is not claimed yet, proceed to start_claim; if the claim is done, have the owner sign in at ${uiBase}.`
212
+ : r.all_healthy
213
+ ? 'All Relayer services are healthy (UI, S3, HostIO).'
214
+ : 'Relayer core services (UI + S3) are healthy. HostIO status is pending authentication.') + degradedSuffix(r);
215
+
160
216
  if (!poll) {
161
217
  const result = await checkOnce();
162
218
  const message = result.healthy
163
- ? 'Relayer core services (UI + S3) are healthy.' + (result.all_healthy ? ' HostIO is also healthy.' : ' HostIO status is pending authentication.') + degradedSuffix(result)
219
+ ? healthyMessage(result)
164
220
  : `Relayer is not yet healthy. Unhealthy: ${result.unhealthy.join(', ')}.`;
165
221
 
166
222
  return {
@@ -198,9 +254,7 @@ module.exports = function registerCheckRelayerHealth(server, options = {}) {
198
254
  };
199
255
  }
200
256
 
201
- const message = (result.all_healthy
202
- ? 'All Relayer services are healthy (UI, S3, HostIO). Ready for claim.'
203
- : 'Relayer core services (UI + S3) are healthy. HostIO status pending authentication. Proceed to start_claim.') + degradedSuffix(result);
257
+ const message = healthyMessage(result);
204
258
 
205
259
  return {
206
260
  content: [{
@@ -43,7 +43,7 @@ module.exports = function registerConfigureVpd(server, options = {}) {
43
43
  server.registerTool(
44
44
  'configure_vpd',
45
45
  {
46
- title: 'configure_vpd',
46
+ title: 'Configure host selection (VPD)',
47
47
  description: 'Configure VPD (Virtual Private Datacenter) host selection for the Relayer, or preview it with dry_run. Use defaults ("true" for both expressions) or a CEL expression filtering hosts by tags. The Relayer requires a minimum of 10 data hosts and 20 parity hosts — if too few match, broaden the criteria. Requires OIDC sign-in (same session as get_host_tags).',
48
48
  inputSchema: {
49
49
  data_expression: z.string().describe('CEL expression for data host selection. Use "true" for default (all hosts).'),
@@ -11,7 +11,7 @@ const RELAYER_UI_BASE = 'http://localhost:8888';
11
11
  * Curated runtime catalog — the MCP exposes only the whitelist in
12
12
  * allowedSettings.js, never the full ~74-key advanced catalog (Ken,
13
13
  * 2026-06-11). Current values + defaults come from GET /api/v1/config
14
- * (relayer-ui Config.readConfig: { current, defaults, uploadTuning, ... }).
14
+ * (relayer-ui Config.readConfig: { current, defaults, ... }).
15
15
  */
16
16
  module.exports = function registerDescribeSettings(server, options = {}) {
17
17
  const http = options.httpClient || createHttpClient(options);
@@ -23,7 +23,7 @@ module.exports = function registerDescribeSettings(server, options = {}) {
23
23
  server.registerTool(
24
24
  'describe_settings',
25
25
  {
26
- title: 'describe_settings',
26
+ title: 'Describe settings',
27
27
  description: 'List the adjustable Relayer settings: worker/concurrency tuning, backup schedule, and cost center (CCID). Returns current value, default, type, and guidance per setting. Use before update_settings. Requires OIDC sign-in (same session as the other tools).',
28
28
  inputSchema: {
29
29
  /* no parameters — the whitelist is small by design */
@@ -90,10 +90,6 @@ module.exports = function registerDescribeSettings(server, options = {}) {
90
90
  text: JSON.stringify({
91
91
  success: true,
92
92
  settings,
93
- // uploadTuning: 'calculating' until a speedtest lands;
94
- // 'tuned' carries the resource-aware concurrency ceiling
95
- // that caps HOSTIO_SIMULTANEOUS_UPLOADS.
96
- uploadTuning: data.uploadTuning ?? null,
97
93
  message: 'These are the only settings adjustable through this MCP. Apply changes with update_settings; most need restart_service afterwards. Changing CostCenter changes who is billed — always confirm with the operator first.',
98
94
  }, null, 2),
99
95
  }],
@@ -32,7 +32,7 @@ module.exports = function registerGetHostTags(server, options = {}) {
32
32
  server.registerTool(
33
33
  'get_host_tags',
34
34
  {
35
- title: 'get_host_tags',
35
+ title: 'Get host tags',
36
36
  description: 'Get the available host tags for VPD (Virtual Private Datacenter) configuration, plus the currently applied VPD host selection. Translate tags into plain-language options for the operator — never show raw CEL expressions. Requires OIDC sign-in on first use (the user will be prompted to sign in via browser).',
37
37
  inputSchema: {
38
38
  /* no parameters */
@@ -1,22 +1,79 @@
1
1
  'use strict';
2
2
 
3
3
  const { z } = require('zod');
4
+ const os = require('os');
4
5
  const path = require('path');
5
6
  const net = require('net');
6
7
  const { createDockerUtil, redactEndpoint, classifyDockerFailure } = require('../lib/dockerUtil');
7
8
 
8
9
  const BIND_ADDRESS_HELP = 'bind_address must be empty (all interfaces), an IPv4 address (e.g. "127.0.0.1"), or a bracketed IPv6 address (e.g. "[::1]") — the Compose ports host component is an IP address, not a hostname';
9
10
 
10
- // A ports list item that uses ${BIND_ADDRESS...}; a comment naming it does not count.
11
- const PORTS_USE_BIND_ADDRESS = /^[ \t]*-[^#\n]*\$\{BIND_ADDRESS\b/m;
11
+ const USES_BIND_ADDRESS = /\$\{BIND_ADDRESS\b/;
12
+
13
+ /** A YAML line with its comment cut off ('#' starts no ${...} expansion). */
14
+ function stripComment(line) {
15
+ const at = line.search(/(^|\s)#/);
16
+ return at === -1 ? line : line.slice(0, at);
17
+ }
18
+
19
+ /**
20
+ * Whether every port a compose file publishes uses ${BIND_ADDRESS...} in the
21
+ * short syntax, so a bind_address narrows all of them. Reads each `ports:`
22
+ * block, block or flow form. A port without it, a long-syntax item (the .env
23
+ * value carries a trailing colon, which is no valid host_ip), or a file with no
24
+ * published port at all gives false: the caller stops before writing anything.
25
+ * Comments and other keys (environment) never count.
26
+ *
27
+ * @param {string} text - compose file text
28
+ * @returns {boolean}
29
+ */
30
+ function everyPortUsesBindAddress(text) {
31
+ const lines = text.split(/\r?\n/);
32
+ const items = [];
33
+ for (let i = 0; i < lines.length; i++) {
34
+ const key = /^([ \t]*)(?:-[ \t]+)?ports:(.*)$/.exec(stripComment(lines[i]));
35
+ if (!key) continue;
36
+ const keyIndent = key[1].length;
37
+ const rest = key[2].trim();
38
+ if (rest) {
39
+ // Flow form: ports: ["a", "b"]. Anything else is unreadable here.
40
+ const flow = /^\[(.*)\]$/.exec(rest);
41
+ if (!flow) return false;
42
+ items.push(...flow[1].split(',').map((item) => item.trim()).filter(Boolean));
43
+ continue;
44
+ }
45
+ let itemIndent = null;
46
+ let current = null;
47
+ for (let j = i + 1; j < lines.length; j++) {
48
+ const line = stripComment(lines[j]);
49
+ if (!line.trim()) continue;
50
+ const indent = /^[ \t]*/.exec(line)[0].length;
51
+ const dash = /^[ \t]*-(\s|$)/.test(line);
52
+ if (itemIndent === null) {
53
+ if (!dash || indent < keyIndent) break;
54
+ itemIndent = indent;
55
+ }
56
+ if (indent < itemIndent || (indent === itemIndent && !dash)) break;
57
+ if (indent === itemIndent) {
58
+ current = { text: line };
59
+ items.push(current);
60
+ } else {
61
+ current.text += `\n${line}`;
62
+ }
63
+ i = j;
64
+ }
65
+ }
66
+ const LONG_SYNTAX = /^[ \t]*-[ \t]+[A-Za-z_]+:(\s|$)/;
67
+ return items.length > 0 && items.every((item) => {
68
+ const text = typeof item === 'string' ? item : item.text;
69
+ return USES_BIND_ADDRESS.test(text) && (typeof item === 'string' || !LONG_SYNTAX.test(text));
70
+ });
71
+ }
12
72
 
13
73
  /** What the response says about bind_address, per compose source. */
14
74
  function bindAddressApplied(source, bindAddress) {
15
- if (source === 'bundled-fallback') {
16
- return 'yes — the bundled fallback compose references BIND_ADDRESS in its port declarations';
17
- }
18
75
  if (source === 'channel' && bindAddress) {
19
- return 'yes — the channel compose references BIND_ADDRESS in its port declarations (checked before install)';
76
+ return 'yes — the channel compose uses BIND_ADDRESS on every published port (checked before install)';
20
77
  }
21
78
  if (source === 'channel') {
22
79
  return 'not needed — no bind_address was set, so ports are published on all interfaces';
@@ -52,16 +109,13 @@ function isValidBindAddress(value) {
52
109
  // monitoring stack), published on the XNS releases registry and served
53
110
  // login-free. THE default install source. Its .env (COMPOSE_PROFILES and the
54
111
  // rest of the release settings) sits beside it and is fetched on every run.
55
- const CHANNEL_COMPOSE_URL = 'https://releases.scpri.me/relayer/release/docker-compose.yml';
112
+ const CHANNEL_COMPOSE_URL = 'https://releases.xns.tech/relayer/release/docker-compose.yml';
56
113
  const CHANNEL_ENV_FILE = '.env';
57
114
 
58
- // Bundled OFFLINE FALLBACK template (ships in the npm package; package.json
59
- // `files: ["src/"]` covers it). Written only when the channel compose or .env
60
- // fetch fails;
61
- // kept service-parity with the channel bundle by the jest contract tests.
62
- const TEMPLATE_PATH = path.join(__dirname, '..', 'templates', 'docker-compose.yml');
115
+ // Where a release .env that stops short is reported.
116
+ const BUGS_URL = require('../../package.json').bugs.url;
63
117
 
64
- // container_name in the bundled compose. Docker container names are unique
118
+ // container_name in the release compose. Docker container names are unique
65
119
  // per daemon, so ANY existing container with this name — running or stopped,
66
120
  // any channel — makes `docker compose up` fail with a name conflict.
67
121
  const CONTAINER_NAME = 'xns-relayer';
@@ -107,6 +161,25 @@ function safeError(message, cause) {
107
161
  return Object.assign(new Error(message, { cause }), { userSafe: true });
108
162
  }
109
163
 
164
+ // The four reasons a default install stops before it touches the install
165
+ // folder. Each names the cause and what to do; curl and OS text go to the
166
+ // server log only.
167
+ function downloadFailedMessage(host, file) {
168
+ return `The Relayer release files could not be downloaded from ${host} (the ${file} download failed), so nothing was installed. Check that this machine reaches https://${host}, then run install_relayer again.`;
169
+ }
170
+
171
+ function incompleteEnvMessage(host) {
172
+ return `The release .env downloaded from ${host} has no COMPOSE_PROFILES line, so the download was cut short or the published release is incomplete, and nothing was installed. Run install_relayer again; if it stops here again, report it at ${BUGS_URL}.`;
173
+ }
174
+
175
+ function bindUnsupportedMessage(bindAddress) {
176
+ return `bind_address ${bindAddress} was requested, but the release compose file does not use BIND_ADDRESS on every published port, so the ports would be published on all interfaces. Nothing was installed. Run install_relayer again without bind_address, or pass compose_url pointing at a compose file whose ports use \${BIND_ADDRESS}.`;
177
+ }
178
+
179
+ function tempFolderMessage(tmpDir) {
180
+ return `The release files could not be prepared on this machine: the temporary folder under ${tmpDir} could not be created or read. Nothing was installed. Check that the folder is writable and the disk is not full, then run install_relayer again.`;
181
+ }
182
+
110
183
  const DOCKER_GROUP_SENTENCE = 'The Docker socket refused this user, so nothing was written and nothing was started. Add the user to the docker group (sudo usermod -aG docker $USER), then log out and back in (or reboot) and run install_relayer again.';
111
184
 
112
185
  // Fixed sentences per classified Docker failure (dockerUtil FAILURE_PATTERNS).
@@ -116,7 +189,7 @@ const FAILURE_SENTENCES = {
116
189
  permission_denied: DOCKER_GROUP_SENTENCE,
117
190
  daemon_stopped: 'Docker is not running on this machine. Start it with sudo systemctl start docker, then run install_relayer again.',
118
191
  out_of_disk: 'Docker ran out of disk space while pulling the Relayer images. Free disk space on the filesystem holding the Docker root (docker info --format {{.DockerRootDir}} shows where it is), then run install_relayer again.',
119
- pull_refused: 'The Relayer images could not be pulled from releases.scpri.me. Check that this machine reaches https://releases.scpri.me and that no stale registry login is stored (docker logout releases.scpri.me), then run install_relayer again.',
192
+ pull_refused: 'The Relayer images could not be pulled from releases.xns.tech. Check that this machine reaches https://releases.xns.tech and that no stale registry login is stored (docker logout releases.xns.tech), then run install_relayer again.',
120
193
  };
121
194
 
122
195
  // The release compose also publishes the S3 HTTPS port. No install_relayer
@@ -184,12 +257,13 @@ function withPortLines(fetchedEnv, portLines) {
184
257
  *
185
258
  * A first-time user has never heard of a Relayer and cannot supply a compose
186
259
  * file or a .env. So by default this tool authors both for them: it fetches
187
- * the CANONICAL release channel bundle (relayer + Prometheus + Grafana +
188
- * node-exporter — the monitoring stack powers the dashboards under Monitoring
189
- * in the web UI) and its .env, then appends the two ports and the bind address
190
- * to that .env. If either fetch fails (offline, registry hiccup), the bundled
191
- * service-parity template and a .env of just those lines are the fallback —
192
- * the install still completes and the response says it fell back.
260
+ * the CANONICAL release channel bundle (relayer, the Prometheus + Grafana +
261
+ * node-exporter monitoring stack that powers the dashboards under Monitoring in
262
+ * the web UI, Alertmanager, and the Loki + Alloy + audit-logrotate audit-log
263
+ * pipeline) and its .env, then appends the two ports and the bind address to
264
+ * that .env. Both files are downloaded into a temporary folder and checked
265
+ * there first. If either cannot be downloaded or used, the tool stops with the
266
+ * cause and the fix, and the install folder is left exactly as it was.
193
267
  *
194
268
  * `compose_url` stays as an optional override for internal/custom installs;
195
269
  * when given, the old download-a-URL behavior is preserved.
@@ -205,8 +279,8 @@ module.exports = function registerInstallRelayer(server, options = {}) {
205
279
  server.registerTool(
206
280
  'install_relayer',
207
281
  {
208
- title: 'install_relayer',
209
- description: 'Install and start the XNS Relayer. By default fetches the canonical release channel bundle — relayer + the Prometheus/Grafana monitoring stack — and its .env from releases.scpri.me (anonymous pull), appends the ports to that .env, then runs docker compose up -d — the user does NOT need to author any file. Falls back to a bundled copy of the bundle if either fetch fails. A failure names its cause (port in use, image pull refused, Docker stopped, out of disk, Docker socket permission) and the command that fixes it. Pass compose_url only to override with a custom compose.\n\nIMPORTANT — two machines: this tool writes docker-compose.yml and .env on the machine running the MCP, then starts the containers on whichever machine the Docker daemon is on. When DOCKER_HOST or an ssh:// Docker context points at a daemon on another machine, the tool refuses: it writes nothing and starts nothing, and returns an error naming the Docker host. Run the MCP on the Docker host (Node.js 20 there) and install from there.\n\nExposure decisions on this surface:\n\n1. BINDING — bind_address controls which host network interface Docker publishes ports on. Default: empty (all interfaces — the dashboard answers from any machine on the LAN with zero configuration). Set to "127.0.0.1" for loopback-only, or a specific interface IP. The value is passed to docker compose via env as BIND_ADDRESS; it takes effect only if the compose file used for the install references BIND_ADDRESS in its port declarations. When bind_address is set and the channel compose does not reference BIND_ADDRESS, the tool installs the bundled compose instead (source bundled-fallback, with a reason), because the bundled one honors it. A compose_url override is fetched remotely and may not honor it. The prerequisite check (check_prerequisites) probes port availability by binding 0.0.0.0 regardless of this setting.\n\n2. UI TLS — ui_tls_enabled describes whether the admin UI listens on HTTPS in addition to HTTP. Default: false (off). This switch is described here for decision visibility; it is NOT wired to behavior in this version — setting it to true is accepted but has no effect until a future release ships the listener. Cost when enabled: requires a TLS certificate and key provisioned on the host.\n\n3. S3 TLS — s3_tls_enabled describes whether the S3 gateway listens on HTTPS in addition to HTTP. Default: false (off). This switch is described here for decision visibility; it is NOT wired to behavior in this version — setting it to true is accepted but has no effect until a future release ships the listener. Cost when enabled: requires a TLS certificate and key provisioned on the host; S3 clients must be configured to use the HTTPS endpoint.',
282
+ title: 'Install the Relayer',
283
+ description: 'Install and start the XNS Relayer. By default fetches the canonical release channel bundle — relayer + the Prometheus/Grafana monitoring stack — and its .env from releases.xns.tech (anonymous pull), appends the ports to that .env, then runs docker compose up -d — the user does NOT need to author any file. 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 command that fixes it. Pass compose_url only to override with a custom compose.\n\nIMPORTANT — two machines: this tool writes docker-compose.yml and .env on the machine running the MCP, then starts the containers on whichever machine the Docker daemon is on. When DOCKER_HOST or an ssh:// Docker context points at a daemon on another machine, the tool refuses: it writes nothing and starts nothing, and returns an error naming the Docker host. Run the MCP on the Docker host (Node.js 24 there) and install from there.\n\nExposure decisions on this surface:\n\n1. BINDING — bind_address controls which host network interface Docker publishes ports on. Default: empty (all interfaces — the dashboard answers from any machine on the LAN with zero configuration). Set to "127.0.0.1" for loopback-only, or a specific interface IP. The value is passed to docker compose via env as BIND_ADDRESS; it takes effect only if the compose file used for the install references BIND_ADDRESS in its port declarations. When bind_address is set and the release compose does not use BIND_ADDRESS on every published port, the tool stops before installing anything and says so. A compose_url override is fetched remotely and may not honor it. The prerequisite check (check_prerequisites) probes port availability by binding 0.0.0.0 regardless of this setting.\n\n2. UI TLS — ui_tls_enabled describes whether the admin UI listens on HTTPS in addition to HTTP. Default: false (off). This switch is described here for decision visibility; it is NOT wired to behavior in this version — setting it to true is accepted but has no effect until a future release ships the listener. Cost when enabled: requires a TLS certificate and key provisioned on the host.\n\n3. S3 TLS — s3_tls_enabled describes whether the S3 gateway listens on HTTPS in addition to HTTP. Default: false (off). This switch is described here for decision visibility; it is NOT wired to behavior in this version — setting it to true is accepted but has no effect until a future release ships the listener. Cost when enabled: requires a TLS certificate and key provisioned on the host; S3 clients must be configured to use the HTTPS endpoint.',
210
284
  inputSchema: {
211
285
  install_path: z.string().optional().default('/opt/xns-relayer').describe('Directory to install the compose file into'),
212
286
  ui_port: z.number().int().min(1).max(65535).optional().default(8888).describe('Host port for the Relayer admin/customer UI (container 8888). Docker publishes this port on the interface chosen by bind_address.'),
@@ -214,7 +288,7 @@ module.exports = function registerInstallRelayer(server, options = {}) {
214
288
  compose_url: z.string().url().optional().describe('OPTIONAL override: URL to a custom docker-compose.yml. Omit for the normal released install. When provided, bind_address is passed to docker compose via env but the downloaded compose must use the BIND_ADDRESS variable in its port declarations for it to take effect.'),
215
289
  // R5 input boundary — see isValidBindAddress above for why each
216
290
  // documented address form is validated whole rather than by charset.
217
- bind_address: z.string().max(255).refine(isValidBindAddress, BIND_ADDRESS_HELP).optional().default('').describe('Host network interface for Docker port publication. Default: empty string (all interfaces — reachable from any machine on the LAN). Set to "127.0.0.1" for loopback-only access, or a specific interface IP to restrict reachability. Accepted forms: empty, an IPv4 address, or a bracketed IPv6 address (e.g. "[::1]"). Hostnames are rejected — the Compose ports host component is an IP address. This value is passed to docker compose via env, and on the channel and bundled-fallback paths it is also written into the .env this installer authors (the compose_url override path writes no .env). It is honored in the bundled fallback compose (which uses BIND_ADDRESS in its port declarations). On the default path the installer checks the fetched channel compose for BIND_ADDRESS and uses the bundled fallback compose when it is absent. On the compose_url path the fetched compose must reference the BIND_ADDRESS variable in its port declarations for the setting to take effect — this installer cannot verify that.'),
291
+ bind_address: z.string().max(255).refine(isValidBindAddress, BIND_ADDRESS_HELP).optional().default('').describe('Host network interface for Docker port publication. Default: empty string (all interfaces — reachable from any machine on the LAN). Set to "127.0.0.1" for loopback-only access, or a specific interface IP to restrict reachability. Accepted forms: empty, an IPv4 address, or a bracketed IPv6 address (e.g. "[::1]"). Hostnames are rejected — the Compose ports host component is an IP address. This value is passed to docker compose via env, and on the default path it is also written into the .env this installer authors (the compose_url override path writes no .env). On the default path the installer checks the fetched channel compose for BIND_ADDRESS and stops, installing nothing, when it is absent. On the compose_url path the fetched compose must reference the BIND_ADDRESS variable in its port declarations for the setting to take effect — this installer cannot verify that.'),
218
292
  ui_tls_enabled: z.boolean().optional().default(false).describe('Whether the admin UI should listen on HTTPS in addition to HTTP. Default: false (off — HTTP only). NOT WIRED in this version: accepted but has no effect until a future release ships the TLS listener. Cost when enabled: requires a TLS certificate and key provisioned on the host.'),
219
293
  s3_tls_enabled: z.boolean().optional().default(false).describe('Whether the S3 gateway should listen on HTTPS in addition to HTTP. Default: false (off — HTTP only). NOT WIRED in this version: accepted but has no effect until a future release ships the TLS listener. Cost when enabled: requires a TLS certificate and key provisioned on the host; S3 clients must be configured to use the HTTPS endpoint.'),
220
294
  },
@@ -243,7 +317,7 @@ module.exports = function registerInstallRelayer(server, options = {}) {
243
317
  error: `The Docker daemon is on ${dockerHost.host}, not this machine. install_relayer would write docker-compose.yml and .env on this machine instead of on ${dockerHost.host}, so nothing was written and nothing was started.`,
244
318
  docker_host: dockerHost.host,
245
319
  docker_endpoint: redactEndpoint(dockerHost.endpoint),
246
- remediation: `Run the MCP on ${dockerHost.host} (install Node.js 20 there and point your MCP client at it), then run install_relayer again. Or, to install on this machine, unset DOCKER_HOST or switch to the default Docker context.`,
320
+ remediation: `Run the MCP on ${dockerHost.host} (install Node.js 24 there and point your MCP client at it), then run install_relayer again. Or, to install on this machine, unset DOCKER_HOST or switch to the default Docker context.`,
247
321
  }, null, 2),
248
322
  }],
249
323
  isError: true,
@@ -277,79 +351,106 @@ module.exports = function registerInstallRelayer(server, options = {}) {
277
351
  };
278
352
  }
279
353
 
280
- // Create install directory (execFile, no shell)
281
- await new Promise((resolve, reject) => {
354
+ const mkdirInstallPath = () => new Promise((resolve, reject) => {
282
355
  execFileFn('mkdir', ['-p', install_path], {}, (err) => {
283
356
  if (err) return reject(safeError(`Failed to create directory ${install_path} — check that the path is writable on this machine and no file sits at or along it`, err));
284
357
  resolve();
285
358
  });
286
359
  });
287
360
 
288
- const download = (url, outPath, what) => new Promise((resolve, reject) => {
361
+ // curl -fsSL -o <outPath> <url> (execFile, no shell). Rejects
362
+ // with curl's own error; each caller chooses the message.
363
+ const curlTo = (url, outPath) => new Promise((resolve, reject) => {
289
364
  execFileFn('curl', ['-fsSL', '-o', outPath, url], { timeout: 60000 }, (err) => {
290
- if (err) return reject(safeError(`Failed to download ${what}`, err));
365
+ if (err) return reject(err);
291
366
  resolve();
292
367
  });
293
368
  });
294
- const fetchCompose = (url) => download(url, composePath, 'compose file');
369
+
370
+ // Download the release compose and .env into an owner-only
371
+ // temporary folder, read them and run the two checks. The folder
372
+ // is removed whatever happens; a failed removal is logged and
373
+ // never replaces the result.
374
+ const stageReleaseFiles = async (bindAddress) => {
375
+ const host = new URL(channelComposeUrl).host;
376
+ const tmpDir = os.tmpdir();
377
+ const readStaged = (file) => fsp.readFile(file, 'utf8').catch((err) => {
378
+ throw safeError(tempFolderMessage(tmpDir), err);
379
+ });
380
+ let stage;
381
+ try {
382
+ stage = await fsp.mkdtemp(path.join(tmpDir, 'xns-relayer-install-'));
383
+ } catch (err) {
384
+ throw safeError(tempFolderMessage(tmpDir), err);
385
+ }
386
+ try {
387
+ const stagedCompose = path.join(stage, 'docker-compose.yml');
388
+ await curlTo(channelComposeUrl, stagedCompose).catch((err) => {
389
+ throw safeError(downloadFailedMessage(host, 'docker-compose.yml'), err);
390
+ });
391
+ const composeText = await readStaged(stagedCompose);
392
+ // A bind_address the release compose ignores would publish
393
+ // the ports on every interface.
394
+ if (bindAddress && !everyPortUsesBindAddress(composeText)) {
395
+ throw safeError(bindUnsupportedMessage(bindAddress));
396
+ }
397
+ const stagedEnv = path.join(stage, CHANNEL_ENV_FILE);
398
+ await curlTo(channelEnvUrl, stagedEnv).catch((err) => {
399
+ throw safeError(downloadFailedMessage(host, CHANNEL_ENV_FILE), err);
400
+ });
401
+ const fetchedEnv = await readStaged(stagedEnv);
402
+ // The publisher always ships this line, so its absence means a
403
+ // truncated or empty download. Without it no audit sidecar starts.
404
+ if (!/^COMPOSE_PROFILES=/m.test(fetchedEnv)) {
405
+ throw safeError(incompleteEnvMessage(host));
406
+ }
407
+ return { composeText, fetchedEnv };
408
+ } finally {
409
+ try {
410
+ await fsp.rm(stage, { recursive: true, force: true });
411
+ } catch (rmErr) {
412
+ console.error(`[install_relayer] could not remove ${stage}: ${rmErr.message}`);
413
+ }
414
+ }
415
+ };
295
416
 
296
417
  const bindPrefix = bind_address ? `${bind_address}:` : '';
297
- let envContents = null;
298
418
  let source;
299
- let note;
300
- let reason;
301
419
  if (compose_url) {
302
- // Override path: download a custom compose (execFile, no shell).
303
- await fetchCompose(compose_url);
420
+ // Override path: make the folder, then download a custom
421
+ // compose straight into it.
422
+ await mkdirInstallPath();
423
+ await curlTo(compose_url, composePath).catch((err) => {
424
+ throw safeError('Failed to download compose file', err);
425
+ });
304
426
  source = 'compose_url';
305
427
  } else {
306
- // Default path: fetch the canonical release bundle (relayer +
307
- // monitoring stack) and its .env fresh on every run, then
308
- // append the port lines to the fetched .env. Fall back to the
309
- // bundled service-parity template and a .env of just the port
310
- // lines when either fetch (or reading the fetched .env) fails.
311
- // Either way the user never writes a file.
428
+ // Default path: download the release compose and its .env
429
+ // into a temporary folder and check them there. Only when
430
+ // every check passes is the install folder made and written,
431
+ // so a stop leaves it exactly as it was.
312
432
  const portLines = `UI_PORT=${ui_port}\nS3_PORT=${s3_port}\nBIND_ADDRESS=${bindPrefix}\n`;
313
- try {
314
- await fetchCompose(channelComposeUrl);
315
- // DECISION: the release compose has no BIND_ADDRESS in its
316
- // ports, so a bind_address would be silently ignored and the
317
- // ports published on all interfaces. Use the bundled compose,
318
- // which honors it, and say so.
319
- if (bind_address && !PORTS_USE_BIND_ADDRESS.test(await fsp.readFile(composePath, 'utf8'))) {
320
- throw Object.assign(new Error('channel compose does not reference BIND_ADDRESS'), { bindUnsupported: true });
321
- }
322
- await download(channelEnvUrl, envPath, 'release .env');
323
- // curl creates the file with the default umask; close it before
324
- // any later step can throw and leave it world-readable.
325
- await fsp.chmod(envPath, ENV_FILE_MODE);
326
- envContents = withPortLines(await fsp.readFile(envPath, 'utf8'), portLines);
327
- source = 'channel';
328
- } catch (fetchErr) {
329
- const template = await fsp.readFile(TEMPLATE_PATH, 'utf8');
330
- await fsp.writeFile(composePath, template);
331
- envContents = portLines;
332
- source = 'bundled-fallback';
333
- console.error(`[install_relayer] channel bundle fetch failed: ${fetchErr.message}${fetchErr.cause ? `: ${fetchErr.cause.message}` : ''}`);
334
- if (fetchErr.bindUnsupported) {
335
- reason = 'The release channel compose does not support bind_address, so the bundled compose, which does, was used. Same services.';
336
- } else {
337
- reason = 'Channel bundle fetch failed.';
338
- note = 'Channel bundle fetch failed — fell back to the bundled compose. Same services; re-running install later is not required.';
339
- }
340
- }
433
+ const { composeText, fetchedEnv } = await stageReleaseFiles(bind_address);
434
+ await mkdirInstallPath();
435
+ await fsp.writeFile(composePath, composeText);
341
436
  // The .env holds webhook/SMTP secrets: owner-only. The mode on
342
- // writeFile covers a new file; chmod covers the one curl made.
343
- await fsp.writeFile(envPath, envContents, { mode: ENV_FILE_MODE });
437
+ // writeFile covers a new file; chmod covers one that existed.
438
+ await fsp.writeFile(envPath, withPortLines(fetchedEnv, portLines), { mode: ENV_FILE_MODE });
344
439
  await fsp.chmod(envPath, ENV_FILE_MODE);
440
+ source = 'channel';
345
441
  }
346
442
 
347
443
  // Run docker compose up -d. cwd + env so ${UI_PORT}/${S3_PORT}
348
444
  // interpolation and the ./data bind resolve in the install dir,
349
445
  // regardless of where the MCP process was launched.
446
+ // The .env written above owns COMPOSE_PROFILES, aliased to RELAYER_AUDIT_MODE.
447
+ // Compose lets the process environment beat .env, so an inherited value
448
+ // would leave the audit sink on with no sidecars to tail and rotate it.
449
+ // compose_url writes no .env, so there the caller's value stands.
450
+ const { COMPOSE_PROFILES: _inheritedProfiles, ...withoutProfiles } = process.env;
350
451
  await docker.composeUp(composePath, {
351
452
  cwd: install_path,
352
- env: { ...process.env, UI_PORT: String(ui_port), S3_PORT: String(s3_port), BIND_ADDRESS: bindPrefix },
453
+ env: { ...(compose_url ? process.env : withoutProfiles), UI_PORT: String(ui_port), S3_PORT: String(s3_port), BIND_ADDRESS: bindPrefix },
353
454
  });
354
455
 
355
456
  return {
@@ -361,7 +462,6 @@ module.exports = function registerInstallRelayer(server, options = {}) {
361
462
  compose_path: composePath,
362
463
  install_path,
363
464
  source,
364
- ...(reason ? { reason } : {}),
365
465
  // D5/W5: state the binding at install time, out-of-band, so a
366
466
  // refused connection is explainable later. Two statements, never
367
467
  // merged (PRD §7): `composed_from` is what this installer asserts
@@ -388,7 +488,6 @@ module.exports = function registerInstallRelayer(server, options = {}) {
388
488
  ui_tls_enabled: { requested: ui_tls_enabled, effective: false, note: ui_tls_enabled ? 'Accepted but not wired in this version — no effect until a future release ships the TLS listener.' : 'Off (HTTP only).' },
389
489
  s3_tls_enabled: { requested: s3_tls_enabled, effective: false, note: s3_tls_enabled ? 'Accepted but not wired in this version — no effect until a future release ships the TLS listener.' : 'Off (HTTP only).' },
390
490
  },
391
- ...(note ? { note } : {}),
392
491
  }, null, 2),
393
492
  }],
394
493
  };
@@ -31,7 +31,7 @@ module.exports = function registerManageBackups(server, options = {}) {
31
31
  server.registerTool(
32
32
  'manage_backups',
33
33
  {
34
- title: 'manage_backups',
34
+ title: 'Manage backups',
35
35
  description: 'Manage Relayer configuration backups: list archives, start a backup, restore from an archive, or delete one. Restore OVERWRITES current state and restarts services — always confirm with the operator and state which archive and components first. Backups must be enabled (BACKUP_ENABLED) for list/start.',
36
36
  inputSchema: {
37
37
  action: z.enum(['list', 'start', 'restore', 'delete'])
@@ -26,7 +26,7 @@ module.exports = function registerRestartService(server, options = {}) {
26
26
  server.registerTool(
27
27
  'restart_service',
28
28
  {
29
- title: 'restart_service',
29
+ title: 'Restart service',
30
30
  description: 'Restart a Relayer service (hostio, gateway, s3gateway, database) or all services. Disruptive: in-flight S3 requests will fail during the restart — confirm with the operator before calling. Verify recovery afterwards with check_relayer_health.',
31
31
  inputSchema: {
32
32
  service: z.enum(SERVICES).optional()
@@ -25,7 +25,7 @@ module.exports = function registerSetupCliCredentials(server, options = {}) {
25
25
  server.registerTool(
26
26
  'setup_cli_credentials',
27
27
  {
28
- title: 'setup_cli_credentials',
28
+ title: 'Set up CLI credentials',
29
29
  description: 'Provision S3 IAM credentials for the XNS CLI. Creates an IAM user in the Relayer and writes ~/.xns/credentials so that `xns ls` and other S3 verbs work without further configuration. Call once after check_claim_status reaches STATE_3.',
30
30
  inputSchema: {
31
31
  muse_token: z.string().describe('Keycloak/Muse token — the same token used for get_host_tags and configure_vpd'),
@@ -21,7 +21,7 @@ module.exports = function registerStartClaim(server, options = {}) {
21
21
  server.registerTool(
22
22
  'start_claim',
23
23
  {
24
- title: 'start_claim',
24
+ title: 'Start claim',
25
25
  description: 'Start a claim session to link this Relayer installation to an XNS account. Returns a claim URL that the user must open in a browser to complete the claim. The claim has an expiration time. After calling this, use check_claim_status to monitor claim progress.',
26
26
  inputSchema: {
27
27
  /* no parameters */
@@ -28,7 +28,7 @@ module.exports = function registerStartRegistration(server, options = {}) {
28
28
  server.registerTool(
29
29
  'start_registration',
30
30
  {
31
- title: 'start_registration',
31
+ title: 'Start registration',
32
32
  description: 'Get the browser registration URL for creating a new XNS account. The user opens this URL in a browser to sign up via Keycloak — the agent never touches credentials. After signing up, use check_email_verified to poll for email verification.',
33
33
  inputSchema: {},
34
34
  annotations: {
@@ -33,7 +33,7 @@ module.exports = function registerUpdateSettings(server, options = {}) {
33
33
  server.registerTool(
34
34
  'update_settings',
35
35
  {
36
- title: 'update_settings',
36
+ title: 'Update settings',
37
37
  description: 'Update adjustable Relayer settings (see describe_settings for the allowed set). Pass a map of setting name to new value, e.g. {"HOSTIO_UPLOAD_WORKERS": 20}. Returns require_restart — if true, follow up with restart_service after confirming with the operator. Changing CostCenter re-bills to a different cost center; always confirm first.',
38
38
  inputSchema: {
39
39
  settings: z.record(z.union([z.string(), z.number(), z.boolean()]))
@@ -44,7 +44,7 @@ module.exports = function registerVerifyStorage(server, options = {}) {
44
44
  server.registerTool(
45
45
  'verify_storage',
46
46
  {
47
- title: 'verify_storage',
47
+ title: 'Verify storage',
48
48
  description: 'Verify the S3-compatible storage gateway is working by performing a round-trip test: create a test bucket, upload a small object, download it, and compare. Provisions a temporary scoped IAM credential automatically using your OIDC session — no manual key management needed. The throwaway credential and test data are removed after the test, pass or fail. By default targets port 9000 on the machine the Docker daemon runs on (auto-detected from the Docker context); pass endpoint to override.',
49
49
  inputSchema: {
50
50
  muse_token: z.string().trim().min(1).optional().describe('Optional Keycloak/Muse token override. Usually omitted — without it (and without access keys) the tool reuses the sign-in session from get_host_tags/configure_vpd, or starts a browser sign-in if there is none.'),
@@ -1,85 +0,0 @@
1
- # Bundled by @xns-cloud/relayer-mcp — OFFLINE FALLBACK for the released install.
2
- # Source of truth: the release channel bundle on the XNS releases registry —
3
- # https://releases.scpri.me/relayer/release/docker-compose.yml and the .env
4
- # beside it; the release publisher ships both. install_relayer fetches those URLs by
5
- # default and only writes this copy when either fetch fails, so this file MUST
6
- # keep service parity with the channel bundle: relayer + the monitoring stack
7
- # (Prometheus + Grafana + node-exporter) that powers the dashboards under
8
- # Monitoring in the web UI. The jest contract tests enforce the parity.
9
- #
10
- # Every Relayer image comes from releases.scpri.me — never a Docker Hub fleet
11
- # tag, which is not a release channel. The one allowed upstream image is
12
- # prom/node-exporter (public, multi-arch, version-pinned — matches the channel
13
- # bundle; nothing to rebuild). No service mounts the host's Docker socket.
14
- #
15
- # Pinned to the release-latest tag, the channel standalone Relayer customers install.
16
- #
17
- # A first-time user never hand-writes this file or the .env — install_relayer
18
- # writes both.
19
- #
20
- # STORAGE STRATEGY — MUST match the channel bundle (named volume relayer_data).
21
- # This file is written only when the channel fetch fails; if the two used
22
- # DIFFERENT volume strategies, an online-vs-offline install would silently switch
23
- # the mount target and the user's buckets would appear to vanish (data orphaned
24
- # in the unmounted volume). That was tacom beta bug #2 (2026-06-09): this file
25
- # used a bind mount `./data` while the channel used `relayer_data`. Both now use
26
- # the named volume. The storage-strategy parity test in installRelayer.test.js
27
- # enforces it — do NOT reintroduce a bind mount here.
28
- #
29
- # Other differences from the channel compose, by design:
30
- # - SMB ports 139/445 are intentionally NOT exposed: 445 is held by Windows
31
- # SMB on consumer hosts and would fail the install. S3 onboarding uses :9000.
32
- # - pull_policy: always so `docker compose up -d` fetches the current release
33
- # images without a separate `docker compose pull` step.
34
- services:
35
- xns:
36
- # container_name is load-bearing: the baked-in prometheus.yml scrapes the
37
- # relayer by this name, and the install preflight keys on it.
38
- container_name: xns-relayer
39
- image: releases.scpri.me/xns-relayer:release-latest
40
- pull_policy: always
41
- restart: unless-stopped
42
- privileged: true # samba / fuse / disk management (matches channel compose)
43
- volumes:
44
- - relayer_data:/relayer # named volume — MUST match the channel bundle (bug #2)
45
- ports:
46
- - ${BIND_ADDRESS:-}${UI_PORT:-8888}:8888
47
- - ${BIND_ADDRESS:-}${S3_PORT:-9000}:9000
48
- env_file:
49
- - .env
50
-
51
- # Monitoring stack — powers the dashboards under Monitoring in the web UI.
52
- # Not host-exposed: Grafana is reached only through the relayer's /grafana
53
- # reverse proxy and the in-network Prometheus scrape.
54
- prometheus:
55
- image: releases.scpri.me/relayer-prometheus:release-latest
56
- pull_policy: always
57
- restart: unless-stopped
58
- volumes:
59
- - prometheus_data:/prometheus
60
-
61
- grafana:
62
- image: releases.scpri.me/relayer-grafana:release-latest
63
- pull_policy: always
64
- restart: unless-stopped
65
- environment:
66
- - GF_AUTH_ANONYMOUS_ENABLED=true
67
- - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
68
- - GF_SERVER_SERVE_FROM_SUB_PATH=true
69
- - GF_SERVER_ROOT_URL=%(protocol)s://%(domain)s/grafana
70
- - GF_SECURITY_ALLOW_EMBEDDING=true
71
- volumes:
72
- - grafana_data:/var/lib/grafana
73
-
74
- node-exporter:
75
- image: prom/node-exporter:v1.11.1
76
- restart: unless-stopped
77
- command:
78
- - --path.rootfs=/host
79
- volumes:
80
- - /:/host:ro # read-only host metrics for the Node Health page
81
-
82
- volumes:
83
- relayer_data:
84
- prometheus_data:
85
- grafana_data: