@xns-cloud/relayer-mcp 0.6.0 → 0.7.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/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @xns-cloud/relayer-mcp
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/@xns-cloud/relayer-mcp)](https://www.npmjs.com/package/@xns-cloud/relayer-mcp)
4
+ [![license](https://img.shields.io/npm/l/@xns-cloud/relayer-mcp)](./LICENSE)
5
+ [![node](https://img.shields.io/node/v/@xns-cloud/relayer-mcp)](https://nodejs.org/)
6
+
3
7
  MCP server for XNS Relayer onboarding and day-2 management. Provides 15 tools that let an AI agent drive the complete Relayer setup — and afterward adjust settings, manage backups, and tune the VPD — conversationally over stdio transport.
4
8
 
5
9
  ## Requirements
@@ -22,9 +26,15 @@ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
22
26
 
23
27
  If you start the MCP on an older Node, it exits immediately with this same guidance instead of a dependency stack trace.
24
28
 
25
- ## Claude Desktop / Claude Code Configuration
29
+ ## Install
30
+
31
+ **Claude Code** (one command):
32
+
33
+ ```bash
34
+ claude mcp add relayer -- npx @xns-cloud/relayer-mcp@latest
35
+ ```
26
36
 
27
- Add to your `claude_desktop_config.json` (or `claude mcp add relayer -- npx @xns-cloud/relayer-mcp@latest` for Claude Code):
37
+ **Claude Desktop / any MCP client** — add to your `claude_desktop_config.json` (or equivalent):
28
38
 
29
39
  ```json
30
40
  {
@@ -37,7 +47,7 @@ Add to your `claude_desktop_config.json` (or `claude mcp add relayer -- npx @xns
37
47
  }
38
48
  ```
39
49
 
40
- No separate install step required.
50
+ No separate install step required — npx fetches the package on demand.
41
51
 
42
52
  ## Tools
43
53
 
@@ -140,3 +150,4 @@ This package uses the `relayer-native` Keycloak client ID for OIDC authenticatio
140
150
  ## License
141
151
 
142
152
  Apache-2.0 © SCP Corp. See [LICENSE](./LICENSE) and [NOTICE](./NOTICE).
153
+
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@xns-cloud/relayer-mcp",
3
- "version": "0.6.0",
3
+ "mcpName": "tech.xns/relayer",
4
+ "version": "0.7.0",
4
5
  "description": "MCP server for XNS Relayer onboarding and day-2 management — drives Relayer setup, settings, and backups conversationally over stdio, npx-ready",
5
6
  "author": "SCP Corp",
6
7
  "license": "Apache-2.0",
@@ -22,9 +23,19 @@
22
23
  },
23
24
  "keywords": [
24
25
  "mcp",
26
+ "mcp-server",
27
+ "model-context-protocol",
25
28
  "relayer",
26
29
  "xns",
27
- "onboarding"
30
+ "s3",
31
+ "object-storage",
32
+ "onboarding",
33
+ "ai-agent",
34
+ "stdio",
35
+ "docker",
36
+ "self-hosted",
37
+ "storage",
38
+ "backup"
28
39
  ],
29
40
  "engines": {
30
41
  "node": ">=20"
@@ -44,8 +44,8 @@ services:
44
44
  volumes:
45
45
  - relayer_data:/relayer # named volume — MUST match the channel bundle (bug #2)
46
46
  ports:
47
- - ${UI_PORT:-8888}:8888
48
- - ${S3_PORT:-9000}:9000
47
+ - ${BIND_ADDRESS:-}${UI_PORT:-8888}:8888
48
+ - ${BIND_ADDRESS:-}${S3_PORT:-9000}:9000
49
49
  env_file:
50
50
  - .env
51
51
 
@@ -2,8 +2,35 @@
2
2
 
3
3
  const { z } = require('zod');
4
4
  const path = require('path');
5
+ const net = require('net');
5
6
  const { createDockerUtil } = require('../lib/dockerUtil');
6
7
 
8
+ 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
+ // R5 input boundary: this value is written verbatim into the .env the installer
11
+ // authors, and Compose auto-loads that file. An unvalidated newline injects
12
+ // further KEY=VALUE lines — including a second UI_PORT, which wins last-value
13
+ // and silently republishes on a port this tool then misreports in its own
14
+ // success JSON. A charset-only guard stops that but still accepts values Docker
15
+ // cannot bind (`[`, `999.999.999.999`, `127.0.0.1:`, raw IPv6, hostnames), which
16
+ // produce an invalid port mapping at `compose up` instead of a clear error here.
17
+ // So each documented form is validated whole.
18
+ //
19
+ // Hostnames are NOT accepted: the Compose ports short syntax defines the host
20
+ // component as an IP address (docs.docker.com/reference/compose-file/services).
21
+ // "localhost:8888:8888" is not a resolvable-then-bound mapping — it is a
22
+ // malformed one. Rejecting here is a clear error instead of a compose failure.
23
+ function isValidBindAddress(value) {
24
+ if (value === '') return true; // default: all interfaces
25
+ if (net.isIPv4(value)) return true;
26
+ // Raw (unbracketed) IPv6 is ambiguous against the host:container port
27
+ // separator — Docker requires brackets.
28
+ if (value.startsWith('[') && value.endsWith(']')) {
29
+ return net.isIPv6(value.slice(1, -1));
30
+ }
31
+ return false;
32
+ }
33
+
7
34
  // Canonical released install — the full beta channel bundle (relayer +
8
35
  // monitoring stack). Versioned in the deploy repo, shipped to web01 by
9
36
  // `deploy.py promote`, served login-free. THE default install source.
@@ -43,14 +70,19 @@ module.exports = function registerInstallRelayer(server, options = {}) {
43
70
 
44
71
  server.tool(
45
72
  'install_relayer',
46
- 'Install and start the XNS Relayer. By default fetches the canonical beta channel bundle — relayer + the Prometheus/Grafana monitoring stack — from releases.scpri.me (anonymous pull) and writes a .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 the fetch fails. Pass compose_url only to override with a custom compose.',
73
+ 'Install and start the XNS Relayer. By default fetches the canonical beta channel bundle — relayer + the Prometheus/Grafana monitoring stack — from releases.scpri.me (anonymous pull) and writes a .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 the fetch fails. Pass compose_url only to override with a custom compose.\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. The bundled fallback compose does; the channel compose and any compose_url override are fetched remotely and may not. 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.',
47
74
  {
48
75
  install_path: z.string().optional().default('/opt/xns-relayer').describe('Directory to install the compose file into'),
49
- ui_port: z.number().int().positive().optional().default(8888).describe('Host port for the Relayer admin/customer UI (container 8888)'),
50
- s3_port: z.number().int().positive().optional().default(9000).describe('Host port for the S3 API (container 9000)'),
51
- compose_url: z.string().url().optional().describe('OPTIONAL override: URL to a custom docker-compose.yml. Omit for the normal released install.'),
76
+ 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.'),
77
+ s3_port: z.number().int().min(1).max(65535).optional().default(9000).describe('Host port for the S3 API (container 9000). Docker publishes this port on the interface chosen by bind_address.'),
78
+ 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.'),
79
+ // R5 input boundary — see isValidBindAddress above for why each
80
+ // documented address form is validated whole rather than by charset.
81
+ 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 channel path and 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.'),
82
+ 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.'),
83
+ 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.'),
52
84
  },
53
- async ({ install_path, ui_port, s3_port, compose_url }) => {
85
+ async ({ install_path, ui_port, s3_port, compose_url, bind_address, ui_tls_enabled, s3_tls_enabled }) => {
54
86
  try {
55
87
  const { execFile: nodeExecFile } = require('child_process');
56
88
  const execFileFn = _execFile || nodeExecFile;
@@ -92,6 +124,7 @@ module.exports = function registerInstallRelayer(server, options = {}) {
92
124
  });
93
125
  });
94
126
 
127
+ const bindPrefix = bind_address ? `${bind_address}:` : '';
95
128
  let source;
96
129
  let note;
97
130
  if (compose_url) {
@@ -112,7 +145,7 @@ module.exports = function registerInstallRelayer(server, options = {}) {
112
145
  source = 'bundled-fallback';
113
146
  note = `Channel bundle fetch failed (${fetchErr.message}) — fell back to the bundled compose. Same services; re-running install later is not required.`;
114
147
  }
115
- await fsp.writeFile(envPath, `UI_PORT=${ui_port}\nS3_PORT=${s3_port}\n`);
148
+ await fsp.writeFile(envPath, `UI_PORT=${ui_port}\nS3_PORT=${s3_port}\nBIND_ADDRESS=${bindPrefix}\n`);
116
149
  }
117
150
 
118
151
  // Run docker compose up -d. cwd + env so ${UI_PORT}/${S3_PORT}
@@ -120,7 +153,7 @@ module.exports = function registerInstallRelayer(server, options = {}) {
120
153
  // regardless of where the MCP process was launched.
121
154
  await docker.composeUp(composePath, {
122
155
  cwd: install_path,
123
- env: { ...process.env, UI_PORT: String(ui_port), S3_PORT: String(s3_port) },
156
+ env: { ...process.env, UI_PORT: String(ui_port), S3_PORT: String(s3_port), BIND_ADDRESS: bindPrefix },
124
157
  });
125
158
 
126
159
  return {
@@ -132,6 +165,34 @@ module.exports = function registerInstallRelayer(server, options = {}) {
132
165
  compose_path: composePath,
133
166
  install_path,
134
167
  source,
168
+ // D5/W5: state the binding at install time, out-of-band, so a
169
+ // refused connection is explainable later. Two statements, never
170
+ // merged (PRD §7): `composed_from` is what this installer asserts
171
+ // it composed; `reachability` is only CONFIGURED — this process
172
+ // cannot verify the host actually published it, so it says so and
173
+ // points at `docker port` (the host-side source of truth) instead
174
+ // of guessing.
175
+ // The container ports are known only for the channel compose
176
+ // this installer fetches. A caller-supplied compose_url may
177
+ // remap them, and this process never reads that file — so it
178
+ // says null rather than restating 8888/9000 it cannot stand
179
+ // behind (correct-or-absent, same rule as the port readout).
180
+ binding: {
181
+ bind_address: bind_address || '0.0.0.0 (all interfaces)',
182
+ bind_address_applied: source === 'bundled-fallback'
183
+ ? 'yes — the bundled fallback compose references BIND_ADDRESS in its port declarations'
184
+ : 'unknown — the fetched compose may or may not reference BIND_ADDRESS in its port declarations; this installer does not read the fetched file',
185
+ ui: { host_port: ui_port, container_port: compose_url ? null : 8888 },
186
+ s3: { host_port: s3_port, container_port: compose_url ? null : 9000 },
187
+ composed_from: compose_url
188
+ ? `UI_PORT=${ui_port}, S3_PORT=${s3_port}, BIND_ADDRESS=${bindPrefix} passed to docker compose (no .env written on the compose_url override path)`
189
+ : `UI_PORT=${ui_port}, S3_PORT=${s3_port}, BIND_ADDRESS=${bindPrefix} written to ${envPath}`,
190
+ reachability: 'configured — not verified from this process; run `docker port xns-relayer` on the host to see actual Docker publication',
191
+ },
192
+ tls: {
193
+ 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).' },
194
+ 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).' },
195
+ },
135
196
  ...(note ? { note } : {}),
136
197
  }, null, 2),
137
198
  }],