@xns-cloud/relayer-mcp 0.8.1 → 0.9.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 +14 -1
- package/package.json +6 -2
- package/src/index.js +5 -1
- package/src/lib/hostAllowlist.js +57 -0
- package/src/tools/checkClaimStatus.js +14 -5
- package/src/tools/checkEmailVerified.js +12 -4
- package/src/tools/checkPrerequisites.js +11 -3
- package/src/tools/checkRelayerHealth.js +16 -7
- package/src/tools/configureVpd.js +13 -5
- package/src/tools/describeSettings.js +11 -3
- package/src/tools/getHostTags.js +11 -3
- package/src/tools/installRelayer.js +19 -11
- package/src/tools/manageBackups.js +28 -10
- package/src/tools/restartService.js +12 -4
- package/src/tools/setupCliCredentials.js +48 -8
- package/src/tools/startClaim.js +11 -3
- package/src/tools/startRegistration.js +11 -3
- package/src/tools/updateSettings.js +12 -4
- package/src/tools/verifyStorage.js +18 -46
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ MCP server for [XNS Relayer](https://xns.tech) — S3-compatible decentralized o
|
|
|
10
10
|
npx @xns-cloud/relayer-mcp@latest
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
**Pricing:** [$4.
|
|
13
|
+
**Pricing:** [$4.00 per network-TB-month](https://xns.tech/pricing) — you pay for the parity your data is stored with, [$0 egress uncapped](https://xns.tech/pricing), [no minimum retention](https://xns.tech/pricing).
|
|
14
14
|
|
|
15
15
|
## Requirements
|
|
16
16
|
|
|
@@ -66,6 +66,19 @@ claude mcp add relayer -- npx @xns-cloud/relayer-mcp@latest
|
|
|
66
66
|
}
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
+
**Cursor** — add to `.cursor/mcp.json`:
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"mcpServers": {
|
|
74
|
+
"relayer": {
|
|
75
|
+
"command": "npx",
|
|
76
|
+
"args": ["@xns-cloud/relayer-mcp@latest"]
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
69
82
|
No separate install step required — npx fetches the package on demand.
|
|
70
83
|
|
|
71
84
|
## Tools
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xns-cloud/relayer-mcp",
|
|
3
3
|
"mcpName": "tech.xns/relayer",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.9.0",
|
|
5
5
|
"description": "MCP server for XNS Relayer onboarding and day-2 management — drives Relayer setup, settings, and backups conversationally over stdio, npx-ready",
|
|
6
6
|
"author": "SCP Corp",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -37,7 +37,11 @@
|
|
|
37
37
|
"storage",
|
|
38
38
|
"backup",
|
|
39
39
|
"s3-compatible",
|
|
40
|
-
"claude"
|
|
40
|
+
"claude",
|
|
41
|
+
"zero-egress",
|
|
42
|
+
"rag-infrastructure",
|
|
43
|
+
"agentic-workflows",
|
|
44
|
+
"agentic"
|
|
41
45
|
],
|
|
42
46
|
"engines": {
|
|
43
47
|
"node": ">=20"
|
package/src/index.js
CHANGED
|
@@ -13,8 +13,12 @@ if (!nodeCheck.ok) {
|
|
|
13
13
|
const { McpServer } = require('@modelcontextprotocol/sdk/server/mcp.js');
|
|
14
14
|
const { StdioServerTransport } = require('@modelcontextprotocol/sdk/server/stdio.js');
|
|
15
15
|
|
|
16
|
+
// Name and version both derive from package.json so the runtime server, the npm
|
|
17
|
+
// package, and the registry card cannot drift apart (CONTRACT-1, E-A2 review).
|
|
18
|
+
// package.json mcpName is the immutable registry identity, pinned by
|
|
19
|
+
// registryIdentity.test.js.
|
|
16
20
|
const server = new McpServer({
|
|
17
|
-
name: '
|
|
21
|
+
name: require('../package.json').mcpName,
|
|
18
22
|
version: require('../package.json').version,
|
|
19
23
|
});
|
|
20
24
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Shared host allowlist for tools that send credentials to a caller-supplied URL.
|
|
5
|
+
*
|
|
6
|
+
* Several tools accept a Relayer base URL as a parameter and then attach a Muse/Keycloak
|
|
7
|
+
* token to the request. Without a check, a caller can name any host and receive that
|
|
8
|
+
* token. This module is the one place that decides which hosts are acceptable.
|
|
9
|
+
*
|
|
10
|
+
* Extracted from verifyStorage.js, which had the only copy — see MR !33 (CodeRabbit
|
|
11
|
+
* flagged setup_cli_credentials forwarding a token to an unvalidated URL while a sibling
|
|
12
|
+
* tool in the same repo already guarded the identical parameter).
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Validate that a URL points to a loopback, RFC-1918 private, or .local host.
|
|
17
|
+
* Rejects public/internet-routable hosts to prevent token forwarding.
|
|
18
|
+
*
|
|
19
|
+
* @param {string} urlString - A fully qualified URL
|
|
20
|
+
* @returns {{ allowed: boolean, reason?: string }}
|
|
21
|
+
*/
|
|
22
|
+
function validateHostAllowlist(urlString) {
|
|
23
|
+
let parsed;
|
|
24
|
+
try {
|
|
25
|
+
parsed = new URL(urlString);
|
|
26
|
+
} catch {
|
|
27
|
+
return { allowed: false, reason: 'URL is malformed' };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const hostname = parsed.hostname.toLowerCase();
|
|
31
|
+
|
|
32
|
+
if (hostname === 'localhost' || hostname === '[::1]' || hostname === '::1') {
|
|
33
|
+
return { allowed: true };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (hostname.endsWith('.local')) {
|
|
37
|
+
return { allowed: true };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const ipv4Match = hostname.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);
|
|
41
|
+
if (ipv4Match) {
|
|
42
|
+
const octets = ipv4Match.slice(1).map(Number);
|
|
43
|
+
if (octets[0] === 127) return { allowed: true };
|
|
44
|
+
if (octets[0] === 10) return { allowed: true };
|
|
45
|
+
if (octets[0] === 172 && octets[1] >= 16 && octets[1] <= 31) return { allowed: true };
|
|
46
|
+
if (octets[0] === 192 && octets[1] === 168) return { allowed: true };
|
|
47
|
+
return { allowed: false, reason: `Host ${hostname} is not a loopback or private-network address. Allowed: localhost, 127.0.0.0/8, ::1, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, *.local` };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return { allowed: false, reason: `Host '${hostname}' is not a loopback, private-network, or .local address. Allowed: localhost, 127.0.0.0/8, ::1, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, *.local` };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// A redirect on a token-bearing request would hand the token to the redirect target,
|
|
54
|
+
// defeating the allowlist above. Never follow one.
|
|
55
|
+
const NO_REDIRECT_TOKEN_CONFIG = { maxRedirects: 0 };
|
|
56
|
+
|
|
57
|
+
module.exports = { validateHostAllowlist, NO_REDIRECT_TOKEN_CONFIG };
|
|
@@ -24,12 +24,20 @@ module.exports = function registerCheckClaimStatus(server, options = {}) {
|
|
|
24
24
|
const pollInterval = options.pollIntervalMs ?? POLL_INTERVAL_MS;
|
|
25
25
|
const sleep = options.sleep;
|
|
26
26
|
|
|
27
|
-
server.
|
|
27
|
+
server.registerTool(
|
|
28
28
|
'check_claim_status',
|
|
29
|
-
'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.',
|
|
30
29
|
{
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
title: 'check_claim_status',
|
|
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
|
+
inputSchema: {
|
|
33
|
+
claim_id: z.string().describe('The claim_id returned by start_claim'),
|
|
34
|
+
timeout_ms: z.number().int().min(1000).max(3600000).optional().default(600000).describe('Maximum time to poll in milliseconds (default: 10 minutes, max 1 hour)'),
|
|
35
|
+
},
|
|
36
|
+
annotations: {
|
|
37
|
+
readOnlyHint: true,
|
|
38
|
+
destructiveHint: false,
|
|
39
|
+
openWorldHint: true,
|
|
40
|
+
},
|
|
33
41
|
},
|
|
34
42
|
async ({ claim_id, timeout_ms }) => {
|
|
35
43
|
try {
|
|
@@ -138,12 +146,13 @@ module.exports = function registerCheckClaimStatus(server, options = {}) {
|
|
|
138
146
|
isError: (result.success === false && result.continue_polling !== false) ? true : undefined,
|
|
139
147
|
};
|
|
140
148
|
} catch (err) {
|
|
149
|
+
console.error(`[check_claim_status] ${err.message}`);
|
|
141
150
|
return {
|
|
142
151
|
content: [{
|
|
143
152
|
type: 'text',
|
|
144
153
|
text: JSON.stringify({
|
|
145
154
|
success: false,
|
|
146
|
-
error:
|
|
155
|
+
error: 'Claim status check failed. See server log for detail.',
|
|
147
156
|
}),
|
|
148
157
|
}],
|
|
149
158
|
isError: true,
|
|
@@ -27,12 +27,20 @@ module.exports = function registerCheckEmailVerified(server, options = {}) {
|
|
|
27
27
|
const pollTimeout = options.pollTimeoutMs ?? POLL_TIMEOUT_MS;
|
|
28
28
|
const sleep = options.sleep;
|
|
29
29
|
|
|
30
|
-
server.
|
|
30
|
+
server.registerTool(
|
|
31
31
|
'check_email_verified',
|
|
32
|
-
'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.',
|
|
33
32
|
{
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
title: 'check_email_verified',
|
|
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
|
+
inputSchema: {
|
|
36
|
+
email: z.string().email().describe('Email address to check verification status'),
|
|
37
|
+
poll: z.boolean().optional().default(true).describe('If true (default), poll until verified or timeout. If false, check once.'),
|
|
38
|
+
},
|
|
39
|
+
annotations: {
|
|
40
|
+
readOnlyHint: true,
|
|
41
|
+
destructiveHint: false,
|
|
42
|
+
openWorldHint: true,
|
|
43
|
+
},
|
|
36
44
|
},
|
|
37
45
|
async ({ email, poll }) => {
|
|
38
46
|
try {
|
|
@@ -35,11 +35,19 @@ module.exports = function registerCheckPrerequisites(server, options = {}) {
|
|
|
35
35
|
const _checkPort = options.checkPort || checkPort;
|
|
36
36
|
const _environmentProbe = options.environmentProbe || defaultEnvironmentProbe;
|
|
37
37
|
|
|
38
|
-
server.
|
|
38
|
+
server.registerTool(
|
|
39
39
|
'check_prerequisites',
|
|
40
|
-
'Check system prerequisites for XNS Relayer installation: Docker availability (local or remote via DOCKER_HOST / ssh:// context), required ports (8888, 9000), an existing xns-relayer installation, disk space, and network connectivity to console.xns.tech and auth.xns.tech. Run this first before any other relayer tool.',
|
|
41
40
|
{
|
|
42
|
-
|
|
41
|
+
title: 'check_prerequisites',
|
|
42
|
+
description: 'Check system prerequisites for XNS Relayer installation: Docker availability (local or remote via DOCKER_HOST / ssh:// context), required ports (8888, 9000), an existing xns-relayer installation, disk space, and network connectivity to console.xns.tech and auth.xns.tech. Run this first before any other relayer tool.',
|
|
43
|
+
inputSchema: {
|
|
44
|
+
/* no parameters */
|
|
45
|
+
},
|
|
46
|
+
annotations: {
|
|
47
|
+
readOnlyHint: true,
|
|
48
|
+
destructiveHint: false,
|
|
49
|
+
openWorldHint: true,
|
|
50
|
+
},
|
|
43
51
|
},
|
|
44
52
|
async () => {
|
|
45
53
|
const checks = [];
|
|
@@ -51,14 +51,22 @@ module.exports = function registerCheckRelayerHealth(server, options = {}) {
|
|
|
51
51
|
const pollTimeout = options.pollTimeoutMs ?? POLL_TIMEOUT_MS;
|
|
52
52
|
const sleep = options.sleep;
|
|
53
53
|
|
|
54
|
-
server.
|
|
54
|
+
server.registerTool(
|
|
55
55
|
'check_relayer_health',
|
|
56
|
-
'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.',
|
|
57
56
|
{
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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.',
|
|
59
|
+
inputSchema: {
|
|
60
|
+
poll: z.boolean().optional().default(true).describe('If true (default), poll until healthy or timeout. If false, check once.'),
|
|
61
|
+
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).'),
|
|
62
|
+
ui_port: z.number().int().min(1).max(65535).optional().default(8888).describe('Host port for the Relayer UI (matches install_relayer ui_port)'),
|
|
63
|
+
s3_port: z.number().int().min(1).max(65535).optional().default(9000).describe('Host port for the S3 API (matches install_relayer s3_port)'),
|
|
64
|
+
},
|
|
65
|
+
annotations: {
|
|
66
|
+
readOnlyHint: true,
|
|
67
|
+
destructiveHint: false,
|
|
68
|
+
openWorldHint: true,
|
|
69
|
+
},
|
|
62
70
|
},
|
|
63
71
|
async ({ poll, host, ui_port, s3_port }) => {
|
|
64
72
|
try {
|
|
@@ -201,12 +209,13 @@ module.exports = function registerCheckRelayerHealth(server, options = {}) {
|
|
|
201
209
|
}],
|
|
202
210
|
};
|
|
203
211
|
} catch (err) {
|
|
212
|
+
console.error(`[check_relayer_health] ${err.message}`);
|
|
204
213
|
return {
|
|
205
214
|
content: [{
|
|
206
215
|
type: 'text',
|
|
207
216
|
text: JSON.stringify({
|
|
208
217
|
success: false,
|
|
209
|
-
error:
|
|
218
|
+
error: 'Health check failed. See server log for detail.',
|
|
210
219
|
}),
|
|
211
220
|
}],
|
|
212
221
|
isError: true,
|
|
@@ -40,13 +40,21 @@ module.exports = function registerConfigureVpd(server, options = {}) {
|
|
|
40
40
|
const tokenMgr = createTokenManager(options);
|
|
41
41
|
const { ensureToken } = tokenMgr;
|
|
42
42
|
|
|
43
|
-
server.
|
|
43
|
+
server.registerTool(
|
|
44
44
|
'configure_vpd',
|
|
45
|
-
'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).',
|
|
46
45
|
{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
title: 'configure_vpd',
|
|
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
|
+
inputSchema: {
|
|
49
|
+
data_expression: z.string().describe('CEL expression for data host selection. Use "true" for default (all hosts).'),
|
|
50
|
+
parity_expression: z.string().describe('CEL expression for parity host selection. Use "true" for default (all hosts).'),
|
|
51
|
+
dry_run: z.boolean().optional().describe('Preview how many hosts match without applying anything. Not supported on Relayer versions without the evaluate endpoint.'),
|
|
52
|
+
},
|
|
53
|
+
annotations: {
|
|
54
|
+
readOnlyHint: false,
|
|
55
|
+
destructiveHint: false,
|
|
56
|
+
openWorldHint: true,
|
|
57
|
+
},
|
|
50
58
|
},
|
|
51
59
|
async ({ data_expression, parity_expression, dry_run }) => {
|
|
52
60
|
try {
|
|
@@ -20,11 +20,19 @@ module.exports = function registerDescribeSettings(server, options = {}) {
|
|
|
20
20
|
const tokenMgr = createTokenManager(options);
|
|
21
21
|
const { ensureToken } = tokenMgr;
|
|
22
22
|
|
|
23
|
-
server.
|
|
23
|
+
server.registerTool(
|
|
24
24
|
'describe_settings',
|
|
25
|
-
'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).',
|
|
26
25
|
{
|
|
27
|
-
|
|
26
|
+
title: 'describe_settings',
|
|
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
|
+
inputSchema: {
|
|
29
|
+
/* no parameters — the whitelist is small by design */
|
|
30
|
+
},
|
|
31
|
+
annotations: {
|
|
32
|
+
readOnlyHint: true,
|
|
33
|
+
destructiveHint: false,
|
|
34
|
+
openWorldHint: true,
|
|
35
|
+
},
|
|
28
36
|
},
|
|
29
37
|
async () => {
|
|
30
38
|
try {
|
package/src/tools/getHostTags.js
CHANGED
|
@@ -29,11 +29,19 @@ module.exports = function registerGetHostTags(server, options = {}) {
|
|
|
29
29
|
const tokenMgr = createTokenManager(options);
|
|
30
30
|
const { ensureToken } = tokenMgr;
|
|
31
31
|
|
|
32
|
-
server.
|
|
32
|
+
server.registerTool(
|
|
33
33
|
'get_host_tags',
|
|
34
|
-
'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).',
|
|
35
34
|
{
|
|
36
|
-
|
|
35
|
+
title: 'get_host_tags',
|
|
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
|
+
inputSchema: {
|
|
38
|
+
/* no parameters */
|
|
39
|
+
},
|
|
40
|
+
annotations: {
|
|
41
|
+
readOnlyHint: true,
|
|
42
|
+
destructiveHint: false,
|
|
43
|
+
openWorldHint: true,
|
|
44
|
+
},
|
|
37
45
|
},
|
|
38
46
|
async () => {
|
|
39
47
|
try {
|
|
@@ -68,19 +68,27 @@ module.exports = function registerInstallRelayer(server, options = {}) {
|
|
|
68
68
|
const fsp = options.fs || require('fs').promises;
|
|
69
69
|
const channelComposeUrl = options.channelComposeUrl || CHANNEL_COMPOSE_URL;
|
|
70
70
|
|
|
71
|
-
server.
|
|
71
|
+
server.registerTool(
|
|
72
72
|
'install_relayer',
|
|
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.',
|
|
74
73
|
{
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
74
|
+
title: 'install_relayer',
|
|
75
|
+
description: '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.',
|
|
76
|
+
inputSchema: {
|
|
77
|
+
install_path: z.string().optional().default('/opt/xns-relayer').describe('Directory to install the compose file into'),
|
|
78
|
+
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.'),
|
|
79
|
+
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.'),
|
|
80
|
+
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.'),
|
|
81
|
+
// R5 input boundary — see isValidBindAddress above for why each
|
|
82
|
+
// documented address form is validated whole rather than by charset.
|
|
83
|
+
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.'),
|
|
84
|
+
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.'),
|
|
85
|
+
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.'),
|
|
86
|
+
},
|
|
87
|
+
annotations: {
|
|
88
|
+
readOnlyHint: false,
|
|
89
|
+
destructiveHint: true,
|
|
90
|
+
openWorldHint: true,
|
|
91
|
+
},
|
|
84
92
|
},
|
|
85
93
|
async ({ install_path, ui_port, s3_port, compose_url, bind_address, ui_tls_enabled, s3_tls_enabled }) => {
|
|
86
94
|
try {
|
|
@@ -28,16 +28,32 @@ module.exports = function registerManageBackups(server, options = {}) {
|
|
|
28
28
|
const tokenMgr = createTokenManager(options);
|
|
29
29
|
const { ensureToken } = tokenMgr;
|
|
30
30
|
|
|
31
|
-
server.
|
|
31
|
+
server.registerTool(
|
|
32
32
|
'manage_backups',
|
|
33
|
-
'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.',
|
|
34
33
|
{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
.
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
title: 'manage_backups',
|
|
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
|
+
inputSchema: {
|
|
37
|
+
action: z.enum(['list', 'start', 'restore', 'delete'])
|
|
38
|
+
.describe('Backup operation to perform.'),
|
|
39
|
+
// A bare string here reaches restore/delete, so bound it to an archive
|
|
40
|
+
// name: no path separators, no traversal, no whitespace-only (MR !33).
|
|
41
|
+
file: z.string().trim().min(1).regex(/^[A-Za-z0-9._-]+$/, 'file must be an archive name from action "list" — no path separators')
|
|
42
|
+
.refine((v) => !v.includes('..'), 'file must not contain ".."')
|
|
43
|
+
.optional()
|
|
44
|
+
.describe('Archive file name from list (e.g. "1718000000000.zip"). Required for restore and delete.'),
|
|
45
|
+
// An explicitly EMPTY array previously collapsed to a full restore,
|
|
46
|
+
// identical to omitting the field — a destructive surprise for a caller
|
|
47
|
+
// that filtered its selection down to nothing (MR !33). Omit the field to
|
|
48
|
+
// restore everything; an empty list is now rejected.
|
|
49
|
+
components: z.array(z.enum(COMPONENTS)).nonempty('components must name at least one component; omit the field entirely to restore everything').optional()
|
|
50
|
+
.describe('Restore only these components (db, conf, hostio, samba). Omit to restore everything.'),
|
|
51
|
+
},
|
|
52
|
+
annotations: {
|
|
53
|
+
readOnlyHint: false,
|
|
54
|
+
destructiveHint: true,
|
|
55
|
+
openWorldHint: true,
|
|
56
|
+
},
|
|
41
57
|
},
|
|
42
58
|
async ({ action, file, components }) => {
|
|
43
59
|
try {
|
|
@@ -83,6 +99,7 @@ module.exports = function registerManageBackups(server, options = {}) {
|
|
|
83
99
|
|
|
84
100
|
if (status >= 400 || data?.success === false) {
|
|
85
101
|
const detail = data?.message || data?.error || `HTTP ${status}`;
|
|
102
|
+
console.error(`[manage_backups] ${action} failed: ${detail}`);
|
|
86
103
|
return {
|
|
87
104
|
content: [{
|
|
88
105
|
type: 'text',
|
|
@@ -93,7 +110,7 @@ module.exports = function registerManageBackups(server, options = {}) {
|
|
|
93
110
|
// agent to the fix instead of a dead end.
|
|
94
111
|
error: data?.disabled
|
|
95
112
|
? 'Backups are disabled. Enable them with update_settings {"BACKUP_ENABLED": true} first.'
|
|
96
|
-
: `Backup ${action} failed
|
|
113
|
+
: `Backup ${action} failed. See server log for detail.`,
|
|
97
114
|
}, null, 2),
|
|
98
115
|
}],
|
|
99
116
|
isError: true,
|
|
@@ -123,12 +140,13 @@ module.exports = function registerManageBackups(server, options = {}) {
|
|
|
123
140
|
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
124
141
|
};
|
|
125
142
|
} catch (err) {
|
|
143
|
+
console.error(`[manage_backups] ${action}: ${err.message}`);
|
|
126
144
|
return {
|
|
127
145
|
content: [{
|
|
128
146
|
type: 'text',
|
|
129
147
|
text: JSON.stringify({
|
|
130
148
|
success: false,
|
|
131
|
-
error: `Backup ${action} failed
|
|
149
|
+
error: `Backup ${action} failed. See server log for detail.`,
|
|
132
150
|
}),
|
|
133
151
|
}],
|
|
134
152
|
isError: true,
|
|
@@ -23,12 +23,20 @@ module.exports = function registerRestartService(server, options = {}) {
|
|
|
23
23
|
const tokenMgr = createTokenManager(options);
|
|
24
24
|
const { ensureToken } = tokenMgr;
|
|
25
25
|
|
|
26
|
-
server.
|
|
26
|
+
server.registerTool(
|
|
27
27
|
'restart_service',
|
|
28
|
-
'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.',
|
|
29
28
|
{
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
title: 'restart_service',
|
|
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
|
+
inputSchema: {
|
|
32
|
+
service: z.enum(SERVICES).optional()
|
|
33
|
+
.describe('Service to restart. Defaults to "all".'),
|
|
34
|
+
},
|
|
35
|
+
annotations: {
|
|
36
|
+
readOnlyHint: false,
|
|
37
|
+
destructiveHint: true,
|
|
38
|
+
openWorldHint: true,
|
|
39
|
+
},
|
|
32
40
|
},
|
|
33
41
|
async ({ service }) => {
|
|
34
42
|
try {
|
|
@@ -5,6 +5,7 @@ const path = require('path');
|
|
|
5
5
|
const os = require('os');
|
|
6
6
|
const { z } = require('zod');
|
|
7
7
|
const { createHttpClient } = require('../lib/httpClient');
|
|
8
|
+
const { validateHostAllowlist, NO_REDIRECT_TOKEN_CONFIG } = require('../lib/hostAllowlist');
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Tool 11: setup_cli_credentials
|
|
@@ -21,21 +22,46 @@ const { createHttpClient } = require('../lib/httpClient');
|
|
|
21
22
|
module.exports = function registerSetupCliCredentials(server, options = {}) {
|
|
22
23
|
const http = options.httpClient || createHttpClient(options);
|
|
23
24
|
|
|
24
|
-
server.
|
|
25
|
+
server.registerTool(
|
|
25
26
|
'setup_cli_credentials',
|
|
26
|
-
'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.',
|
|
27
27
|
{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
title: 'setup_cli_credentials',
|
|
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
|
+
inputSchema: {
|
|
31
|
+
muse_token: z.string().describe('Keycloak/Muse token — the same token used for get_host_tags and configure_vpd'),
|
|
32
|
+
installation_id: z.string().optional().default('').describe('Installation ID from check_claim_status STATE_3 result — used as cost_center_id in credentials'),
|
|
33
|
+
relayer_ui_url: z.string().url().optional().default('http://localhost:8888').describe('Relayer UI base URL (default: http://localhost:8888). Must be a loopback, private-network, or .local address — this tool sends your Muse token to it.'),
|
|
34
|
+
},
|
|
35
|
+
annotations: {
|
|
36
|
+
readOnlyHint: false,
|
|
37
|
+
destructiveHint: true,
|
|
38
|
+
openWorldHint: true,
|
|
39
|
+
},
|
|
31
40
|
},
|
|
32
41
|
async ({ muse_token, installation_id, relayer_ui_url }) => {
|
|
42
|
+
// This request carries the caller's Muse token. Check the destination BEFORE
|
|
43
|
+
// sending anything, or a caller can name any host and collect the token
|
|
44
|
+
// (MR !33). Same allowlist verify_storage has always applied.
|
|
45
|
+
const allow = validateHostAllowlist(relayer_ui_url);
|
|
46
|
+
if (!allow.allowed) {
|
|
47
|
+
console.error(`[setup_cli_credentials] relayer_ui_url rejected: ${allow.reason}`);
|
|
48
|
+
return {
|
|
49
|
+
content: [{
|
|
50
|
+
type: 'text',
|
|
51
|
+
text: JSON.stringify({
|
|
52
|
+
success: false,
|
|
53
|
+
error: `relayer_ui_url rejected: ${allow.reason}`,
|
|
54
|
+
}),
|
|
55
|
+
}],
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
33
59
|
try {
|
|
34
60
|
// Step 1: create IAM user "xns-cli" via MC proxy
|
|
35
61
|
const { status, data } = await http.post(
|
|
36
62
|
`${relayer_ui_url}/api/v1/mc/user`,
|
|
37
63
|
{ user: 'xns-cli' },
|
|
38
|
-
{ headers: { keycloaktoken: muse_token } }
|
|
64
|
+
{ headers: { keycloaktoken: muse_token }, ...NO_REDIRECT_TOKEN_CONFIG }
|
|
39
65
|
);
|
|
40
66
|
|
|
41
67
|
if (status !== 200) {
|
|
@@ -68,8 +94,18 @@ module.exports = function registerSetupCliCredentials(server, options = {}) {
|
|
|
68
94
|
};
|
|
69
95
|
}
|
|
70
96
|
|
|
71
|
-
// Step 2: derive S3 endpoint (same host, port 9000)
|
|
72
|
-
|
|
97
|
+
// Step 2: derive S3 endpoint (same host, port 9000).
|
|
98
|
+
// Parse rather than regex-replace: the old `.replace(/:(\d+)(\/|$)/, ...)`
|
|
99
|
+
// only rewrote an EXISTING :port slot, so a portless URL kept 80/443, a
|
|
100
|
+
// query or fragment survived into the persisted endpoint, and a ':digits'
|
|
101
|
+
// sequence in the PATH could be rewritten instead of the port (MR !33).
|
|
102
|
+
const s3Url = new URL(relayer_ui_url);
|
|
103
|
+
s3Url.port = '9000';
|
|
104
|
+
s3Url.username = '';
|
|
105
|
+
s3Url.password = '';
|
|
106
|
+
s3Url.search = '';
|
|
107
|
+
s3Url.hash = '';
|
|
108
|
+
const s3Endpoint = s3Url.toString().replace(/\/$/, '');
|
|
73
109
|
|
|
74
110
|
// Step 3: write ~/.xns/credentials (AC-11 JSON schema, mode 0600)
|
|
75
111
|
const credsPath = path.join(os.homedir(), '.xns', 'credentials');
|
|
@@ -90,6 +126,10 @@ module.exports = function registerSetupCliCredentials(server, options = {}) {
|
|
|
90
126
|
};
|
|
91
127
|
|
|
92
128
|
fs.writeFileSync(credsPath, JSON.stringify(creds, null, 2), { mode: 0o600 });
|
|
129
|
+
// writeFileSync's mode only applies when the file is CREATED. This file is
|
|
130
|
+
// overwritten unconditionally, so an existing loose-permission file would
|
|
131
|
+
// keep those permissions and hold secret keys (MR !33).
|
|
132
|
+
fs.chmodSync(credsPath, 0o600);
|
|
93
133
|
|
|
94
134
|
return {
|
|
95
135
|
content: [{
|
package/src/tools/startClaim.js
CHANGED
|
@@ -18,11 +18,19 @@ module.exports = function registerStartClaim(server, options = {}) {
|
|
|
18
18
|
const http = options.httpClient || createHttpClient(options);
|
|
19
19
|
const relayerUiBase = options.relayerUiBase || RELAYER_UI_BASE;
|
|
20
20
|
|
|
21
|
-
server.
|
|
21
|
+
server.registerTool(
|
|
22
22
|
'start_claim',
|
|
23
|
-
'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.',
|
|
24
23
|
{
|
|
25
|
-
|
|
24
|
+
title: 'start_claim',
|
|
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
|
+
inputSchema: {
|
|
27
|
+
/* no parameters */
|
|
28
|
+
},
|
|
29
|
+
annotations: {
|
|
30
|
+
readOnlyHint: false,
|
|
31
|
+
destructiveHint: false,
|
|
32
|
+
openWorldHint: true,
|
|
33
|
+
},
|
|
26
34
|
},
|
|
27
35
|
async () => {
|
|
28
36
|
try {
|
|
@@ -25,10 +25,18 @@ module.exports = function registerStartRegistration(server, options = {}) {
|
|
|
25
25
|
const realm = options.realm || DEFAULT_REALM;
|
|
26
26
|
const clientId = options.clientId || DEFAULT_CLIENT_ID;
|
|
27
27
|
|
|
28
|
-
server.
|
|
28
|
+
server.registerTool(
|
|
29
29
|
'start_registration',
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
{
|
|
31
|
+
title: 'start_registration',
|
|
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
|
+
inputSchema: {},
|
|
34
|
+
annotations: {
|
|
35
|
+
readOnlyHint: true,
|
|
36
|
+
destructiveHint: false,
|
|
37
|
+
openWorldHint: false,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
32
40
|
async () => {
|
|
33
41
|
const verifier = generateVerifier();
|
|
34
42
|
const challenge = generateChallenge(verifier);
|
|
@@ -30,12 +30,20 @@ module.exports = function registerUpdateSettings(server, options = {}) {
|
|
|
30
30
|
const tokenMgr = createTokenManager(options);
|
|
31
31
|
const { ensureToken } = tokenMgr;
|
|
32
32
|
|
|
33
|
-
server.
|
|
33
|
+
server.registerTool(
|
|
34
34
|
'update_settings',
|
|
35
|
-
'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.',
|
|
36
35
|
{
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
title: 'update_settings',
|
|
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
|
+
inputSchema: {
|
|
39
|
+
settings: z.record(z.union([z.string(), z.number(), z.boolean()]))
|
|
40
|
+
.describe('Map of setting name to new value. Only whitelisted settings are accepted; unknown or protected keys are rejected with the allowed list.'),
|
|
41
|
+
},
|
|
42
|
+
annotations: {
|
|
43
|
+
readOnlyHint: false,
|
|
44
|
+
destructiveHint: true,
|
|
45
|
+
openWorldHint: true,
|
|
46
|
+
},
|
|
39
47
|
},
|
|
40
48
|
async ({ settings }) => {
|
|
41
49
|
try {
|
|
@@ -18,45 +18,9 @@ const { createTokenManager } = require('../lib/ensureToken');
|
|
|
18
18
|
* The minted credential lives in memory only — zero fs usage.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
*
|
|
25
|
-
* @param {string} urlString - A fully qualified URL
|
|
26
|
-
* @returns {{ allowed: boolean, reason?: string }}
|
|
27
|
-
*/
|
|
28
|
-
function validateHostAllowlist(urlString) {
|
|
29
|
-
let parsed;
|
|
30
|
-
try {
|
|
31
|
-
parsed = new URL(urlString);
|
|
32
|
-
} catch {
|
|
33
|
-
return { allowed: false, reason: 'URL is malformed' };
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const hostname = parsed.hostname.toLowerCase();
|
|
37
|
-
|
|
38
|
-
if (hostname === 'localhost' || hostname === '[::1]' || hostname === '::1') {
|
|
39
|
-
return { allowed: true };
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (hostname.endsWith('.local')) {
|
|
43
|
-
return { allowed: true };
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
const ipv4Match = hostname.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);
|
|
47
|
-
if (ipv4Match) {
|
|
48
|
-
const octets = ipv4Match.slice(1).map(Number);
|
|
49
|
-
if (octets[0] === 127) return { allowed: true };
|
|
50
|
-
if (octets[0] === 10) return { allowed: true };
|
|
51
|
-
if (octets[0] === 172 && octets[1] >= 16 && octets[1] <= 31) return { allowed: true };
|
|
52
|
-
if (octets[0] === 192 && octets[1] === 168) return { allowed: true };
|
|
53
|
-
return { allowed: false, reason: `Host ${hostname} is not a loopback or private-network address. Allowed: localhost, 127.0.0.0/8, ::1, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, *.local` };
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return { allowed: false, reason: `Host '${hostname}' is not a loopback, private-network, or .local address. Allowed: localhost, 127.0.0.0/8, ::1, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, *.local` };
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const NO_REDIRECT_TOKEN_CONFIG = { maxRedirects: 0 };
|
|
21
|
+
// Host allowlist + no-redirect policy now live in lib/hostAllowlist.js so every
|
|
22
|
+
// token-bearing tool shares one definition (MR !33).
|
|
23
|
+
const { validateHostAllowlist, NO_REDIRECT_TOKEN_CONFIG } = require('../lib/hostAllowlist');
|
|
60
24
|
|
|
61
25
|
/**
|
|
62
26
|
* An error whose message is authored by this tool (no caught provider text)
|
|
@@ -77,15 +41,23 @@ module.exports = function registerVerifyStorage(server, options = {}) {
|
|
|
77
41
|
const http = options.httpClient || createHttpClient(options);
|
|
78
42
|
const tokenMgr = createTokenManager(options);
|
|
79
43
|
|
|
80
|
-
server.
|
|
44
|
+
server.registerTool(
|
|
81
45
|
'verify_storage',
|
|
82
|
-
'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.',
|
|
83
46
|
{
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
47
|
+
title: 'verify_storage',
|
|
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
|
+
inputSchema: {
|
|
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.'),
|
|
51
|
+
access_key_id: z.string().optional().describe('S3 access key ID — when provided with secret_access_key, skips automatic credential provisioning'),
|
|
52
|
+
secret_access_key: z.string().optional().describe('S3 secret access key — when provided with access_key_id, skips automatic credential provisioning'),
|
|
53
|
+
relayer_ui_url: z.string().trim().url().optional().default('http://localhost:8888').describe('Relayer UI base URL (default: http://localhost:8888)'),
|
|
54
|
+
endpoint: z.string().trim().url().optional().describe('S3 endpoint URL. Default: http://{docker-host}:9000. Pass an explicit IP (e.g. http://192.168.1.100:9000) when auto-detection cannot reach the host.'),
|
|
55
|
+
},
|
|
56
|
+
annotations: {
|
|
57
|
+
readOnlyHint: false,
|
|
58
|
+
destructiveHint: false,
|
|
59
|
+
openWorldHint: true,
|
|
60
|
+
},
|
|
89
61
|
},
|
|
90
62
|
async ({ muse_token, access_key_id, secret_access_key, relayer_ui_url = 'http://localhost:8888', endpoint }) => {
|
|
91
63
|
const runTs = Date.now();
|