@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
|
@@ -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: '
|
|
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: '
|
|
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.
|
|
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';
|
|
@@ -27,6 +27,13 @@ const DEFAULT_INSTALL_DIR = '/opt/xns-relayer';
|
|
|
27
27
|
const MIN_FREE_BYTES = 10 * 10 ** 9;
|
|
28
28
|
const BYTES_PER_GB = 10 ** 9;
|
|
29
29
|
|
|
30
|
+
// Makes / shared in the mount namespace the Docker daemon runs in. The release
|
|
31
|
+
// compose mounts /mnt and / with rslave propagation, which needs a shared or
|
|
32
|
+
// slave root. The daemon runs in systemd's namespace, so a plain
|
|
33
|
+
// `mount --make-rshared /` in the user's shell is not enough.
|
|
34
|
+
// The PID is the daemon the check read, so the fix targets the same process.
|
|
35
|
+
const makeRootSharedCommand = (pid) => `sudo nsenter -t ${pid} -m mount --make-rshared /`;
|
|
36
|
+
|
|
30
37
|
const GROUP_NOTE = 'the Docker socket refuses this user until the docker group applies (see docker_group)';
|
|
31
38
|
|
|
32
39
|
/**
|
|
@@ -99,6 +106,31 @@ async function isInDockerGroup(readFile, username) {
|
|
|
99
106
|
}
|
|
100
107
|
}
|
|
101
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Propagation state of the "/" mount in a mountinfo file: 'shared', 'slave'
|
|
111
|
+
* (a master: tag) or 'private'; null when no "/" entry is found. When "/" is
|
|
112
|
+
* mounted over more than once, the top mount is the "/" entry that no other
|
|
113
|
+
* "/" entry names as its parent; line order says nothing about stacking.
|
|
114
|
+
*/
|
|
115
|
+
function rootPropagation(mountinfo) {
|
|
116
|
+
const roots = [];
|
|
117
|
+
for (const line of String(mountinfo).split('\n')) {
|
|
118
|
+
const fields = line.trim().split(' ');
|
|
119
|
+
if (fields.length < 7 || fields[4] !== '/') continue;
|
|
120
|
+
const separator = fields.indexOf('-');
|
|
121
|
+
const optional = separator === -1 ? fields.slice(6) : fields.slice(6, separator);
|
|
122
|
+
let state = 'private';
|
|
123
|
+
if (optional.some((f) => f.startsWith('shared:'))) state = 'shared';
|
|
124
|
+
else if (optional.some((f) => f.startsWith('master:'))) state = 'slave';
|
|
125
|
+
roots.push({ id: fields[0], parent: fields[1], state });
|
|
126
|
+
}
|
|
127
|
+
if (roots.length === 0) return null;
|
|
128
|
+
const parents = new Set(roots.map((r) => r.parent));
|
|
129
|
+
const top = roots.filter((r) => !parents.has(r.id));
|
|
130
|
+
// A cycle or several unrelated tops cannot be told apart; read it as unknown.
|
|
131
|
+
return top.length === 1 ? top[0].state : null;
|
|
132
|
+
}
|
|
133
|
+
|
|
102
134
|
module.exports = function registerCheckPrerequisites(server, options = {}) {
|
|
103
135
|
const docker = options.dockerUtil || createDockerUtil(options);
|
|
104
136
|
const http = options.httpClient || createHttpClient(options);
|
|
@@ -107,6 +139,84 @@ module.exports = function registerCheckPrerequisites(server, options = {}) {
|
|
|
107
139
|
const _statfs = options.statfs || require('fs').promises.statfs;
|
|
108
140
|
const _readFile = options.fs?.readFile || require('fs').promises.readFile;
|
|
109
141
|
const _userInfo = options.userInfo || os.userInfo;
|
|
142
|
+
// Reads of /proc go through these so tests use fixtures, not the real /proc.
|
|
143
|
+
const _platform = options.platform || process.platform;
|
|
144
|
+
const _env = options.env || process.env;
|
|
145
|
+
const _readdir = options.procFs?.readdir || require('fs').promises.readdir;
|
|
146
|
+
const _procRead = options.procFs?.readFile || require('fs').promises.readFile;
|
|
147
|
+
|
|
148
|
+
/** PIDs of every dockerd running on this machine, lowest first. */
|
|
149
|
+
async function findLocalDockerds() {
|
|
150
|
+
const entries = await _readdir('/proc');
|
|
151
|
+
const pids = entries.map(String).filter((e) => /^\d+$/.test(e)).sort((a, b) => Number(a) - Number(b));
|
|
152
|
+
const found = [];
|
|
153
|
+
for (const pid of pids) {
|
|
154
|
+
try {
|
|
155
|
+
const comm = await _procRead(`/proc/${pid}/comm`, 'utf8');
|
|
156
|
+
if (String(comm).trim() === 'dockerd') found.push(pid);
|
|
157
|
+
} catch {
|
|
158
|
+
// the process ended or is not readable; keep looking
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return found;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
async function isWsl() {
|
|
165
|
+
if (_env.WSL_DISTRO_NAME) return true;
|
|
166
|
+
try {
|
|
167
|
+
return /microsoft/i.test(String(await _procRead('/proc/version', 'utf8')));
|
|
168
|
+
} catch {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* The release compose mounts / and /mnt with rslave propagation, which needs
|
|
175
|
+
* "/" to be shared or slave in the Docker daemon's mount namespace. A private
|
|
176
|
+
* root (WSL2 default) leaves the containers stuck in Created. Only a dockerd
|
|
177
|
+
* on this machine can be checked; Docker Desktop, a remote daemon, macOS and
|
|
178
|
+
* Windows skip it and never fail.
|
|
179
|
+
*/
|
|
180
|
+
async function checkRootMountPropagation(dockerHost) {
|
|
181
|
+
const name = 'root_mount_propagation';
|
|
182
|
+
const skipped = (why) => ({ name, passed: true, skipped: true, detail: `Root mount check skipped — ${why}.` });
|
|
183
|
+
if (_platform !== 'linux') return skipped('only Linux hosts are checked');
|
|
184
|
+
if (dockerHost.remote) return skipped(`the Docker daemon runs on ${dockerHost.host}`);
|
|
185
|
+
let pids;
|
|
186
|
+
try {
|
|
187
|
+
pids = await findLocalDockerds();
|
|
188
|
+
} catch (err) {
|
|
189
|
+
console.error(`[check_prerequisites] could not scan /proc: ${err.message}`);
|
|
190
|
+
return skipped('the process list could not be read');
|
|
191
|
+
}
|
|
192
|
+
// With several daemons (for example a system one and a rootless one) the
|
|
193
|
+
// one behind the Docker endpoint cannot be told from the process list.
|
|
194
|
+
if (pids.length > 1) return skipped(`${pids.length} Docker daemon processes run on this machine (PIDs ${pids.join(', ')}), so the one this install uses cannot be picked`);
|
|
195
|
+
const pid = pids.length === 1 ? pids[0] : null;
|
|
196
|
+
if (pid === null) return skipped('no Docker daemon process runs on this machine (Docker Desktop or a remote daemon keeps its own mounts)');
|
|
197
|
+
// Only the daemon's own mountinfo says what its mount namespace looks like;
|
|
198
|
+
// another process (PID 1) can sit in a different namespace.
|
|
199
|
+
let mountinfo = null;
|
|
200
|
+
try {
|
|
201
|
+
mountinfo = await _procRead(`/proc/${pid}/mountinfo`, 'utf8');
|
|
202
|
+
} catch (err) {
|
|
203
|
+
console.error(`[check_prerequisites] could not read /proc/${pid}/mountinfo: ${err.message}`);
|
|
204
|
+
}
|
|
205
|
+
const state = mountinfo === null ? null : rootPropagation(mountinfo);
|
|
206
|
+
if (state === null) return skipped('the root mount could not be read');
|
|
207
|
+
if (state !== 'private') {
|
|
208
|
+
return { name, passed: true, detail: `The root mount is ${state} for the Docker daemon, as the Relayer compose needs` };
|
|
209
|
+
}
|
|
210
|
+
const wslNote = (await isWsl())
|
|
211
|
+
? ' WSL resets this on every restart, so run it again after wsl --shutdown or a reboot, before each docker compose up.'
|
|
212
|
+
: '';
|
|
213
|
+
return {
|
|
214
|
+
name,
|
|
215
|
+
passed: false,
|
|
216
|
+
detail: 'The root mount (/) is private for the Docker daemon, so the Relayer containers would stay stuck in "Created" and the install would never become healthy',
|
|
217
|
+
remediation: `Make / shared in the Docker daemon's mount namespace: ${makeRootSharedCommand(pid)} — then run the install again.${wslNote}`,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
110
220
|
|
|
111
221
|
/**
|
|
112
222
|
* install_relayer is fresh-install only; an existing xns-relayer container
|
|
@@ -238,7 +348,7 @@ module.exports = function registerCheckPrerequisites(server, options = {}) {
|
|
|
238
348
|
server.registerTool(
|
|
239
349
|
'check_prerequisites',
|
|
240
350
|
{
|
|
241
|
-
title: '
|
|
351
|
+
title: 'Check prerequisites',
|
|
242
352
|
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
353
|
inputSchema: {
|
|
244
354
|
/* no parameters */
|
|
@@ -292,7 +402,7 @@ module.exports = function registerCheckPrerequisites(server, options = {}) {
|
|
|
292
402
|
name: 'docker',
|
|
293
403
|
passed: false,
|
|
294
404
|
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
|
|
405
|
+
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
406
|
});
|
|
297
407
|
} else if (remote) {
|
|
298
408
|
// DECISION: a failing `docker info` against an ssh:// or tcp://
|
|
@@ -396,7 +506,7 @@ module.exports = function registerCheckPrerequisites(server, options = {}) {
|
|
|
396
506
|
name: 'install_file_location',
|
|
397
507
|
passed: false,
|
|
398
508
|
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
|
|
509
|
+
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
510
|
});
|
|
401
511
|
}
|
|
402
512
|
|
|
@@ -463,6 +573,11 @@ module.exports = function registerCheckPrerequisites(server, options = {}) {
|
|
|
463
573
|
if (!fixedNames.passed) allPassed = false;
|
|
464
574
|
checks.push(fixedNames);
|
|
465
575
|
|
|
576
|
+
// 3a-2. A private root mount leaves the containers stuck in Created.
|
|
577
|
+
const rootMount = await checkRootMountPropagation(dockerHost);
|
|
578
|
+
if (!rootMount.passed) allPassed = false;
|
|
579
|
+
checks.push(rootMount);
|
|
580
|
+
|
|
466
581
|
// 3b. Existing installation — warn early, here.
|
|
467
582
|
checks.push(await checkExistingInstall(dockerState));
|
|
468
583
|
|
|
@@ -501,7 +616,7 @@ module.exports = function registerCheckPrerequisites(server, options = {}) {
|
|
|
501
616
|
{ url: 'https://auth.xns.tech/auth/realms/scprime/.well-known/openid-configuration', name: 'connectivity_auth', host: 'auth.xns.tech' },
|
|
502
617
|
// The registry install_relayer pulls from (release channel, anonymous).
|
|
503
618
|
// /v2/ is the registry version probe — 200 without credentials.
|
|
504
|
-
{ url: 'https://releases.
|
|
619
|
+
{ url: 'https://releases.xns.tech/v2/', name: 'connectivity_registry', host: 'releases.xns.tech' },
|
|
505
620
|
];
|
|
506
621
|
for (const { url, name, host } of connectivityChecks) {
|
|
507
622
|
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: '
|
|
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
|
|
135
|
-
|
|
136
|
-
const
|
|
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 (
|
|
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
|
-
?
|
|
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
|
|
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: '
|
|
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,
|
|
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: '
|
|
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
|
}],
|
package/src/tools/getHostTags.js
CHANGED
|
@@ -32,7 +32,7 @@ module.exports = function registerGetHostTags(server, options = {}) {
|
|
|
32
32
|
server.registerTool(
|
|
33
33
|
'get_host_tags',
|
|
34
34
|
{
|
|
35
|
-
title: '
|
|
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 */
|