@xns-cloud/relayer-mcp 0.7.0 → 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 +36 -4
- package/package.json +8 -2
- package/src/index.js +6 -2
- package/src/lib/environmentProbe.js +55 -0
- package/src/lib/hostAllowlist.js +57 -0
- package/src/lib/oidcAuth.js +22 -11
- package/src/tools/checkClaimStatus.js +14 -5
- package/src/tools/checkEmailVerified.js +14 -6
- package/src/tools/checkPrerequisites.js +49 -5
- 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 +68 -0
- package/src/tools/updateSettings.js +12 -4
- package/src/tools/verifyStorage.js +279 -78
- package/src/tools/registerAccount.js +0 -123
|
@@ -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 {
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
DEFAULT_KEYCLOAK_URL,
|
|
5
|
+
DEFAULT_REALM,
|
|
6
|
+
DEFAULT_CLIENT_ID,
|
|
7
|
+
generateVerifier,
|
|
8
|
+
generateChallenge,
|
|
9
|
+
} = require('../lib/oidcAuth');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Tool 2: start_registration
|
|
13
|
+
*
|
|
14
|
+
* Returns the Keycloak self-registration URL for the configured realm and
|
|
15
|
+
* client. The agent presents this URL to the user for browser sign-up —
|
|
16
|
+
* no password is ever handled by the MCP. After registration, use
|
|
17
|
+
* check_email_verified to poll for verification status.
|
|
18
|
+
*
|
|
19
|
+
* A fresh disposable PKCE pair is generated per call to satisfy the
|
|
20
|
+
* relayer-native client's S256 requirement. The verifier is discarded —
|
|
21
|
+
* no token exchange happens; check_email_verified is the completion signal.
|
|
22
|
+
*/
|
|
23
|
+
module.exports = function registerStartRegistration(server, options = {}) {
|
|
24
|
+
const keycloakUrl = options.keycloakUrl || DEFAULT_KEYCLOAK_URL;
|
|
25
|
+
const realm = options.realm || DEFAULT_REALM;
|
|
26
|
+
const clientId = options.clientId || DEFAULT_CLIENT_ID;
|
|
27
|
+
|
|
28
|
+
server.registerTool(
|
|
29
|
+
'start_registration',
|
|
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
|
+
},
|
|
40
|
+
async () => {
|
|
41
|
+
const verifier = generateVerifier();
|
|
42
|
+
const challenge = generateChallenge(verifier);
|
|
43
|
+
const redirectUri = 'http://127.0.0.1:41337/callback';
|
|
44
|
+
|
|
45
|
+
const params = new URLSearchParams({
|
|
46
|
+
client_id: clientId,
|
|
47
|
+
response_type: 'code',
|
|
48
|
+
scope: 'openid',
|
|
49
|
+
redirect_uri: redirectUri,
|
|
50
|
+
code_challenge: challenge,
|
|
51
|
+
code_challenge_method: 'S256',
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const registrationUrl = `${keycloakUrl}/realms/${realm}/protocol/openid-connect/registrations?${params}`;
|
|
55
|
+
|
|
56
|
+
return {
|
|
57
|
+
content: [{
|
|
58
|
+
type: 'text',
|
|
59
|
+
text: JSON.stringify({
|
|
60
|
+
success: true,
|
|
61
|
+
registration_url: registrationUrl,
|
|
62
|
+
message: `Open this URL in a browser to create an XNS account. After signing up, use check_email_verified to confirm the email address was verified. Note: after completing registration, the browser may show a connection error on the final redirect page — this is expected and harmless.`,
|
|
63
|
+
}, null, 2),
|
|
64
|
+
}],
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
);
|
|
68
|
+
};
|
|
@@ -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 {
|