@roxyon/mcp 0.2.0 → 0.4.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/dist/{chunk-BNTVFLMW.js → chunk-HMGCNPGW.js} +494 -6
- package/dist/chunk-HMGCNPGW.js.map +1 -0
- package/dist/http-entry.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
- package/resources/deploy.md +17 -0
- package/resources/recipe-web-deploy.md +51 -0
- package/resources/recipe-wordpress.md +58 -0
- package/dist/chunk-BNTVFLMW.js.map +0 -1
|
@@ -35,6 +35,62 @@ Steps:
|
|
|
35
35
|
]
|
|
36
36
|
})
|
|
37
37
|
);
|
|
38
|
+
server.registerPrompt(
|
|
39
|
+
"build-and-ship-site",
|
|
40
|
+
{
|
|
41
|
+
title: "Build a site and host it on Roxyon",
|
|
42
|
+
description: "Generate a static site (or no-build LumenJS SPA) in the conversation and publish it to a Roxyon host \u2014 for the hosted connector, no local files.",
|
|
43
|
+
argsSchema: {
|
|
44
|
+
brief: z.string().describe("What the site should be."),
|
|
45
|
+
host: z.string().describe("Where to host it, e.g. promo.mycompany.com")
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
({ brief, host }) => ({
|
|
49
|
+
messages: [
|
|
50
|
+
{
|
|
51
|
+
role: "user",
|
|
52
|
+
content: {
|
|
53
|
+
type: "text",
|
|
54
|
+
text: `Build and publish a website to ${host}.
|
|
55
|
+
|
|
56
|
+
Brief: ${brief}
|
|
57
|
+
|
|
58
|
+
1. Read "roxyon://docs/recipe" and follow it. (Read "roxyon://docs/lumenjs" too only if the site needs reactivity.)
|
|
59
|
+
2. If ${host} is not already on the account, roxyon_add_domain { host: "${host}", confirm: true } (add spa:true only for a real single-page app).
|
|
60
|
+
3. Generate the site \u2014 self-contained static files, relative paths, real .html per page or <page>/index.html, \u226460 files / 2 MB.
|
|
61
|
+
4. roxyon_deploy_content { host: "${host}", files: [...], clean: true, confirm: true } (dry-run first).
|
|
62
|
+
5. roxyon_list_files { host: "${host}" } to verify, then give me the URL. Note that HTTPS may take a couple of minutes on a brand-new host.`
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
})
|
|
67
|
+
);
|
|
68
|
+
server.registerPrompt(
|
|
69
|
+
"install-wordpress",
|
|
70
|
+
{
|
|
71
|
+
title: "Install WordPress on Roxyon",
|
|
72
|
+
description: "Provision a host + database and install WordPress core \u2014 local/CLI MCP only.",
|
|
73
|
+
argsSchema: {
|
|
74
|
+
host: z.string().describe("Where to install it, e.g. blog.mycompany.com")
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
({ host }) => ({
|
|
78
|
+
messages: [
|
|
79
|
+
{
|
|
80
|
+
role: "user",
|
|
81
|
+
content: {
|
|
82
|
+
type: "text",
|
|
83
|
+
text: `Install WordPress on ${host}.
|
|
84
|
+
|
|
85
|
+
1. Read "roxyon://docs/recipe-wordpress" and follow it.
|
|
86
|
+
2. Call roxyon_install_wordpress { host: "${host}" } first without confirm to see the plan.
|
|
87
|
+
3. If it looks right, call it again with confirm:true.
|
|
88
|
+
4. Report the site URL and the database credentials (shown once \u2014 pass them on to me now), and tell me to visit the URL to finish WordPress's own setup wizard (site title, admin account).`
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
})
|
|
93
|
+
);
|
|
38
94
|
server.registerPrompt(
|
|
39
95
|
"deploy-to-roxyon",
|
|
40
96
|
{
|
|
@@ -87,6 +143,20 @@ var DOCS = [
|
|
|
87
143
|
file: "deploy.md",
|
|
88
144
|
title: "Deploying to Roxyon",
|
|
89
145
|
description: "How roxyon_init / roxyon_deploy work, the roxyon.json schema, static vs app deploys, env vars, and git push-to-deploy."
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
uri: "roxyon://docs/recipe",
|
|
149
|
+
name: "web-deploy-recipe",
|
|
150
|
+
file: "recipe-web-deploy.md",
|
|
151
|
+
title: "Recipe \u2014 build a site and host it",
|
|
152
|
+
description: 'The end-to-end flow for "build a landing page and put it on sub.mydomain.com" over the hosted connector: roxyon_add_domain \u2192 roxyon_deploy_content \u2192 roxyon_list_files.'
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
uri: "roxyon://docs/recipe-wordpress",
|
|
156
|
+
name: "wordpress-recipe",
|
|
157
|
+
file: "recipe-wordpress.md",
|
|
158
|
+
title: "Recipe \u2014 install WordPress",
|
|
159
|
+
description: 'The end-to-end flow for "put WordPress on sub.mydomain.com": roxyon_install_wordpress (host + database + WordPress core, one call). Local/CLI-backed MCP only.'
|
|
90
160
|
}
|
|
91
161
|
];
|
|
92
162
|
function registerResources(server) {
|
|
@@ -104,14 +174,20 @@ function registerResources(server) {
|
|
|
104
174
|
}
|
|
105
175
|
|
|
106
176
|
// src/tools.ts
|
|
177
|
+
import { mkdtemp } from "fs/promises";
|
|
178
|
+
import { tmpdir } from "os";
|
|
179
|
+
import { join as join2 } from "path";
|
|
107
180
|
import { formatEnv } from "@roxyon/api-client";
|
|
108
181
|
import {
|
|
109
182
|
buildIgnore,
|
|
110
183
|
buildProjectConfig,
|
|
111
184
|
deployProject,
|
|
112
185
|
detectRuntime,
|
|
186
|
+
installWordPress,
|
|
113
187
|
listFiles,
|
|
114
188
|
loadProjectConfig,
|
|
189
|
+
packDirectory,
|
|
190
|
+
packFiles,
|
|
115
191
|
saveProjectConfig
|
|
116
192
|
} from "@roxyon/deploy-core";
|
|
117
193
|
import { z as z2 } from "zod";
|
|
@@ -193,6 +269,9 @@ async function guard(fn) {
|
|
|
193
269
|
}
|
|
194
270
|
|
|
195
271
|
// src/tools.ts
|
|
272
|
+
var MAX_FILES = 60;
|
|
273
|
+
var MAX_FILE_BYTES = 1024 * 1024;
|
|
274
|
+
var MAX_TOTAL_BYTES = 2 * 1024 * 1024;
|
|
196
275
|
function remoteFilesystemBlock(tool) {
|
|
197
276
|
if (!currentContext().remote) return null;
|
|
198
277
|
return errorResult(
|
|
@@ -235,9 +314,7 @@ function registerTools(server) {
|
|
|
235
314
|
`Auth: ${session.source}${ctx.scopes.length ? ` (scopes: ${ctx.scopes.join(", ")})` : ""}`,
|
|
236
315
|
"",
|
|
237
316
|
"Subscriptions:",
|
|
238
|
-
...ctx.subscriptions.map(
|
|
239
|
-
(s) => ` ${s.name || s.id} \u2014 ${s.status || "?"}${s.datacenter ? ` \xB7 ${s.datacenter}` : ""}`
|
|
240
|
-
),
|
|
317
|
+
...ctx.subscriptions.map((s) => ` ${s.name || s.id} \u2014 ${s.status || "?"}`),
|
|
241
318
|
"",
|
|
242
319
|
`Hosts: ${ctx.domains.map((d) => d.name).join(", ") || "(none)"}`
|
|
243
320
|
];
|
|
@@ -260,8 +337,10 @@ function registerTools(server) {
|
|
|
260
337
|
const session = await getSession();
|
|
261
338
|
const { domains } = await accountContext(session);
|
|
262
339
|
return text(
|
|
263
|
-
domains.length ? domains.map(
|
|
264
|
-
|
|
340
|
+
domains.length ? domains.map(
|
|
341
|
+
(d) => `- ${d.name}${d.status && d.status !== "active" ? ` (${d.status})` : ""}`
|
|
342
|
+
).join("\n") : "(no hosts on this account)",
|
|
343
|
+
{ hosts: domains }
|
|
265
344
|
);
|
|
266
345
|
})
|
|
267
346
|
);
|
|
@@ -592,6 +671,415 @@ ${res.hint}` : ""
|
|
|
592
671
|
});
|
|
593
672
|
})
|
|
594
673
|
);
|
|
674
|
+
server.registerTool(
|
|
675
|
+
"roxyon_add_domain",
|
|
676
|
+
{
|
|
677
|
+
title: "Roxyon: add a subdomain / host",
|
|
678
|
+
description: "Provision a host \u2014 DNS + web server + automatic HTTPS. The host must be a subdomain of a domain the account already hosts (or a *.roxyon.com subdomain). Returns while it is still coming up; TLS follows a minute or two later. Needs confirm:true.",
|
|
679
|
+
inputSchema: {
|
|
680
|
+
host: z2.string().describe("The full hostname, e.g. promo.mycompany.com"),
|
|
681
|
+
subscription: z2.string().optional().describe("Which subscription to attach it to (omit if the account has one)."),
|
|
682
|
+
spa: z2.boolean().optional().describe("Single-page app: unmatched paths serve /index.html."),
|
|
683
|
+
phpVersion: z2.string().optional().describe(
|
|
684
|
+
'PHP version for the vhost, e.g. "8.3" (needed to run PHP apps like WordPress).'
|
|
685
|
+
),
|
|
686
|
+
confirm: z2.boolean().optional()
|
|
687
|
+
}
|
|
688
|
+
},
|
|
689
|
+
(args) => guard(async () => {
|
|
690
|
+
const session = await getSession();
|
|
691
|
+
if (!args.confirm) {
|
|
692
|
+
return text(
|
|
693
|
+
`Would provision ${args.host}${args.spa ? " (SPA routing)" : ""}. Pass confirm:true.`,
|
|
694
|
+
{ dryRun: true }
|
|
695
|
+
);
|
|
696
|
+
}
|
|
697
|
+
const res = await session.roxyon.domains.create({
|
|
698
|
+
host: args.host,
|
|
699
|
+
subscription: args.subscription ?? session.preferredSubscription,
|
|
700
|
+
siteType: args.spa ? "spa" : void 0,
|
|
701
|
+
phpVersion: args.phpVersion
|
|
702
|
+
});
|
|
703
|
+
const live = res.status === "active";
|
|
704
|
+
return text(
|
|
705
|
+
[
|
|
706
|
+
`${res.host} \u2014 ${res.type}, ${res.status}.`,
|
|
707
|
+
live ? "The host is up. HTTPS may take another minute to issue." : "DNS + web server are being set up (~1\u20132 min), then HTTPS. Check roxyon_list_domains, or just deploy now \u2014 files are kept and served once it is live."
|
|
708
|
+
].join("\n"),
|
|
709
|
+
{ ok: true, host: res.host, type: res.type, status: res.status }
|
|
710
|
+
);
|
|
711
|
+
})
|
|
712
|
+
);
|
|
713
|
+
server.registerTool(
|
|
714
|
+
"roxyon_deploy_content",
|
|
715
|
+
{
|
|
716
|
+
title: "Roxyon: deploy generated files",
|
|
717
|
+
description: [
|
|
718
|
+
"Publish a set of files you generated (HTML/CSS/JS/assets) to a host on the account.",
|
|
719
|
+
"The host must already exist (roxyon_add_domain, or an existing site). Overlay by",
|
|
720
|
+
"default \u2014 pass clean:true to replace the whole document root. Needs confirm:true.",
|
|
721
|
+
`Limits: ${MAX_FILES} files, ${MAX_FILE_BYTES / 1024 | 0} KB per file,`,
|
|
722
|
+
`${(MAX_TOTAL_BYTES / 1024 / 1024).toFixed(1)} MB total (base64-encode binaries).`
|
|
723
|
+
].join(" "),
|
|
724
|
+
inputSchema: {
|
|
725
|
+
host: z2.string().describe("Target host, e.g. promo.mycompany.com"),
|
|
726
|
+
folder: z2.string().optional().describe('Sub-path under the host; "" = site root.'),
|
|
727
|
+
files: z2.array(
|
|
728
|
+
z2.object({
|
|
729
|
+
path: z2.string().describe("Relative path, e.g. index.html, about/index.html"),
|
|
730
|
+
content: z2.string(),
|
|
731
|
+
encoding: z2.enum(["utf8", "base64"]).optional()
|
|
732
|
+
})
|
|
733
|
+
).min(1),
|
|
734
|
+
clean: z2.boolean().optional().describe("Replace the whole docroot (keeps .well-known)."),
|
|
735
|
+
spa: z2.boolean().optional().describe("Also flip the host to SPA routing."),
|
|
736
|
+
confirm: z2.boolean().optional()
|
|
737
|
+
}
|
|
738
|
+
},
|
|
739
|
+
(args) => guard(async () => {
|
|
740
|
+
const session = await getSession();
|
|
741
|
+
if (args.files.length > MAX_FILES) {
|
|
742
|
+
return errorResult(`Too many files (${args.files.length}); the limit is ${MAX_FILES}.`);
|
|
743
|
+
}
|
|
744
|
+
let total = 0;
|
|
745
|
+
for (const f of args.files) {
|
|
746
|
+
const n = Buffer.byteLength(f.content, f.encoding === "base64" ? "base64" : "utf8");
|
|
747
|
+
if (n > MAX_FILE_BYTES) {
|
|
748
|
+
return errorResult(
|
|
749
|
+
`"${f.path}" is ${n / 1024 | 0} KB; the per-file limit is ${MAX_FILE_BYTES / 1024 | 0} KB.`
|
|
750
|
+
);
|
|
751
|
+
}
|
|
752
|
+
total += n;
|
|
753
|
+
}
|
|
754
|
+
if (total > MAX_TOTAL_BYTES) {
|
|
755
|
+
return errorResult(
|
|
756
|
+
`Total content is ${(total / 1024 / 1024).toFixed(1)} MB; the limit is ${(MAX_TOTAL_BYTES / 1024 / 1024).toFixed(1)} MB. Deploy in parts or use the CLI.`
|
|
757
|
+
);
|
|
758
|
+
}
|
|
759
|
+
const folder = args.folder ?? "";
|
|
760
|
+
if (!args.confirm) {
|
|
761
|
+
return text(
|
|
762
|
+
[
|
|
763
|
+
"DRY RUN \u2014 pass confirm:true to deploy.",
|
|
764
|
+
"",
|
|
765
|
+
`Host: ${args.host}${folder ? `/${folder}` : ""}`,
|
|
766
|
+
`Files: ${args.files.length} (${total / 1024 | 0} KB)`,
|
|
767
|
+
`Mode: ${args.clean ? "clean (replaces the document root)" : "overlay"}${args.spa ? " + SPA routing" : ""}`,
|
|
768
|
+
...args.files.slice(0, 20).map((f) => ` ${f.path}`),
|
|
769
|
+
args.files.length > 20 ? ` \u2026 ${args.files.length - 20} more` : ""
|
|
770
|
+
].filter(Boolean).join("\n"),
|
|
771
|
+
{ dryRun: true }
|
|
772
|
+
);
|
|
773
|
+
}
|
|
774
|
+
const { buffer, files } = await packFiles(args.files, { maxBytes: MAX_TOTAL_BYTES });
|
|
775
|
+
const r = await session.roxyon.sites.deploy(args.host, folder, buffer, {
|
|
776
|
+
clean: args.clean,
|
|
777
|
+
spa: args.spa
|
|
778
|
+
});
|
|
779
|
+
const size = r.bytes ? ` (${r.bytes / 1024 | 0} KB)` : "";
|
|
780
|
+
const spaNote = args.spa ? "\nSPA routing enabled \u2014 deep links resolve to index.html." : "";
|
|
781
|
+
return text(
|
|
782
|
+
`\u2713 Deployed ${files.length} file(s) to https://${args.host}${folder ? `/${folder}` : ""}${size}.${spaNote}`,
|
|
783
|
+
{ ok: true, host: args.host, files: files.length }
|
|
784
|
+
);
|
|
785
|
+
})
|
|
786
|
+
);
|
|
787
|
+
server.registerTool(
|
|
788
|
+
"roxyon_list_files",
|
|
789
|
+
{
|
|
790
|
+
title: "Roxyon: list a site\u2019s files",
|
|
791
|
+
description: "The files currently deployed to a host's document root.",
|
|
792
|
+
inputSchema: {
|
|
793
|
+
host: z2.string(),
|
|
794
|
+
folder: z2.string().optional(),
|
|
795
|
+
path: z2.string().optional().describe("List under this sub-path only.")
|
|
796
|
+
}
|
|
797
|
+
},
|
|
798
|
+
(args) => guard(async () => {
|
|
799
|
+
const session = await getSession();
|
|
800
|
+
const files = await session.roxyon.sites.listFiles(
|
|
801
|
+
args.host,
|
|
802
|
+
args.folder ?? "",
|
|
803
|
+
args.path ?? ""
|
|
804
|
+
);
|
|
805
|
+
const body = files.length ? files.map(
|
|
806
|
+
(f) => `${f.type === "dir" ? "d" : "-"} ${String(f.size).padStart(8)} ${f.path}`
|
|
807
|
+
).join("\n") : "(empty)";
|
|
808
|
+
return text(body, { files });
|
|
809
|
+
})
|
|
810
|
+
);
|
|
811
|
+
server.registerTool(
|
|
812
|
+
"roxyon_read_file",
|
|
813
|
+
{
|
|
814
|
+
title: "Roxyon: read a site file",
|
|
815
|
+
description: "Read one file from a host's document root (to review or edit it).",
|
|
816
|
+
inputSchema: {
|
|
817
|
+
host: z2.string(),
|
|
818
|
+
folder: z2.string().optional(),
|
|
819
|
+
path: z2.string().describe("Relative path, e.g. index.html")
|
|
820
|
+
}
|
|
821
|
+
},
|
|
822
|
+
(args) => guard(async () => {
|
|
823
|
+
const session = await getSession();
|
|
824
|
+
const f = await session.roxyon.sites.readFile(args.host, args.folder ?? "", args.path);
|
|
825
|
+
if (f.encoding === "base64") {
|
|
826
|
+
return text(
|
|
827
|
+
`${f.path} \u2014 ${f.size} bytes, binary (base64):
|
|
828
|
+
|
|
829
|
+
${f.content.slice(0, 4096)}`,
|
|
830
|
+
{ path: f.path, size: f.size, encoding: "base64" }
|
|
831
|
+
);
|
|
832
|
+
}
|
|
833
|
+
return text(f.content, { path: f.path, size: f.size, encoding: "utf8" });
|
|
834
|
+
})
|
|
835
|
+
);
|
|
836
|
+
server.registerTool(
|
|
837
|
+
"roxyon_database_create",
|
|
838
|
+
{
|
|
839
|
+
title: "Roxyon: create a database",
|
|
840
|
+
description: `Provision a MySQL/MariaDB database + user. The name is prefixed with the account's own username (globally unique across the shared cluster) \u2014 pass just the suffix, e.g. "wordpress". The password is shown once in the result; there is no way to retrieve it later. Needs confirm:true.`,
|
|
841
|
+
inputSchema: {
|
|
842
|
+
name: z2.string().describe("DB name suffix: lowercase letters, digits, underscore."),
|
|
843
|
+
subscription: z2.string().optional(),
|
|
844
|
+
password: z2.string().optional().describe("Omit to have Roxyon generate one."),
|
|
845
|
+
confirm: z2.boolean().optional()
|
|
846
|
+
}
|
|
847
|
+
},
|
|
848
|
+
(args) => guard(async () => {
|
|
849
|
+
const session = await getSession();
|
|
850
|
+
if (!args.confirm) {
|
|
851
|
+
return text(`Would create database "${args.name}". Pass confirm:true.`, { dryRun: true });
|
|
852
|
+
}
|
|
853
|
+
const r = await session.roxyon.databases.create({
|
|
854
|
+
name: args.name,
|
|
855
|
+
subscription: args.subscription ?? session.preferredSubscription,
|
|
856
|
+
password: args.password
|
|
857
|
+
});
|
|
858
|
+
const body = [
|
|
859
|
+
`${r.status === "active" ? "\u2713" : "\xBB"} Database ${r.name} (user ${r.username}) \u2014 ${r.status}.`,
|
|
860
|
+
r.password ? `
|
|
861
|
+
Password (save this now \u2014 shown once):
|
|
862
|
+
${r.password}` : "",
|
|
863
|
+
r.host ? `Host: ${r.host}` : ""
|
|
864
|
+
].filter(Boolean).join("\n");
|
|
865
|
+
return text(body, {
|
|
866
|
+
ok: true,
|
|
867
|
+
objectId: r.objectId,
|
|
868
|
+
name: r.name,
|
|
869
|
+
username: r.username,
|
|
870
|
+
host: r.host,
|
|
871
|
+
status: r.status
|
|
872
|
+
});
|
|
873
|
+
})
|
|
874
|
+
);
|
|
875
|
+
server.registerTool(
|
|
876
|
+
"roxyon_list_databases",
|
|
877
|
+
{
|
|
878
|
+
title: "Roxyon: list databases",
|
|
879
|
+
description: "Databases on the active subscription.",
|
|
880
|
+
inputSchema: { subscription: z2.string().optional() }
|
|
881
|
+
},
|
|
882
|
+
(args) => guard(async () => {
|
|
883
|
+
const session = await getSession();
|
|
884
|
+
const subscription = args.subscription ?? session.preferredSubscription;
|
|
885
|
+
if (!subscription) return errorResult('No subscription \u2014 pass "subscription".');
|
|
886
|
+
const rows = await session.roxyon.databases.list(subscription);
|
|
887
|
+
const body = rows.length ? rows.map((d) => `- ${d.Name} [${d.objectId}] \u2014 ${d.Status} (user ${d.Username})`).join("\n") : "(no databases)";
|
|
888
|
+
return text(body, { databases: rows });
|
|
889
|
+
})
|
|
890
|
+
);
|
|
891
|
+
server.registerTool(
|
|
892
|
+
"roxyon_database_delete",
|
|
893
|
+
{
|
|
894
|
+
title: "Roxyon: delete a database",
|
|
895
|
+
description: "Delete a database by its objectId (from roxyon_database_create/roxyon_list_databases). Needs confirm:true.",
|
|
896
|
+
inputSchema: { database: z2.string(), confirm: z2.boolean().optional() }
|
|
897
|
+
},
|
|
898
|
+
(args) => guard(async () => {
|
|
899
|
+
const session = await getSession();
|
|
900
|
+
if (!args.confirm) {
|
|
901
|
+
return text(`Would delete database ${args.database}. Pass confirm:true.`, {
|
|
902
|
+
dryRun: true
|
|
903
|
+
});
|
|
904
|
+
}
|
|
905
|
+
const r = await session.roxyon.databases.delete(args.database);
|
|
906
|
+
return text(`Database ${args.database} \u2014 ${r.status}.`, { ok: true, status: r.status });
|
|
907
|
+
})
|
|
908
|
+
);
|
|
909
|
+
server.registerTool(
|
|
910
|
+
"roxyon_email_create",
|
|
911
|
+
{
|
|
912
|
+
title: "Roxyon: create a mailbox",
|
|
913
|
+
description: "Provision a mailbox on a host already on the account. The password is shown once in the result; there is no way to retrieve it later. Needs confirm:true.",
|
|
914
|
+
inputSchema: {
|
|
915
|
+
localPart: z2.string().describe('The part before @, e.g. "info".'),
|
|
916
|
+
domain: z2.string().describe("A hostname already on the account."),
|
|
917
|
+
password: z2.string().optional().describe("Omit to have Roxyon generate one."),
|
|
918
|
+
quota: z2.number().int().positive().optional().describe("Quota in MB (default 1024)."),
|
|
919
|
+
forwardTo: z2.string().optional(),
|
|
920
|
+
saveCopy: z2.boolean().optional(),
|
|
921
|
+
confirm: z2.boolean().optional()
|
|
922
|
+
}
|
|
923
|
+
},
|
|
924
|
+
(args) => guard(async () => {
|
|
925
|
+
const session = await getSession();
|
|
926
|
+
const email = `${args.localPart}@${args.domain}`;
|
|
927
|
+
if (!args.confirm) {
|
|
928
|
+
return text(`Would create mailbox ${email}. Pass confirm:true.`, { dryRun: true });
|
|
929
|
+
}
|
|
930
|
+
const r = await session.roxyon.email.create({
|
|
931
|
+
localPart: args.localPart,
|
|
932
|
+
domain: args.domain,
|
|
933
|
+
password: args.password,
|
|
934
|
+
quota: args.quota,
|
|
935
|
+
forwardTo: args.forwardTo,
|
|
936
|
+
saveCopy: args.saveCopy
|
|
937
|
+
});
|
|
938
|
+
const body = [
|
|
939
|
+
`${r.status === "active" ? "\u2713" : "\xBB"} Mailbox ${r.email} \u2014 ${r.status}.`,
|
|
940
|
+
r.password ? `
|
|
941
|
+
Password (save this now \u2014 shown once):
|
|
942
|
+
${r.password}` : ""
|
|
943
|
+
].filter(Boolean).join("\n");
|
|
944
|
+
return text(body, { ok: true, objectId: r.objectId, email: r.email, status: r.status });
|
|
945
|
+
})
|
|
946
|
+
);
|
|
947
|
+
server.registerTool(
|
|
948
|
+
"roxyon_list_emails",
|
|
949
|
+
{
|
|
950
|
+
title: "Roxyon: list mailboxes",
|
|
951
|
+
description: "Mailboxes on the active subscription.",
|
|
952
|
+
inputSchema: { subscription: z2.string().optional() }
|
|
953
|
+
},
|
|
954
|
+
(args) => guard(async () => {
|
|
955
|
+
const session = await getSession();
|
|
956
|
+
const subscription = args.subscription ?? session.preferredSubscription;
|
|
957
|
+
if (!subscription) return errorResult('No subscription \u2014 pass "subscription".');
|
|
958
|
+
const rows = await session.roxyon.email.list(subscription);
|
|
959
|
+
const body = rows.length ? rows.map((e) => `- ${e.Email} [${e.objectId}] \u2014 ${e.Status}`).join("\n") : "(no mailboxes)";
|
|
960
|
+
return text(body, { emails: rows });
|
|
961
|
+
})
|
|
962
|
+
);
|
|
963
|
+
server.registerTool(
|
|
964
|
+
"roxyon_email_delete",
|
|
965
|
+
{
|
|
966
|
+
title: "Roxyon: delete a mailbox",
|
|
967
|
+
description: "Delete a mailbox by its objectId (from roxyon_email_create/roxyon_list_emails). Needs confirm:true.",
|
|
968
|
+
inputSchema: { email: z2.string(), confirm: z2.boolean().optional() }
|
|
969
|
+
},
|
|
970
|
+
(args) => guard(async () => {
|
|
971
|
+
const session = await getSession();
|
|
972
|
+
if (!args.confirm) {
|
|
973
|
+
return text(`Would delete mailbox ${args.email}. Pass confirm:true.`, { dryRun: true });
|
|
974
|
+
}
|
|
975
|
+
const r = await session.roxyon.email.delete(args.email);
|
|
976
|
+
return text(`Mailbox ${args.email} \u2014 ${r.status}.`, { ok: true, status: r.status });
|
|
977
|
+
})
|
|
978
|
+
);
|
|
979
|
+
server.registerTool(
|
|
980
|
+
"roxyon_ssh_reset_password",
|
|
981
|
+
{
|
|
982
|
+
title: "Roxyon: reset the SSH/SFTP password",
|
|
983
|
+
description: "Reset a subscription's shell password \u2014 used for SSH, SFTP, and the file manager. Changing it signs out anything using the old one. The password is shown once in the result; the platform never stores or re-shows it. Needs confirm:true.",
|
|
984
|
+
inputSchema: {
|
|
985
|
+
subscription: z2.string().optional(),
|
|
986
|
+
password: z2.string().optional().describe("Omit to have Roxyon generate one (12+ chars, mixed case, number, symbol)."),
|
|
987
|
+
confirm: z2.boolean().optional()
|
|
988
|
+
}
|
|
989
|
+
},
|
|
990
|
+
(args) => guard(async () => {
|
|
991
|
+
const session = await getSession();
|
|
992
|
+
if (!args.confirm) {
|
|
993
|
+
return text("Would reset the SSH/SFTP password. Pass confirm:true.", { dryRun: true });
|
|
994
|
+
}
|
|
995
|
+
const r = await session.roxyon.ssh.resetPassword({
|
|
996
|
+
subscription: args.subscription ?? session.preferredSubscription,
|
|
997
|
+
password: args.password
|
|
998
|
+
});
|
|
999
|
+
return text(
|
|
1000
|
+
`${r.status === "active" ? "\u2713" : "\xBB"} SSH/SFTP password ${r.status === "active" ? "changed" : "change queued"}.
|
|
1001
|
+
|
|
1002
|
+
Password (save this now \u2014 shown once):
|
|
1003
|
+
${r.password}`,
|
|
1004
|
+
{ ok: true, subscription: r.subscription, status: r.status }
|
|
1005
|
+
);
|
|
1006
|
+
})
|
|
1007
|
+
);
|
|
1008
|
+
server.registerTool(
|
|
1009
|
+
"roxyon_install_wordpress",
|
|
1010
|
+
{
|
|
1011
|
+
title: "Roxyon: install WordPress",
|
|
1012
|
+
description: [
|
|
1013
|
+
"One-shot recipe: create a subdomain (if it does not already exist), provision a database",
|
|
1014
|
+
"for it, download WordPress core, and deploy it. v1 scope \u2014 core only, no plugin/theme",
|
|
1015
|
+
"selection, single site. Local-only (needs your filesystem to unpack WordPress into) \u2014 run",
|
|
1016
|
+
"this from the CLI-backed MCP, not the hosted mcp.roxyon.com connector. Needs confirm:true."
|
|
1017
|
+
].join(" "),
|
|
1018
|
+
inputSchema: {
|
|
1019
|
+
host: z2.string().describe("The site host, e.g. blog.mycompany.com \u2014 created if it does not exist."),
|
|
1020
|
+
folder: z2.string().optional().describe('Sub-path under the host; "" = site root (recommended).'),
|
|
1021
|
+
subscription: z2.string().optional(),
|
|
1022
|
+
dbName: z2.string().optional().describe(
|
|
1023
|
+
"Database name suffix (default derived from the host). See roxyon_database_create."
|
|
1024
|
+
),
|
|
1025
|
+
phpVersion: z2.string().optional().describe('Default "8.3".'),
|
|
1026
|
+
confirm: z2.boolean().optional()
|
|
1027
|
+
}
|
|
1028
|
+
},
|
|
1029
|
+
(args) => guard(async () => {
|
|
1030
|
+
const blocked = remoteFilesystemBlock("roxyon_install_wordpress");
|
|
1031
|
+
if (blocked) return blocked;
|
|
1032
|
+
const session = await getSession();
|
|
1033
|
+
const folder = args.folder ?? "";
|
|
1034
|
+
const dbSuffix = (args.dbName ?? args.host.split(".")[0] ?? "wordpress").toLowerCase().replace(/[^a-z0-9_]/g, "_").replace(/^[^a-z]+/, "").slice(0, 20) || "wordpress";
|
|
1035
|
+
if (!args.confirm) {
|
|
1036
|
+
return text(
|
|
1037
|
+
[
|
|
1038
|
+
"DRY RUN \u2014 pass confirm:true to install.",
|
|
1039
|
+
"",
|
|
1040
|
+
`Host: ${args.host}${folder ? `/${folder}` : ""} (created if missing)`,
|
|
1041
|
+
`Database: ${dbSuffix} (prefixed with your account username)`,
|
|
1042
|
+
"Steps: add domain -> create database -> download WordPress core -> upload"
|
|
1043
|
+
].join("\n"),
|
|
1044
|
+
{ dryRun: true }
|
|
1045
|
+
);
|
|
1046
|
+
}
|
|
1047
|
+
const subscription = args.subscription ?? session.preferredSubscription;
|
|
1048
|
+
const domain = await session.roxyon.domains.create({
|
|
1049
|
+
host: args.host,
|
|
1050
|
+
subscription,
|
|
1051
|
+
phpVersion: args.phpVersion ?? "8.3"
|
|
1052
|
+
});
|
|
1053
|
+
if (domain.status === "failed") {
|
|
1054
|
+
return errorResult(
|
|
1055
|
+
`Could not provision ${args.host}: ${domain.error ?? "unknown error"}`
|
|
1056
|
+
);
|
|
1057
|
+
}
|
|
1058
|
+
const db = await session.roxyon.databases.create({ name: dbSuffix, subscription });
|
|
1059
|
+
if (db.status === "failed" || !db.password || !db.host) {
|
|
1060
|
+
return errorResult(`Could not provision the database: ${db.error ?? "unknown error"}`);
|
|
1061
|
+
}
|
|
1062
|
+
const scratchDir = await mkdtemp(join2(tmpdir(), "roxyon-wp-"));
|
|
1063
|
+
await installWordPress({
|
|
1064
|
+
dir: scratchDir,
|
|
1065
|
+
db: { name: db.name, username: db.username, password: db.password, host: db.host }
|
|
1066
|
+
});
|
|
1067
|
+
const pack = await packDirectory(scratchDir);
|
|
1068
|
+
const deployRes = await session.roxyon.sites.deploy(args.host, folder, pack.buffer);
|
|
1069
|
+
const url = `https://${deployRes.host}${deployRes.path && deployRes.path !== "/" ? deployRes.path : ""}`;
|
|
1070
|
+
return text(
|
|
1071
|
+
[
|
|
1072
|
+
`\u2713 WordPress installed at ${url} (${pack.files.length} files).`,
|
|
1073
|
+
"Visit the site to finish setup (site title, admin account) \u2014 WordPress asks for these",
|
|
1074
|
+
"on first load.",
|
|
1075
|
+
"",
|
|
1076
|
+
`Database: ${db.name} / ${db.username} \u2014 password shown once, save it now:`,
|
|
1077
|
+
db.password
|
|
1078
|
+
].join("\n"),
|
|
1079
|
+
{ ok: true, url, database: { name: db.name, username: db.username } }
|
|
1080
|
+
);
|
|
1081
|
+
})
|
|
1082
|
+
);
|
|
595
1083
|
}
|
|
596
1084
|
|
|
597
1085
|
// src/server.ts
|
|
@@ -616,4 +1104,4 @@ export {
|
|
|
616
1104
|
SERVER_VERSION,
|
|
617
1105
|
createServer
|
|
618
1106
|
};
|
|
619
|
-
//# sourceMappingURL=chunk-
|
|
1107
|
+
//# sourceMappingURL=chunk-HMGCNPGW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/server.ts","../src/prompts.ts","../src/resources.ts","../src/tools.ts","../src/context.ts","../src/session.ts","../src/result.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { registerPrompts } from './prompts.js';\nimport { registerResources } from './resources.js';\nimport { registerTools } from './tools.js';\n\nexport const SERVER_NAME = 'roxyon';\nexport const SERVER_VERSION: string = (\n createRequire(import.meta.url)('../package.json') as { version: string }\n).version;\n\n/** Build the Roxyon MCP server with every tool, resource and prompt registered. */\nexport function createServer(): McpServer {\n const server = new McpServer(\n { name: SERVER_NAME, version: SERVER_VERSION },\n {\n instructions:\n 'Roxyon lets you build LumenJS SPAs, use the Roxyon BaaS, and deploy apps and web ' +\n 'projects to Roxyon infrastructure. Read the roxyon://docs/* resources before writing ' +\n 'LumenJS or calling the BaaS. To deploy: roxyon_init once per project, then roxyon_deploy ' +\n '(dry run, then confirm:true). Side-effecting tools require confirm:true.',\n },\n );\n\n registerResources(server);\n registerPrompts(server);\n registerTools(server);\n return server;\n}\n","import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { z } from 'zod';\n\nexport function registerPrompts(server: McpServer): void {\n server.registerPrompt(\n 'scaffold-lumen-app',\n {\n title: 'Scaffold a LumenJS + Roxyon app',\n description:\n 'Guidance for creating a new LumenJS SPA wired to the Roxyon BaaS and ready to deploy.',\n argsSchema: {\n idea: z.string().describe('What the app should do.'),\n dir: z.string().optional().describe('Where to create it.'),\n },\n },\n ({ idea, dir }) => ({\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Build a LumenJS single-page app: ${idea}\\n\\nSteps:\\n1. Read the \"roxyon://docs/lumenjs\" resource — follow V1 rules exactly (one bind per region, no nested bind, build option lists in JS not :for, check every BaaS write for an error field).\\n2. Read \"roxyon://docs/baas\" for the data/auth API.\\n3. Scaffold with the LumenJS CLI: \\`lm create <name>\\`${dir ? ` in ${dir}` : ''}. Put views under src/views/, wire the BaaS in src/index.js via config.json.\\n4. When it runs locally (\\`lm serve\\`), call roxyon_init then roxyon_deploy (dry run first, then confirm:true).`,\n },\n },\n ],\n }),\n );\n\n server.registerPrompt(\n 'build-and-ship-site',\n {\n title: 'Build a site and host it on Roxyon',\n description:\n 'Generate a static site (or no-build LumenJS SPA) in the conversation and publish it to ' +\n 'a Roxyon host — for the hosted connector, no local files.',\n argsSchema: {\n brief: z.string().describe('What the site should be.'),\n host: z.string().describe('Where to host it, e.g. promo.mycompany.com'),\n },\n },\n ({ brief, host }) => ({\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Build and publish a website to ${host}.\\n\\nBrief: ${brief}\\n\\n1. Read \"roxyon://docs/recipe\" and follow it. (Read \"roxyon://docs/lumenjs\" too only if the site needs reactivity.)\\n2. If ${host} is not already on the account, roxyon_add_domain { host: \"${host}\", confirm: true } (add spa:true only for a real single-page app).\\n3. Generate the site — self-contained static files, relative paths, real .html per page or <page>/index.html, ≤60 files / 2 MB.\\n4. roxyon_deploy_content { host: \"${host}\", files: [...], clean: true, confirm: true } (dry-run first).\\n5. roxyon_list_files { host: \"${host}\" } to verify, then give me the URL. Note that HTTPS may take a couple of minutes on a brand-new host.`,\n },\n },\n ],\n }),\n );\n\n server.registerPrompt(\n 'install-wordpress',\n {\n title: 'Install WordPress on Roxyon',\n description: 'Provision a host + database and install WordPress core — local/CLI MCP only.',\n argsSchema: {\n host: z.string().describe('Where to install it, e.g. blog.mycompany.com'),\n },\n },\n ({ host }) => ({\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Install WordPress on ${host}.\\n\\n1. Read \"roxyon://docs/recipe-wordpress\" and follow it.\\n2. Call roxyon_install_wordpress { host: \"${host}\" } first without confirm to see the plan.\\n3. If it looks right, call it again with confirm:true.\\n4. Report the site URL and the database credentials (shown once — pass them on to me now), and tell me to visit the URL to finish WordPress's own setup wizard (site title, admin account).`,\n },\n },\n ],\n }),\n );\n\n server.registerPrompt(\n 'deploy-to-roxyon',\n {\n title: 'Deploy this project to Roxyon',\n description: 'Walk through deploying the current project to Roxyon infrastructure.',\n argsSchema: { dir: z.string().describe('Absolute path to the project.') },\n },\n ({ dir }) => ({\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Deploy the project at ${dir} to Roxyon.\\n\\n1. If there is no roxyon.json, call roxyon_init (it detects the runtime; ask me which host if there are several).\\n2. Call roxyon_deploy with just the dir first to see the plan.\\n3. If the plan looks right, call roxyon_deploy again with confirm:true.\\n4. For an app runtime, report the final status and, if it failed, the last error from roxyon_app_status.`,\n },\n },\n ],\n }),\n );\n}\n","import { readFile } from 'node:fs/promises';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\n\nconst RESOURCE_DIR = join(dirname(fileURLToPath(import.meta.url)), '..', 'resources');\n\ninterface Doc {\n uri: string;\n name: string;\n file: string;\n title: string;\n description: string;\n}\n\nconst DOCS: Doc[] = [\n {\n uri: 'roxyon://docs/lumenjs',\n name: 'lumenjs-reference',\n file: 'lumenjs.md',\n title: 'LumenJS — complete reference',\n description:\n 'Full LumenJS V1 reference for building SPAs with vanilla JS/HTML/CSS (no build step), ' +\n 'contrasted with Vue/React. Read before writing .view files.',\n },\n {\n uri: 'roxyon://docs/baas',\n name: 'baas-reference',\n file: 'baas.md',\n title: 'Roxyon BaaS reference',\n description:\n 'The Roxyon Backend-as-a-Service REST API: endpoints, auth flow, query rules, and the ' +\n 'resolve-on-failure write behaviour.',\n },\n {\n uri: 'roxyon://docs/deploy',\n name: 'deploy-reference',\n file: 'deploy.md',\n title: 'Deploying to Roxyon',\n description:\n 'How roxyon_init / roxyon_deploy work, the roxyon.json schema, static vs app deploys, env ' +\n 'vars, and git push-to-deploy.',\n },\n {\n uri: 'roxyon://docs/recipe',\n name: 'web-deploy-recipe',\n file: 'recipe-web-deploy.md',\n title: 'Recipe — build a site and host it',\n description:\n 'The end-to-end flow for \"build a landing page and put it on sub.mydomain.com\" over the ' +\n 'hosted connector: roxyon_add_domain → roxyon_deploy_content → roxyon_list_files.',\n },\n {\n uri: 'roxyon://docs/recipe-wordpress',\n name: 'wordpress-recipe',\n file: 'recipe-wordpress.md',\n title: 'Recipe — install WordPress',\n description:\n 'The end-to-end flow for \"put WordPress on sub.mydomain.com\": roxyon_install_wordpress ' +\n '(host + database + WordPress core, one call). Local/CLI-backed MCP only.',\n },\n];\n\nexport function registerResources(server: McpServer): void {\n for (const doc of DOCS) {\n server.registerResource(\n doc.name,\n doc.uri,\n { title: doc.title, description: doc.description, mimeType: 'text/markdown' },\n async () => {\n const body = await readFile(join(RESOURCE_DIR, doc.file), 'utf8');\n return { contents: [{ uri: doc.uri, mimeType: 'text/markdown', text: body }] };\n },\n );\n }\n}\n","import { mkdtemp } from 'node:fs/promises';\nimport { tmpdir } from 'node:os';\nimport { join } from 'node:path';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { type Roxyon, envFromStored, formatEnv } from '@roxyon/api-client';\nimport {\n buildIgnore,\n buildProjectConfig,\n deployProject,\n detectRuntime,\n installWordPress,\n listFiles,\n loadProjectConfig,\n packDirectory,\n packFiles,\n saveProjectConfig,\n} from '@roxyon/deploy-core';\nimport { z } from 'zod';\nimport { currentContext } from './context.js';\nimport { type ToolResult, errorResult, guard, text } from './result.js';\nimport { type RoxyonSession, getSession } from './session.js';\n\n/** `roxyon_deploy_content` budget — keeps the whole JSON-RPC body under the 4 MB cap. */\nconst MAX_FILES = 60;\nconst MAX_FILE_BYTES = 1024 * 1024;\nconst MAX_TOTAL_BYTES = 2 * 1024 * 1024;\n\n/**\n * `roxyon_init` / `roxyon_deploy` read and write the caller's local project\n * directory — impossible over the remote HTTP server. Returns an explanatory\n * result when running in that mode, `null` otherwise (proceed).\n */\nfunction remoteFilesystemBlock(\n tool: 'roxyon_init' | 'roxyon_deploy' | 'roxyon_install_wordpress',\n): ToolResult | null {\n if (!currentContext().remote) return null;\n return errorResult(\n [\n `${tool} needs access to your local project files, which the hosted Roxyon MCP`,\n 'server does not have. Either:',\n ' • run the `roxyon` CLI locally (`npm i -g @roxyon/cli`, then `roxyon deploy`), or',\n ' • use `roxyon_link_github` to connect a git repo for push-to-deploy, then',\n ' `roxyon_app_status` / `roxyon_logs` to watch it here.',\n ].join('\\n'),\n );\n}\n\n/** Resolve an application id from an explicit id or a project directory. */\nasync function resolveApp(args: { application?: string; dir?: string }): Promise<{\n applicationId: string;\n host?: string;\n}> {\n if (args.application) return { applicationId: args.application };\n if (args.dir) {\n const cfg = await loadProjectConfig(args.dir);\n if (cfg?.application) return { applicationId: cfg.application, host: cfg.host };\n throw new Error(\n `No application linked in ${args.dir}/roxyon.json. Deploy it once (roxyon_deploy) or pass \"application\".`,\n );\n }\n throw new Error('Pass either \"application\" (an id) or \"dir\" (a project directory).');\n}\n\n/** The account context (user + subscriptions + domains) — one call, PAT-safe. */\nfunction accountContext(session: RoxyonSession) {\n return session.roxyon.account.context();\n}\n\nexport function registerTools(server: McpServer): void {\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_whoami',\n {\n title: 'Roxyon: who am I',\n description: 'Show the signed-in Roxyon user and their subscriptions (which one is active).',\n inputSchema: {},\n },\n () =>\n guard(async () => {\n const session = await getSession();\n const ctx = await accountContext(session);\n const lines = [\n `User: ${ctx.user.email || ctx.user.id} (${ctx.user.id})`,\n `Auth: ${session.source}${ctx.scopes.length ? ` (scopes: ${ctx.scopes.join(', ')})` : ''}`,\n '',\n 'Subscriptions:',\n ...ctx.subscriptions.map((s) => ` ${s.name || s.id} — ${s.status || '?'}`),\n '',\n `Hosts: ${ctx.domains.map((d) => d.name).join(', ') || '(none)'}`,\n ];\n return text(lines.join('\\n'), {\n user: ctx.user,\n scopes: ctx.scopes,\n subscriptions: ctx.subscriptions,\n hosts: ctx.domains.map((d) => d.name),\n });\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_list_domains',\n {\n title: 'Roxyon: list hosts',\n description:\n 'List the domains (hosts) on the active subscription — the possible deploy targets.',\n inputSchema: {},\n },\n () =>\n guard(async () => {\n const session = await getSession();\n const { domains } = await accountContext(session);\n return text(\n domains.length\n ? domains\n .map(\n (d) => `- ${d.name}${d.status && d.status !== 'active' ? ` (${d.status})` : ''}`,\n )\n .join('\\n')\n : '(no hosts on this account)',\n { hosts: domains },\n );\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_list_apps',\n {\n title: 'Roxyon: list applications',\n description:\n 'List the applications on the active subscription with their status and revision.',\n inputSchema: {},\n },\n () =>\n guard(async () => {\n const session = await getSession();\n const apps = await session.roxyon.account.apps();\n const body = apps.length\n ? apps\n .map(\n (a) =>\n `- ${a.name} [${a.id}] — ${a.status || '?'} ` +\n `(rev ${a.appliedRevision}/${a.configRevision})` +\n `${a.repo ? ` · git:${a.repo.branch}` : ''}`,\n )\n .join('\\n')\n : '(no applications)';\n return text(body, { applications: apps });\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_init',\n {\n title: 'Roxyon: initialise a project',\n description:\n \"Detect a project's type and write roxyon.json. Run this once per project before roxyon_deploy. \" +\n 'Does not create anything on the platform.',\n inputSchema: {\n dir: z.string().describe('Absolute path to the project directory.'),\n runtime: z.enum(['lumen', 'node', 'python', 'php']).optional(),\n host: z.string().optional().describe('Deploy host (a domain on the subscription).'),\n folder: z.string().optional().describe('Sub-path under the host; \"\" = site root.'),\n overwrite: z.boolean().optional().describe('Replace an existing roxyon.json.'),\n },\n },\n (args) =>\n guard(async () => {\n const blocked = remoteFilesystemBlock('roxyon_init');\n if (blocked) return blocked;\n const session = await getSession();\n const existing = await loadProjectConfig(args.dir);\n if (existing && !args.overwrite) {\n return errorResult(\n `roxyon.json already exists in ${args.dir}. Pass overwrite:true to replace it.`,\n { config: existing },\n );\n }\n const { domains } = await accountContext(session);\n if (domains.length === 0) {\n return errorResult(\n 'This account has no hosts. Add a domain in the Roxyon console first.',\n );\n }\n const detected = await detectRuntime(args.dir);\n const runtime = args.runtime ?? detected.runtime;\n const host = args.host ?? domains[0]!.name;\n if (!domains.some((d) => d.name === host)) {\n return errorResult(\n `Host \"${host}\" is not on this account (have: ${domains.map((d) => d.name).join(', ')}).`,\n );\n }\n const config = buildProjectConfig({\n cwd: args.dir,\n runtime,\n host,\n folder: args.folder,\n start: detected.start,\n });\n const path = await saveProjectConfig(config, args.dir);\n return text(\n `Wrote ${path}\\nDetected: ${detected.runtime} (${detected.reason})\\n\\n${JSON.stringify(config, null, 2)}`,\n { path, detected: detected.runtime, config },\n );\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_deploy',\n {\n title: 'Roxyon: deploy a project',\n description:\n 'Build (if configured) and deploy the project in \"dir\" to Roxyon. Without confirm:true this ' +\n 'returns a dry-run plan (what would build, where it would go, how many files). With confirm:true ' +\n 'it runs the build, uploads, and — for app runtimes — waits for it to go live. Requires roxyon.json ' +\n '(run roxyon_init first).',\n inputSchema: {\n dir: z\n .string()\n .describe('Absolute path to the project directory (must contain roxyon.json).'),\n confirm: z.boolean().optional().describe('Actually deploy. Omit for a dry-run plan.'),\n build: z.boolean().optional().describe('Run the configured build command (default true).'),\n follow: z\n .boolean()\n .optional()\n .describe('For app runtimes, wait until running/failed (default true).'),\n },\n },\n (args) =>\n guard(async () => {\n const blocked = remoteFilesystemBlock('roxyon_deploy');\n if (blocked) return blocked;\n const session = await getSession();\n const config = await loadProjectConfig(args.dir);\n if (!config) {\n return errorResult(`No roxyon.json in ${args.dir}. Run roxyon_init first.`);\n }\n\n if (!args.confirm) {\n const ig = await buildIgnore(args.dir);\n const packRoot =\n config.kind === 'static' && config.outDir ? `${args.dir}/${config.outDir}` : args.dir;\n let files: string[] = [];\n try {\n files = await listFiles(packRoot, ig);\n } catch {\n /* outDir may not exist until the build runs */\n }\n const plan = [\n 'DRY RUN — pass confirm:true to deploy.',\n '',\n `Project: ${config.name} (${config.runtime}, ${config.kind})`,\n `Target: ${config.host}${config.folder ? `/${config.folder}` : ''}`,\n config.build ? `Build: ${config.build}` : 'Build: (none)',\n config.kind === 'app'\n ? `App: ${config.application ?? '(created on first deploy)'}`\n : 'Serve: static files from the host document root',\n files.length\n ? `Would pack ${files.length} file(s) from ${config.kind === 'static' && config.outDir ? config.outDir : '.'}`\n : `Would pack the build output (${config.outDir ?? 'dist'}) after building`,\n ].join('\\n');\n return text(plan, { dryRun: true, config });\n }\n\n const logLines: string[] = [];\n const outcome = await deployProject({\n cwd: args.dir,\n roxyon: session.roxyon,\n preferredSubscription: session.preferredSubscription,\n build: args.build,\n follow: args.follow ?? true,\n timeoutMs: 5 * 60 * 1000,\n reporter: {\n step: (m) => logLines.push(`» ${m}`),\n log: (l) => logLines.push(` ${l}`),\n },\n });\n\n const tail = logLines.slice(-60).join('\\n');\n if (outcome.kind === 'static' && outcome.ok) {\n return text(`${tail}\\n\\n✓ Live: ${outcome.url} (${outcome.files} files)`, {\n ok: true,\n kind: 'static',\n url: outcome.url,\n });\n }\n if (outcome.kind === 'app' && outcome.ok) {\n return text(\n `${tail}\\n\\n✓ ${outcome.status === 'running' ? `Live: ${outcome.url ?? outcome.application}` : `Build queued (revision ${outcome.revision})`}`,\n {\n ok: true,\n kind: 'app',\n application: outcome.application,\n status: outcome.status,\n url: outcome.url,\n },\n );\n }\n return errorResult(\n `${tail}\\n\\n✗ Deploy failed: ${'error' in outcome ? outcome.error : 'unknown'}`,\n { ok: false, application: 'application' in outcome ? outcome.application : undefined },\n );\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_app_status',\n {\n title: 'Roxyon: application status',\n description:\n 'Current status, revisions and last error for an application (by id or project dir).',\n inputSchema: {\n application: z.string().optional(),\n dir: z\n .string()\n .optional()\n .describe('A project directory whose roxyon.json links an application.'),\n },\n },\n (args) =>\n guard(async () => {\n const session = await getSession();\n const { applicationId } = await resolveApp(args);\n const app = await session.roxyon.account.getApp(applicationId);\n if (!app) return errorResult(`Application ${applicationId} not found.`);\n const settled = app.configRevision <= app.appliedRevision;\n const body = [\n `${app.name} [${app.id}]`,\n `Status: ${app.status || '?'}${settled ? '' : ' (applying)'}`,\n `Revision: ${app.appliedRevision} / ${app.configRevision}`,\n `Runtime: ${app.runtime}`.trim(),\n app.lastError ? `\\nLast error:\\n${app.lastError}` : '',\n ]\n .filter(Boolean)\n .join('\\n');\n return text(body, {\n id: app.id,\n status: app.status,\n settled,\n configRevision: app.configRevision,\n appliedRevision: app.appliedRevision,\n lastError: app.lastError || undefined,\n });\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_logs',\n {\n title: 'Roxyon: application logs',\n description: 'Recent journal lines for an application (by id or project dir).',\n inputSchema: {\n application: z.string().optional(),\n dir: z.string().optional(),\n lines: z\n .number()\n .int()\n .min(1)\n .max(1000)\n .optional()\n .describe('How many lines (default 100).'),\n },\n },\n (args) =>\n guard(async () => {\n const session = await getSession();\n const { applicationId } = await resolveApp(args);\n const lines = await session.roxyon.applications.logs(applicationId, args.lines ?? 100);\n return text(lines.join('\\n') || '(no log lines)', { lines });\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_restart',\n {\n title: 'Roxyon: restart an application',\n description: 'Bounce the application process (no rebuild). Needs confirm:true.',\n inputSchema: {\n application: z.string().optional(),\n dir: z.string().optional(),\n confirm: z.boolean().optional(),\n },\n },\n (args) =>\n guard(async () => {\n const session = await getSession();\n const { applicationId } = await resolveApp(args);\n if (!args.confirm)\n return text(`Would restart ${applicationId}. Pass confirm:true.`, { dryRun: true });\n await session.roxyon.applications.restart(applicationId);\n return text(`Restart queued for ${applicationId}.`, { ok: true });\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_env_get',\n {\n title: 'Roxyon: read environment variables',\n description: \"An application's environment variables as KEY=value lines.\",\n inputSchema: { application: z.string().optional(), dir: z.string().optional() },\n },\n (args) =>\n guard(async () => {\n const session = await getSession();\n const { applicationId } = await resolveApp(args);\n const env = await session.roxyon.applications.getEnv(applicationId);\n return text(formatEnv(env) || '(none set)', { env });\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_env_set',\n {\n title: 'Roxyon: set environment variables',\n description:\n \"Merge variables into an application's environment and bump its revision. Run roxyon_deploy \" +\n 'afterwards to apply. Needs confirm:true. PORT and HOST are platform-managed and ignored.',\n inputSchema: {\n application: z.string().optional(),\n dir: z.string().optional(),\n vars: z.record(z.string()).describe('{ KEY: \"value\", ... } to set.'),\n remove: z.array(z.string()).optional().describe('Keys to delete.'),\n confirm: z.boolean().optional(),\n },\n },\n (args) =>\n guard(async () => {\n const session = await getSession();\n const { applicationId } = await resolveApp(args);\n const set: Record<string, string> = {};\n for (const [k, v] of Object.entries(args.vars)) {\n if (k === 'PORT' || k === 'HOST') continue;\n if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(k)) return errorResult(`Invalid env key \"${k}\".`);\n set[k] = v;\n }\n const planned = [...Object.keys(set), ...(args.remove ?? []).map((k) => `-${k}`)];\n if (!args.confirm) {\n return text(`Would update: ${planned.join(', ') || '(nothing)'}. Pass confirm:true.`, {\n dryRun: true,\n changed: planned,\n });\n }\n const r = await session.roxyon.applications.setEnv(applicationId, {\n set,\n remove: args.remove ?? [],\n });\n return text(`Updated ${r.changed.join(', ') || '(nothing)'}. Run roxyon_deploy to apply.`, {\n ok: true,\n changed: r.changed,\n });\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_link_github',\n {\n title: 'Roxyon: connect a git remote',\n description:\n 'Connect a git repository to an application for push-to-deploy. Returns the deploy key and ' +\n 'webhook URL to add to the repo. Needs confirm:true.',\n inputSchema: {\n application: z.string().optional(),\n dir: z.string().optional(),\n repoUrl: z.string().describe('SSH git URL, e.g. git@github.com:you/app.git'),\n branch: z.string().optional().describe('Branch to deploy (default main).'),\n confirm: z.boolean().optional(),\n },\n },\n (args) =>\n guard(async () => {\n const session = await getSession();\n const { applicationId } = await resolveApp(args);\n if (!args.confirm) {\n return text(\n `Would connect ${args.repoUrl} (${args.branch ?? 'main'}) to ${applicationId}. Pass confirm:true.`,\n { dryRun: true },\n );\n }\n const res = await session.roxyon.applications.repoConnect(\n applicationId,\n args.repoUrl,\n args.branch ?? 'main',\n );\n const body = [\n `Connected ${args.repoUrl} (${args.branch ?? 'main'}).`,\n res.deployKey ? `\\nDeploy key (add to the repo, read-only):\\n${res.deployKey}` : '',\n res.webhookUrl ? `\\nWebhook URL: ${res.webhookUrl}` : '',\n res.secret ? `Webhook secret: ${res.secret}` : '',\n res.hint ? `\\n${res.hint}` : '',\n ]\n .filter(Boolean)\n .join('\\n');\n return text(body, {\n ok: true,\n deployKey: res.deployKey,\n webhookUrl: res.webhookUrl,\n secret: res.secret,\n });\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_add_domain',\n {\n title: 'Roxyon: add a subdomain / host',\n description:\n 'Provision a host — DNS + web server + automatic HTTPS. The host must be a subdomain ' +\n 'of a domain the account already hosts (or a *.roxyon.com subdomain). Returns while it ' +\n 'is still coming up; TLS follows a minute or two later. Needs confirm:true.',\n inputSchema: {\n host: z.string().describe('The full hostname, e.g. promo.mycompany.com'),\n subscription: z\n .string()\n .optional()\n .describe('Which subscription to attach it to (omit if the account has one).'),\n spa: z.boolean().optional().describe('Single-page app: unmatched paths serve /index.html.'),\n phpVersion: z\n .string()\n .optional()\n .describe(\n 'PHP version for the vhost, e.g. \"8.3\" (needed to run PHP apps like WordPress).',\n ),\n confirm: z.boolean().optional(),\n },\n },\n (args) =>\n guard(async () => {\n const session = await getSession();\n if (!args.confirm) {\n return text(\n `Would provision ${args.host}${args.spa ? ' (SPA routing)' : ''}. Pass confirm:true.`,\n { dryRun: true },\n );\n }\n const res = await session.roxyon.domains.create({\n host: args.host,\n subscription: args.subscription ?? session.preferredSubscription,\n siteType: args.spa ? 'spa' : undefined,\n phpVersion: args.phpVersion,\n });\n const live = res.status === 'active';\n return text(\n [\n `${res.host} — ${res.type}, ${res.status}.`,\n live\n ? 'The host is up. HTTPS may take another minute to issue.'\n : 'DNS + web server are being set up (~1–2 min), then HTTPS. ' +\n 'Check roxyon_list_domains, or just deploy now — files are kept and served once it is live.',\n ].join('\\n'),\n { ok: true, host: res.host, type: res.type, status: res.status },\n );\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_deploy_content',\n {\n title: 'Roxyon: deploy generated files',\n description: [\n 'Publish a set of files you generated (HTML/CSS/JS/assets) to a host on the account.',\n 'The host must already exist (roxyon_add_domain, or an existing site). Overlay by',\n 'default — pass clean:true to replace the whole document root. Needs confirm:true.',\n `Limits: ${MAX_FILES} files, ${(MAX_FILE_BYTES / 1024) | 0} KB per file,`,\n `${(MAX_TOTAL_BYTES / 1024 / 1024).toFixed(1)} MB total (base64-encode binaries).`,\n ].join(' '),\n inputSchema: {\n host: z.string().describe('Target host, e.g. promo.mycompany.com'),\n folder: z.string().optional().describe('Sub-path under the host; \"\" = site root.'),\n files: z\n .array(\n z.object({\n path: z.string().describe('Relative path, e.g. index.html, about/index.html'),\n content: z.string(),\n encoding: z.enum(['utf8', 'base64']).optional(),\n }),\n )\n .min(1),\n clean: z.boolean().optional().describe('Replace the whole docroot (keeps .well-known).'),\n spa: z.boolean().optional().describe('Also flip the host to SPA routing.'),\n confirm: z.boolean().optional(),\n },\n },\n (args) =>\n guard(async () => {\n const session = await getSession();\n if (args.files.length > MAX_FILES) {\n return errorResult(`Too many files (${args.files.length}); the limit is ${MAX_FILES}.`);\n }\n let total = 0;\n for (const f of args.files) {\n const n = Buffer.byteLength(f.content, f.encoding === 'base64' ? 'base64' : 'utf8');\n if (n > MAX_FILE_BYTES) {\n return errorResult(\n `\"${f.path}\" is ${(n / 1024) | 0} KB; the per-file limit is ${(MAX_FILE_BYTES / 1024) | 0} KB.`,\n );\n }\n total += n;\n }\n if (total > MAX_TOTAL_BYTES) {\n return errorResult(\n `Total content is ${(total / 1024 / 1024).toFixed(1)} MB; the limit is ` +\n `${(MAX_TOTAL_BYTES / 1024 / 1024).toFixed(1)} MB. Deploy in parts or use the CLI.`,\n );\n }\n\n const folder = args.folder ?? '';\n if (!args.confirm) {\n return text(\n [\n 'DRY RUN — pass confirm:true to deploy.',\n '',\n `Host: ${args.host}${folder ? `/${folder}` : ''}`,\n `Files: ${args.files.length} (${(total / 1024) | 0} KB)`,\n `Mode: ${args.clean ? 'clean (replaces the document root)' : 'overlay'}${args.spa ? ' + SPA routing' : ''}`,\n ...args.files.slice(0, 20).map((f) => ` ${f.path}`),\n args.files.length > 20 ? ` … ${args.files.length - 20} more` : '',\n ]\n .filter(Boolean)\n .join('\\n'),\n { dryRun: true },\n );\n }\n\n const { buffer, files } = await packFiles(args.files, { maxBytes: MAX_TOTAL_BYTES });\n const r = await session.roxyon.sites.deploy(args.host, folder, buffer, {\n clean: args.clean,\n spa: args.spa,\n });\n const size = r.bytes ? ` (${(r.bytes / 1024) | 0} KB)` : '';\n const spaNote = args.spa ? '\\nSPA routing enabled — deep links resolve to index.html.' : '';\n return text(\n `✓ Deployed ${files.length} file(s) to https://${args.host}${folder ? `/${folder}` : ''}${size}.${spaNote}`,\n { ok: true, host: args.host, files: files.length },\n );\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_list_files',\n {\n title: 'Roxyon: list a site’s files',\n description: \"The files currently deployed to a host's document root.\",\n inputSchema: {\n host: z.string(),\n folder: z.string().optional(),\n path: z.string().optional().describe('List under this sub-path only.'),\n },\n },\n (args) =>\n guard(async () => {\n const session = await getSession();\n const files = await session.roxyon.sites.listFiles(\n args.host,\n args.folder ?? '',\n args.path ?? '',\n );\n const body = files.length\n ? files\n .map(\n (f) => `${f.type === 'dir' ? 'd' : '-'} ${String(f.size).padStart(8)} ${f.path}`,\n )\n .join('\\n')\n : '(empty)';\n return text(body, { files });\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_read_file',\n {\n title: 'Roxyon: read a site file',\n description: \"Read one file from a host's document root (to review or edit it).\",\n inputSchema: {\n host: z.string(),\n folder: z.string().optional(),\n path: z.string().describe('Relative path, e.g. index.html'),\n },\n },\n (args) =>\n guard(async () => {\n const session = await getSession();\n const f = await session.roxyon.sites.readFile(args.host, args.folder ?? '', args.path);\n if (f.encoding === 'base64') {\n return text(\n `${f.path} — ${f.size} bytes, binary (base64):\\n\\n${f.content.slice(0, 4096)}`,\n { path: f.path, size: f.size, encoding: 'base64' },\n );\n }\n return text(f.content, { path: f.path, size: f.size, encoding: 'utf8' });\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_database_create',\n {\n title: 'Roxyon: create a database',\n description:\n \"Provision a MySQL/MariaDB database + user. The name is prefixed with the account's own \" +\n 'username (globally unique across the shared cluster) — pass just the suffix, e.g. \"wordpress\". ' +\n 'The password is shown once in the result; there is no way to retrieve it later. Needs confirm:true.',\n inputSchema: {\n name: z.string().describe('DB name suffix: lowercase letters, digits, underscore.'),\n subscription: z.string().optional(),\n password: z.string().optional().describe('Omit to have Roxyon generate one.'),\n confirm: z.boolean().optional(),\n },\n },\n (args) =>\n guard(async () => {\n const session = await getSession();\n if (!args.confirm) {\n return text(`Would create database \"${args.name}\". Pass confirm:true.`, { dryRun: true });\n }\n const r = await session.roxyon.databases.create({\n name: args.name,\n subscription: args.subscription ?? session.preferredSubscription,\n password: args.password,\n });\n const body = [\n `${r.status === 'active' ? '✓' : '»'} Database ${r.name} (user ${r.username}) — ${r.status}.`,\n r.password ? `\\nPassword (save this now — shown once):\\n${r.password}` : '',\n r.host ? `Host: ${r.host}` : '',\n ]\n .filter(Boolean)\n .join('\\n');\n return text(body, {\n ok: true,\n objectId: r.objectId,\n name: r.name,\n username: r.username,\n host: r.host,\n status: r.status,\n });\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_list_databases',\n {\n title: 'Roxyon: list databases',\n description: 'Databases on the active subscription.',\n inputSchema: { subscription: z.string().optional() },\n },\n (args) =>\n guard(async () => {\n const session = await getSession();\n const subscription = args.subscription ?? session.preferredSubscription;\n if (!subscription) return errorResult('No subscription — pass \"subscription\".');\n const rows = await session.roxyon.databases.list(subscription);\n const body = rows.length\n ? rows\n .map((d) => `- ${d.Name} [${d.objectId}] — ${d.Status} (user ${d.Username})`)\n .join('\\n')\n : '(no databases)';\n return text(body, { databases: rows });\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_database_delete',\n {\n title: 'Roxyon: delete a database',\n description:\n 'Delete a database by its objectId (from roxyon_database_create/roxyon_list_databases). Needs confirm:true.',\n inputSchema: { database: z.string(), confirm: z.boolean().optional() },\n },\n (args) =>\n guard(async () => {\n const session = await getSession();\n if (!args.confirm) {\n return text(`Would delete database ${args.database}. Pass confirm:true.`, {\n dryRun: true,\n });\n }\n const r = await session.roxyon.databases.delete(args.database);\n return text(`Database ${args.database} — ${r.status}.`, { ok: true, status: r.status });\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_email_create',\n {\n title: 'Roxyon: create a mailbox',\n description:\n 'Provision a mailbox on a host already on the account. The password is shown once in the ' +\n 'result; there is no way to retrieve it later. Needs confirm:true.',\n inputSchema: {\n localPart: z.string().describe('The part before @, e.g. \"info\".'),\n domain: z.string().describe('A hostname already on the account.'),\n password: z.string().optional().describe('Omit to have Roxyon generate one.'),\n quota: z.number().int().positive().optional().describe('Quota in MB (default 1024).'),\n forwardTo: z.string().optional(),\n saveCopy: z.boolean().optional(),\n confirm: z.boolean().optional(),\n },\n },\n (args) =>\n guard(async () => {\n const session = await getSession();\n const email = `${args.localPart}@${args.domain}`;\n if (!args.confirm) {\n return text(`Would create mailbox ${email}. Pass confirm:true.`, { dryRun: true });\n }\n const r = await session.roxyon.email.create({\n localPart: args.localPart,\n domain: args.domain,\n password: args.password,\n quota: args.quota,\n forwardTo: args.forwardTo,\n saveCopy: args.saveCopy,\n });\n const body = [\n `${r.status === 'active' ? '✓' : '»'} Mailbox ${r.email} — ${r.status}.`,\n r.password ? `\\nPassword (save this now — shown once):\\n${r.password}` : '',\n ]\n .filter(Boolean)\n .join('\\n');\n return text(body, { ok: true, objectId: r.objectId, email: r.email, status: r.status });\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_list_emails',\n {\n title: 'Roxyon: list mailboxes',\n description: 'Mailboxes on the active subscription.',\n inputSchema: { subscription: z.string().optional() },\n },\n (args) =>\n guard(async () => {\n const session = await getSession();\n const subscription = args.subscription ?? session.preferredSubscription;\n if (!subscription) return errorResult('No subscription — pass \"subscription\".');\n const rows = await session.roxyon.email.list(subscription);\n const body = rows.length\n ? rows.map((e) => `- ${e.Email} [${e.objectId}] — ${e.Status}`).join('\\n')\n : '(no mailboxes)';\n return text(body, { emails: rows });\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_email_delete',\n {\n title: 'Roxyon: delete a mailbox',\n description:\n 'Delete a mailbox by its objectId (from roxyon_email_create/roxyon_list_emails). Needs confirm:true.',\n inputSchema: { email: z.string(), confirm: z.boolean().optional() },\n },\n (args) =>\n guard(async () => {\n const session = await getSession();\n if (!args.confirm) {\n return text(`Would delete mailbox ${args.email}. Pass confirm:true.`, { dryRun: true });\n }\n const r = await session.roxyon.email.delete(args.email);\n return text(`Mailbox ${args.email} — ${r.status}.`, { ok: true, status: r.status });\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_ssh_reset_password',\n {\n title: 'Roxyon: reset the SSH/SFTP password',\n description:\n \"Reset a subscription's shell password — used for SSH, SFTP, and the file manager. Changing \" +\n 'it signs out anything using the old one. The password is shown once in the result; the ' +\n 'platform never stores or re-shows it. Needs confirm:true.',\n inputSchema: {\n subscription: z.string().optional(),\n password: z\n .string()\n .optional()\n .describe('Omit to have Roxyon generate one (12+ chars, mixed case, number, symbol).'),\n confirm: z.boolean().optional(),\n },\n },\n (args) =>\n guard(async () => {\n const session = await getSession();\n if (!args.confirm) {\n return text('Would reset the SSH/SFTP password. Pass confirm:true.', { dryRun: true });\n }\n const r = await session.roxyon.ssh.resetPassword({\n subscription: args.subscription ?? session.preferredSubscription,\n password: args.password,\n });\n return text(\n `${r.status === 'active' ? '✓' : '»'} SSH/SFTP password ${r.status === 'active' ? 'changed' : 'change queued'}.\\n\\n` +\n `Password (save this now — shown once):\\n${r.password}`,\n { ok: true, subscription: r.subscription, status: r.status },\n );\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_install_wordpress',\n {\n title: 'Roxyon: install WordPress',\n description: [\n 'One-shot recipe: create a subdomain (if it does not already exist), provision a database',\n 'for it, download WordPress core, and deploy it. v1 scope — core only, no plugin/theme',\n 'selection, single site. Local-only (needs your filesystem to unpack WordPress into) — run',\n 'this from the CLI-backed MCP, not the hosted mcp.roxyon.com connector. Needs confirm:true.',\n ].join(' '),\n inputSchema: {\n host: z\n .string()\n .describe('The site host, e.g. blog.mycompany.com — created if it does not exist.'),\n folder: z\n .string()\n .optional()\n .describe('Sub-path under the host; \"\" = site root (recommended).'),\n subscription: z.string().optional(),\n dbName: z\n .string()\n .optional()\n .describe(\n 'Database name suffix (default derived from the host). See roxyon_database_create.',\n ),\n phpVersion: z.string().optional().describe('Default \"8.3\".'),\n confirm: z.boolean().optional(),\n },\n },\n (args) =>\n guard(async () => {\n const blocked = remoteFilesystemBlock('roxyon_install_wordpress');\n if (blocked) return blocked;\n const session = await getSession();\n const folder = args.folder ?? '';\n const dbSuffix =\n (args.dbName ?? args.host.split('.')[0] ?? 'wordpress')\n .toLowerCase()\n .replace(/[^a-z0-9_]/g, '_')\n .replace(/^[^a-z]+/, '')\n .slice(0, 20) || 'wordpress';\n\n if (!args.confirm) {\n return text(\n [\n 'DRY RUN — pass confirm:true to install.',\n '',\n `Host: ${args.host}${folder ? `/${folder}` : ''} (created if missing)`,\n `Database: ${dbSuffix} (prefixed with your account username)`,\n 'Steps: add domain -> create database -> download WordPress core -> upload',\n ].join('\\n'),\n { dryRun: true },\n );\n }\n\n const subscription = args.subscription ?? session.preferredSubscription;\n\n const domain = await session.roxyon.domains.create({\n host: args.host,\n subscription,\n phpVersion: args.phpVersion ?? '8.3',\n });\n if (domain.status === 'failed') {\n return errorResult(\n `Could not provision ${args.host}: ${domain.error ?? 'unknown error'}`,\n );\n }\n\n const db = await session.roxyon.databases.create({ name: dbSuffix, subscription });\n if (db.status === 'failed' || !db.password || !db.host) {\n return errorResult(`Could not provision the database: ${db.error ?? 'unknown error'}`);\n }\n\n const scratchDir = await mkdtemp(join(tmpdir(), 'roxyon-wp-'));\n await installWordPress({\n dir: scratchDir,\n db: { name: db.name, username: db.username, password: db.password, host: db.host },\n });\n\n const pack = await packDirectory(scratchDir);\n const deployRes = await session.roxyon.sites.deploy(args.host, folder, pack.buffer);\n\n const url = `https://${deployRes.host}${deployRes.path && deployRes.path !== '/' ? deployRes.path : ''}`;\n return text(\n [\n `✓ WordPress installed at ${url} (${pack.files.length} files).`,\n 'Visit the site to finish setup (site title, admin account) — WordPress asks for these',\n 'on first load.',\n '',\n `Database: ${db.name} / ${db.username} — password shown once, save it now:`,\n db.password,\n ].join('\\n'),\n { ok: true, url, database: { name: db.name, username: db.username } },\n );\n }),\n );\n}\n\n// Re-exported for tests.\nexport { resolveApp };\nexport type { Roxyon, ToolResult };\n","import { AsyncLocalStorage } from 'node:async_hooks';\n\n/**\n * Per-request state for the HTTP transport. The stdio entry never opens a\n * context, so {@link currentContext} returns `{}` there and everything falls\n * back to the env / stored-login behaviour.\n */\nexport interface RequestContext {\n /** Bearer token presented on this HTTP request (from the OAuth layer). */\n token?: string;\n /**\n * True when serving the remote HTTP server. Tools that need the caller's\n * local filesystem (`roxyon_init`, `roxyon_deploy`) refuse in this mode.\n */\n remote?: boolean;\n}\n\nconst storage = new AsyncLocalStorage<RequestContext>();\n\n/** Run `fn` with `ctx` visible to {@link currentContext} for its whole async tree. */\nexport function runWithContext<T>(ctx: RequestContext, fn: () => T): T {\n return storage.run(ctx, fn);\n}\n\n/** The context for the in-flight request, or `{}` on the stdio transport. */\nexport function currentContext(): RequestContext {\n return storage.getStore() ?? {};\n}\n","import { Roxyon, isAuthError } from '@roxyon/api-client';\nimport { endpointsFromEnv, loadCredentials, tokenFromEnv } from '@roxyon/deploy-core';\nimport { currentContext } from './context.js';\n\nexport interface RoxyonSession {\n roxyon: Roxyon;\n preferredSubscription?: string;\n /** how the session was authenticated, for diagnostics */\n source: 'env-token' | 'stored-login' | 'oauth';\n}\n\nexport class NotAuthenticatedError extends Error {\n constructor() {\n super(\n 'Not signed in to Roxyon. Run `roxyon login` in a terminal, or set ROXYON_TOKEN ' +\n \"in this MCP server's environment.\",\n );\n this.name = 'NotAuthenticatedError';\n }\n}\n\n/**\n * Resolve a Roxyon client for a tool call. Order: `ROXYON_TOKEN` env var, then\n * the login stored by the CLI at `~/.roxyon/config.json`.\n */\nexport async function getSession(): Promise<RoxyonSession> {\n const { apiUrl, consoleUrl } = endpointsFromEnv();\n\n // HTTP transport: the bearer token from this request wins over any ambient\n // env/stored credentials, and each request gets its own client.\n const requestToken = currentContext().token;\n if (requestToken) {\n return {\n roxyon: new Roxyon({ sessionToken: requestToken, baseUrl: apiUrl, consoleUrl }),\n source: 'oauth',\n };\n }\n\n const envToken = tokenFromEnv();\n if (envToken) {\n return {\n roxyon: new Roxyon({ sessionToken: envToken, baseUrl: apiUrl, consoleUrl }),\n source: 'env-token',\n };\n }\n const creds = await loadCredentials();\n if (!creds?.sessionToken) throw new NotAuthenticatedError();\n return {\n roxyon: new Roxyon({ sessionToken: creds.sessionToken, baseUrl: apiUrl, consoleUrl }),\n preferredSubscription: creds.subscription,\n source: 'stored-login',\n };\n}\n\nexport function isSessionGone(err: unknown): boolean {\n return err instanceof NotAuthenticatedError || isAuthError(err);\n}\n","import { isSessionGone } from './session.js';\n\nexport interface ToolResult {\n content: Array<{ type: 'text'; text: string }>;\n structuredContent?: Record<string, unknown>;\n isError?: boolean;\n /** SDK's CallToolResult carries an open index signature. */\n [k: string]: unknown;\n}\n\nexport function text(body: string, structured?: Record<string, unknown>): ToolResult {\n return {\n content: [{ type: 'text', text: body }],\n ...(structured ? { structuredContent: structured } : {}),\n };\n}\n\nexport function errorResult(message: string, structured?: Record<string, unknown>): ToolResult {\n return {\n content: [{ type: 'text', text: message }],\n ...(structured ? { structuredContent: structured } : {}),\n isError: true,\n };\n}\n\n/** Wrap a tool body so thrown errors become clean `isError` results. */\nexport async function guard(fn: () => Promise<ToolResult>): Promise<ToolResult> {\n try {\n return await fn();\n } catch (err) {\n if (isSessionGone(err)) {\n return errorResult(\n (err as Error).message ||\n 'Roxyon session expired — run `roxyon login` again, or refresh ROXYON_TOKEN.',\n );\n }\n return errorResult(err instanceof Error ? err.message : String(err));\n }\n}\n"],"mappings":";;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;;;ACA1B,SAAS,SAAS;AAEX,SAAS,gBAAgB,QAAyB;AACvD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,aACE;AAAA,MACF,YAAY;AAAA,QACV,MAAM,EAAE,OAAO,EAAE,SAAS,yBAAyB;AAAA,QACnD,KAAK,EAAE,OAAO,EAAE,SAAS,EAA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,EAAE,iBAAiB,EAChD;AAGK,SAAS,eAA0B;AACxC,QAAM,SAAS,IAAI;AAAA,IACjB,EAAE,MAAM,aAAa,SAAS,eAAe;AAAA,IAC7C;AAAA,MACE,cACE;AAAA,IAIJ;AAAA,EACF;AAEA,oBAAkB,MAAM;AACxB,kBAAgB,MAAM;AACtB,gBAAc,MAAM;AACpB,SAAO;AACT;","names":["join","z","z","join"]}
|
package/dist/http-entry.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roxyon/mcp",
|
|
3
3
|
"mcpName": "io.github.bea-technology/roxyon",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
5
5
|
"description": "Model Context Protocol server for Roxyon — lets any MCP-capable AI assistant build with LumenJS, use the Roxyon BaaS, and deploy to Roxyon infrastructure.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
36
36
|
"express": "^5.2.1",
|
|
37
37
|
"zod": "^3.25.0",
|
|
38
|
-
"@roxyon/api-client": "0.
|
|
39
|
-
"@roxyon/deploy-core": "0.
|
|
38
|
+
"@roxyon/api-client": "0.3.0",
|
|
39
|
+
"@roxyon/deploy-core": "0.3.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/express": "^5.0.0",
|
package/resources/deploy.md
CHANGED
|
@@ -54,6 +54,23 @@ set by the platform — never set them.
|
|
|
54
54
|
Add both to the repo and pushes to the chosen branch redeploy automatically. A
|
|
55
55
|
git-connected app rejects tarball uploads — push instead.
|
|
56
56
|
|
|
57
|
+
## Beyond deploy: databases, email, SSH
|
|
58
|
+
|
|
59
|
+
The Applications/Sites system above is only part of the platform. These tools
|
|
60
|
+
cover the rest — each is a small provision-and-return-once action, not a
|
|
61
|
+
project you iterate on:
|
|
62
|
+
|
|
63
|
+
| Tool | Does |
|
|
64
|
+
|---|---|
|
|
65
|
+
| `roxyon_database_create` / `roxyon_list_databases` / `roxyon_database_delete` | A MySQL/MariaDB database + user on the shared Galera cluster. The name you pass is a *suffix* — the platform prefixes it with the account's own username, since the DB namespace is shared platform-wide. Returns `{username, password, host}` — the password is shown **once**, capture it immediately. |
|
|
66
|
+
| `roxyon_email_create` / `roxyon_list_emails` / `roxyon_email_delete` | A mailbox on a host already on the account. Password shown once, same as databases. |
|
|
67
|
+
| `roxyon_ssh_reset_password` | Resets the **one shared shell password** for a subscription's container — used for SSH, SFTP, *and* the file manager. Resetting it signs out anything using the old one. Shown once; the platform never stores or re-shows it. |
|
|
68
|
+
| `roxyon_install_wordpress` | Composes the above: create/reuse a host → create a database → download WordPress core → deploy it. Local-filesystem-only (needs somewhere to unpack WordPress), same restriction as `roxyon_init`/`roxyon_deploy`. See the `roxyon://docs/recipe-wordpress` resource. |
|
|
69
|
+
|
|
70
|
+
`roxyon_add_domain` also takes an optional `phpVersion` (e.g. `"8.3"`) — pass it
|
|
71
|
+
when the host will run a PHP app (WordPress or otherwise); omitted, the
|
|
72
|
+
platform defaults to its own current default version.
|
|
73
|
+
|
|
57
74
|
## LumenJS specifics
|
|
58
75
|
|
|
59
76
|
- No build step for the framework; `.view` files are HTML+JS+CSS interpreted in
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Recipe — build a site and host it on Roxyon
|
|
2
|
+
|
|
3
|
+
The end-to-end flow for *"build me a landing page and put it on
|
|
4
|
+
`promo.mycompany.com`"* over the hosted connector. No local files, no CLI.
|
|
5
|
+
|
|
6
|
+
## The tools
|
|
7
|
+
|
|
8
|
+
| Tool | When |
|
|
9
|
+
|---|---|
|
|
10
|
+
| `roxyon_list_domains` | see the account's hosts + which are still `provisioning` |
|
|
11
|
+
| `roxyon_add_domain` | create a **subdomain** of a domain the account already hosts (or `*.roxyon.com`) — DNS + web server + automatic HTTPS |
|
|
12
|
+
| `roxyon_deploy_content` | publish the files you generated (HTML/CSS/JS/assets as `{path, content}` entries) |
|
|
13
|
+
| `roxyon_list_files` / `roxyon_read_file` | inspect what's live so you can iterate |
|
|
14
|
+
|
|
15
|
+
## Flow
|
|
16
|
+
|
|
17
|
+
1. **Pick / create the host.**
|
|
18
|
+
- Deploying to a domain already in the account's Sites → skip to step 2.
|
|
19
|
+
- New subdomain → `roxyon_add_domain { host: "promo.mycompany.com", confirm: true }`
|
|
20
|
+
(add `spa: true` if the site uses client-side routing). It returns fast, while
|
|
21
|
+
DNS/vhost/TLS are still coming up — that's fine, keep going.
|
|
22
|
+
2. **Generate the site.** Plain, self-contained static output:
|
|
23
|
+
- `index.html` at the root. One real `.html` per page, **or** `about/index.html`,
|
|
24
|
+
`pricing/index.html` — the default routing serves `/about/` from
|
|
25
|
+
`about/index.html`.
|
|
26
|
+
- **Relative** asset paths (`./styles.css`, `assets/logo.png`) — never absolute.
|
|
27
|
+
- Inline small CSS/JS or ship a couple of files; keep it under **60 files /
|
|
28
|
+
2 MB total / 1 MB per file**. Base64-encode images (`encoding: "base64"`).
|
|
29
|
+
- No build step. If you want reactivity, LumenJS `.view` files work with **no
|
|
30
|
+
build** — load `https://cdn.roxyon.com/libs/rxjs/1.0.0/rx.js` in `index.html`
|
|
31
|
+
and follow `roxyon://docs/lumenjs`. Only a genuine single-page app that owns
|
|
32
|
+
every route needs `spa: true` (deep links → `index.html`).
|
|
33
|
+
3. **Deploy.**
|
|
34
|
+
`roxyon_deploy_content { host, files: [{path, content}, …], clean: true, confirm: true }`
|
|
35
|
+
- `clean: true` for a fresh site — it replaces the document root (and removes
|
|
36
|
+
the placeholder "Coming Soon" page). For an edit to an existing site, run
|
|
37
|
+
`roxyon_list_files` first, then deploy **without** `clean` and include only
|
|
38
|
+
the changed files (overlay).
|
|
39
|
+
4. **Verify.** `roxyon_list_files { host }` to confirm the files landed. Then tell
|
|
40
|
+
the user the URL.
|
|
41
|
+
- **HTTPS lag:** a brand-new host serves over http within a minute; the TLS
|
|
42
|
+
certificate follows 1–3 minutes later. If `https://` fails at first, that's
|
|
43
|
+
expected — it resolves itself.
|
|
44
|
+
|
|
45
|
+
## Notes
|
|
46
|
+
|
|
47
|
+
- The connector cannot build a project from a local folder or a git repo — that's
|
|
48
|
+
the `roxyon` CLI (`npm i -g @roxyon/cli`) or `roxyon_link_github`. It *can* take
|
|
49
|
+
files you generate here.
|
|
50
|
+
- `roxyon_add_domain` only makes **subdomains** of domains the account already
|
|
51
|
+
hosts (or `roxyon.com`). Adding a brand-new top-level domain is a console task.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Recipe — install WordPress on Roxyon
|
|
2
|
+
|
|
3
|
+
The end-to-end flow for *"put WordPress on `blog.mycompany.com`"*. **Local /
|
|
4
|
+
CLI-backed MCP only** — `roxyon_install_wordpress` unpacks WordPress core into
|
|
5
|
+
a local scratch directory, which the hosted `mcp.roxyon.com` connector cannot
|
|
6
|
+
do (same restriction as `roxyon_init` / `roxyon_deploy`).
|
|
7
|
+
|
|
8
|
+
## The tool
|
|
9
|
+
|
|
10
|
+
`roxyon_install_wordpress` composes four steps into one call:
|
|
11
|
+
|
|
12
|
+
1. Create the host if it doesn't already exist (`roxyon_add_domain`'s own
|
|
13
|
+
logic — a subdomain of a domain the account already hosts, or
|
|
14
|
+
`*.roxyon.com`), with a PHP-capable vhost (`phpVersion`, default `8.3`).
|
|
15
|
+
2. Create a database (`roxyon_database_create` under the hood) — the name is
|
|
16
|
+
derived from the host unless you pass `dbName`.
|
|
17
|
+
3. Download WordPress core and write a working `wp-config.php` against that
|
|
18
|
+
database.
|
|
19
|
+
4. Upload it (the same tar path `roxyon_deploy` uses — WordPress core is
|
|
20
|
+
thousands of files, well past `roxyon_deploy_content`'s JSON budget).
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
roxyon_install_wordpress { host: "blog.mycompany.com", confirm: true }
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Dry-run first (omit `confirm`) to see the plan — which host, which database
|
|
27
|
+
name — before it provisions anything real.
|
|
28
|
+
|
|
29
|
+
## What comes back
|
|
30
|
+
|
|
31
|
+
The site URL, and the database name/username/password. **The password is
|
|
32
|
+
shown once** — nothing on the platform stores or re-shows it, so save it (or
|
|
33
|
+
hand it straight to the user) immediately.
|
|
34
|
+
|
|
35
|
+
## After the tool returns
|
|
36
|
+
|
|
37
|
+
WordPress itself still needs its famous "5-minute install" — site title, admin
|
|
38
|
+
account, language — the first time the URL is opened in a browser. The tool
|
|
39
|
+
does not automate that (it is a browser wizard, not an API); tell the user to
|
|
40
|
+
visit the URL to finish setup.
|
|
41
|
+
|
|
42
|
+
## v1 scope — what this does *not* do
|
|
43
|
+
|
|
44
|
+
- No plugin or theme selection — core only. Install extras the normal
|
|
45
|
+
WordPress-admin way afterwards.
|
|
46
|
+
- No multisite.
|
|
47
|
+
- No existing-site import/migration — this is for a **new** install only.
|
|
48
|
+
|
|
49
|
+
## Notes
|
|
50
|
+
|
|
51
|
+
- `roxyon_database_create`'s name is a *suffix* — the platform prefixes it
|
|
52
|
+
with the account's own username (the DB namespace is shared across every
|
|
53
|
+
customer on the cluster), so `dbName: "blog"` becomes something like
|
|
54
|
+
`acme_blog`, not `blog`.
|
|
55
|
+
- If the host already exists on the account, step 1 is a no-op (same
|
|
56
|
+
behaviour as `roxyon_add_domain`) — safe to re-run against an existing host,
|
|
57
|
+
though re-running the whole recipe will provision a **new** database each
|
|
58
|
+
time (it does not detect "WordPress is already installed here").
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/server.ts","../src/prompts.ts","../src/resources.ts","../src/tools.ts","../src/context.ts","../src/session.ts","../src/result.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { registerPrompts } from './prompts.js';\nimport { registerResources } from './resources.js';\nimport { registerTools } from './tools.js';\n\nexport const SERVER_NAME = 'roxyon';\nexport const SERVER_VERSION: string = (\n createRequire(import.meta.url)('../package.json') as { version: string }\n).version;\n\n/** Build the Roxyon MCP server with every tool, resource and prompt registered. */\nexport function createServer(): McpServer {\n const server = new McpServer(\n { name: SERVER_NAME, version: SERVER_VERSION },\n {\n instructions:\n 'Roxyon lets you build LumenJS SPAs, use the Roxyon BaaS, and deploy apps and web ' +\n 'projects to Roxyon infrastructure. Read the roxyon://docs/* resources before writing ' +\n 'LumenJS or calling the BaaS. To deploy: roxyon_init once per project, then roxyon_deploy ' +\n '(dry run, then confirm:true). Side-effecting tools require confirm:true.',\n },\n );\n\n registerResources(server);\n registerPrompts(server);\n registerTools(server);\n return server;\n}\n","import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { z } from 'zod';\n\nexport function registerPrompts(server: McpServer): void {\n server.registerPrompt(\n 'scaffold-lumen-app',\n {\n title: 'Scaffold a LumenJS + Roxyon app',\n description:\n 'Guidance for creating a new LumenJS SPA wired to the Roxyon BaaS and ready to deploy.',\n argsSchema: {\n idea: z.string().describe('What the app should do.'),\n dir: z.string().optional().describe('Where to create it.'),\n },\n },\n ({ idea, dir }) => ({\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Build a LumenJS single-page app: ${idea}\\n\\nSteps:\\n1. Read the \"roxyon://docs/lumenjs\" resource — follow V1 rules exactly (one bind per region, no nested bind, build option lists in JS not :for, check every BaaS write for an error field).\\n2. Read \"roxyon://docs/baas\" for the data/auth API.\\n3. Scaffold with the LumenJS CLI: \\`lm create <name>\\`${dir ? ` in ${dir}` : ''}. Put views under src/views/, wire the BaaS in src/index.js via config.json.\\n4. When it runs locally (\\`lm serve\\`), call roxyon_init then roxyon_deploy (dry run first, then confirm:true).`,\n },\n },\n ],\n }),\n );\n\n server.registerPrompt(\n 'deploy-to-roxyon',\n {\n title: 'Deploy this project to Roxyon',\n description: 'Walk through deploying the current project to Roxyon infrastructure.',\n argsSchema: { dir: z.string().describe('Absolute path to the project.') },\n },\n ({ dir }) => ({\n messages: [\n {\n role: 'user',\n content: {\n type: 'text',\n text: `Deploy the project at ${dir} to Roxyon.\\n\\n1. If there is no roxyon.json, call roxyon_init (it detects the runtime; ask me which host if there are several).\\n2. Call roxyon_deploy with just the dir first to see the plan.\\n3. If the plan looks right, call roxyon_deploy again with confirm:true.\\n4. For an app runtime, report the final status and, if it failed, the last error from roxyon_app_status.`,\n },\n },\n ],\n }),\n );\n}\n","import { readFile } from 'node:fs/promises';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\n\nconst RESOURCE_DIR = join(dirname(fileURLToPath(import.meta.url)), '..', 'resources');\n\ninterface Doc {\n uri: string;\n name: string;\n file: string;\n title: string;\n description: string;\n}\n\nconst DOCS: Doc[] = [\n {\n uri: 'roxyon://docs/lumenjs',\n name: 'lumenjs-reference',\n file: 'lumenjs.md',\n title: 'LumenJS — complete reference',\n description:\n 'Full LumenJS V1 reference for building SPAs with vanilla JS/HTML/CSS (no build step), ' +\n 'contrasted with Vue/React. Read before writing .view files.',\n },\n {\n uri: 'roxyon://docs/baas',\n name: 'baas-reference',\n file: 'baas.md',\n title: 'Roxyon BaaS reference',\n description:\n 'The Roxyon Backend-as-a-Service REST API: endpoints, auth flow, query rules, and the ' +\n 'resolve-on-failure write behaviour.',\n },\n {\n uri: 'roxyon://docs/deploy',\n name: 'deploy-reference',\n file: 'deploy.md',\n title: 'Deploying to Roxyon',\n description:\n 'How roxyon_init / roxyon_deploy work, the roxyon.json schema, static vs app deploys, env ' +\n 'vars, and git push-to-deploy.',\n },\n];\n\nexport function registerResources(server: McpServer): void {\n for (const doc of DOCS) {\n server.registerResource(\n doc.name,\n doc.uri,\n { title: doc.title, description: doc.description, mimeType: 'text/markdown' },\n async () => {\n const body = await readFile(join(RESOURCE_DIR, doc.file), 'utf8');\n return { contents: [{ uri: doc.uri, mimeType: 'text/markdown', text: body }] };\n },\n );\n }\n}\n","import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { type Roxyon, envFromStored, formatEnv } from '@roxyon/api-client';\nimport {\n buildIgnore,\n buildProjectConfig,\n deployProject,\n detectRuntime,\n listFiles,\n loadProjectConfig,\n saveProjectConfig,\n} from '@roxyon/deploy-core';\nimport { z } from 'zod';\nimport { currentContext } from './context.js';\nimport { type ToolResult, errorResult, guard, text } from './result.js';\nimport { type RoxyonSession, getSession } from './session.js';\n\n/**\n * `roxyon_init` / `roxyon_deploy` read and write the caller's local project\n * directory — impossible over the remote HTTP server. Returns an explanatory\n * result when running in that mode, `null` otherwise (proceed).\n */\nfunction remoteFilesystemBlock(tool: 'roxyon_init' | 'roxyon_deploy'): ToolResult | null {\n if (!currentContext().remote) return null;\n return errorResult(\n [\n `${tool} needs access to your local project files, which the hosted Roxyon MCP`,\n 'server does not have. Either:',\n ' • run the `roxyon` CLI locally (`npm i -g @roxyon/cli`, then `roxyon deploy`), or',\n ' • use `roxyon_link_github` to connect a git repo for push-to-deploy, then',\n ' `roxyon_app_status` / `roxyon_logs` to watch it here.',\n ].join('\\n'),\n );\n}\n\n/** Resolve an application id from an explicit id or a project directory. */\nasync function resolveApp(args: { application?: string; dir?: string }): Promise<{\n applicationId: string;\n host?: string;\n}> {\n if (args.application) return { applicationId: args.application };\n if (args.dir) {\n const cfg = await loadProjectConfig(args.dir);\n if (cfg?.application) return { applicationId: cfg.application, host: cfg.host };\n throw new Error(\n `No application linked in ${args.dir}/roxyon.json. Deploy it once (roxyon_deploy) or pass \"application\".`,\n );\n }\n throw new Error('Pass either \"application\" (an id) or \"dir\" (a project directory).');\n}\n\n/** The account context (user + subscriptions + domains) — one call, PAT-safe. */\nfunction accountContext(session: RoxyonSession) {\n return session.roxyon.account.context();\n}\n\nexport function registerTools(server: McpServer): void {\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_whoami',\n {\n title: 'Roxyon: who am I',\n description: 'Show the signed-in Roxyon user and their subscriptions (which one is active).',\n inputSchema: {},\n },\n () =>\n guard(async () => {\n const session = await getSession();\n const ctx = await accountContext(session);\n const lines = [\n `User: ${ctx.user.email || ctx.user.id} (${ctx.user.id})`,\n `Auth: ${session.source}${ctx.scopes.length ? ` (scopes: ${ctx.scopes.join(', ')})` : ''}`,\n '',\n 'Subscriptions:',\n ...ctx.subscriptions.map(\n (s) =>\n ` ${s.name || s.id} — ${s.status || '?'}${s.datacenter ? ` · ${s.datacenter}` : ''}`,\n ),\n '',\n `Hosts: ${ctx.domains.map((d) => d.name).join(', ') || '(none)'}`,\n ];\n return text(lines.join('\\n'), {\n user: ctx.user,\n scopes: ctx.scopes,\n subscriptions: ctx.subscriptions,\n hosts: ctx.domains.map((d) => d.name),\n });\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_list_domains',\n {\n title: 'Roxyon: list hosts',\n description:\n 'List the domains (hosts) on the active subscription — the possible deploy targets.',\n inputSchema: {},\n },\n () =>\n guard(async () => {\n const session = await getSession();\n const { domains } = await accountContext(session);\n return text(\n domains.length\n ? domains.map((d) => `- ${d.name}`).join('\\n')\n : '(no hosts on this account)',\n { hosts: domains.map((d) => d.name) },\n );\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_list_apps',\n {\n title: 'Roxyon: list applications',\n description:\n 'List the applications on the active subscription with their status and revision.',\n inputSchema: {},\n },\n () =>\n guard(async () => {\n const session = await getSession();\n const apps = await session.roxyon.account.apps();\n const body = apps.length\n ? apps\n .map(\n (a) =>\n `- ${a.name} [${a.id}] — ${a.status || '?'} ` +\n `(rev ${a.appliedRevision}/${a.configRevision})` +\n `${a.repo ? ` · git:${a.repo.branch}` : ''}`,\n )\n .join('\\n')\n : '(no applications)';\n return text(body, { applications: apps });\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_init',\n {\n title: 'Roxyon: initialise a project',\n description:\n \"Detect a project's type and write roxyon.json. Run this once per project before roxyon_deploy. \" +\n 'Does not create anything on the platform.',\n inputSchema: {\n dir: z.string().describe('Absolute path to the project directory.'),\n runtime: z.enum(['lumen', 'node', 'python', 'php']).optional(),\n host: z.string().optional().describe('Deploy host (a domain on the subscription).'),\n folder: z.string().optional().describe('Sub-path under the host; \"\" = site root.'),\n overwrite: z.boolean().optional().describe('Replace an existing roxyon.json.'),\n },\n },\n (args) =>\n guard(async () => {\n const blocked = remoteFilesystemBlock('roxyon_init');\n if (blocked) return blocked;\n const session = await getSession();\n const existing = await loadProjectConfig(args.dir);\n if (existing && !args.overwrite) {\n return errorResult(\n `roxyon.json already exists in ${args.dir}. Pass overwrite:true to replace it.`,\n { config: existing },\n );\n }\n const { domains } = await accountContext(session);\n if (domains.length === 0) {\n return errorResult(\n 'This account has no hosts. Add a domain in the Roxyon console first.',\n );\n }\n const detected = await detectRuntime(args.dir);\n const runtime = args.runtime ?? detected.runtime;\n const host = args.host ?? domains[0]!.name;\n if (!domains.some((d) => d.name === host)) {\n return errorResult(\n `Host \"${host}\" is not on this account (have: ${domains.map((d) => d.name).join(', ')}).`,\n );\n }\n const config = buildProjectConfig({\n cwd: args.dir,\n runtime,\n host,\n folder: args.folder,\n start: detected.start,\n });\n const path = await saveProjectConfig(config, args.dir);\n return text(\n `Wrote ${path}\\nDetected: ${detected.runtime} (${detected.reason})\\n\\n${JSON.stringify(config, null, 2)}`,\n { path, detected: detected.runtime, config },\n );\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_deploy',\n {\n title: 'Roxyon: deploy a project',\n description:\n 'Build (if configured) and deploy the project in \"dir\" to Roxyon. Without confirm:true this ' +\n 'returns a dry-run plan (what would build, where it would go, how many files). With confirm:true ' +\n 'it runs the build, uploads, and — for app runtimes — waits for it to go live. Requires roxyon.json ' +\n '(run roxyon_init first).',\n inputSchema: {\n dir: z\n .string()\n .describe('Absolute path to the project directory (must contain roxyon.json).'),\n confirm: z.boolean().optional().describe('Actually deploy. Omit for a dry-run plan.'),\n build: z.boolean().optional().describe('Run the configured build command (default true).'),\n follow: z\n .boolean()\n .optional()\n .describe('For app runtimes, wait until running/failed (default true).'),\n },\n },\n (args) =>\n guard(async () => {\n const blocked = remoteFilesystemBlock('roxyon_deploy');\n if (blocked) return blocked;\n const session = await getSession();\n const config = await loadProjectConfig(args.dir);\n if (!config) {\n return errorResult(`No roxyon.json in ${args.dir}. Run roxyon_init first.`);\n }\n\n if (!args.confirm) {\n const ig = await buildIgnore(args.dir);\n const packRoot =\n config.kind === 'static' && config.outDir ? `${args.dir}/${config.outDir}` : args.dir;\n let files: string[] = [];\n try {\n files = await listFiles(packRoot, ig);\n } catch {\n /* outDir may not exist until the build runs */\n }\n const plan = [\n 'DRY RUN — pass confirm:true to deploy.',\n '',\n `Project: ${config.name} (${config.runtime}, ${config.kind})`,\n `Target: ${config.host}${config.folder ? `/${config.folder}` : ''}`,\n config.build ? `Build: ${config.build}` : 'Build: (none)',\n config.kind === 'app'\n ? `App: ${config.application ?? '(created on first deploy)'}`\n : 'Serve: static files from the host document root',\n files.length\n ? `Would pack ${files.length} file(s) from ${config.kind === 'static' && config.outDir ? config.outDir : '.'}`\n : `Would pack the build output (${config.outDir ?? 'dist'}) after building`,\n ].join('\\n');\n return text(plan, { dryRun: true, config });\n }\n\n const logLines: string[] = [];\n const outcome = await deployProject({\n cwd: args.dir,\n roxyon: session.roxyon,\n preferredSubscription: session.preferredSubscription,\n build: args.build,\n follow: args.follow ?? true,\n timeoutMs: 5 * 60 * 1000,\n reporter: {\n step: (m) => logLines.push(`» ${m}`),\n log: (l) => logLines.push(` ${l}`),\n },\n });\n\n const tail = logLines.slice(-60).join('\\n');\n if (outcome.kind === 'static' && outcome.ok) {\n return text(`${tail}\\n\\n✓ Live: ${outcome.url} (${outcome.files} files)`, {\n ok: true,\n kind: 'static',\n url: outcome.url,\n });\n }\n if (outcome.kind === 'app' && outcome.ok) {\n return text(\n `${tail}\\n\\n✓ ${outcome.status === 'running' ? `Live: ${outcome.url ?? outcome.application}` : `Build queued (revision ${outcome.revision})`}`,\n {\n ok: true,\n kind: 'app',\n application: outcome.application,\n status: outcome.status,\n url: outcome.url,\n },\n );\n }\n return errorResult(\n `${tail}\\n\\n✗ Deploy failed: ${'error' in outcome ? outcome.error : 'unknown'}`,\n { ok: false, application: 'application' in outcome ? outcome.application : undefined },\n );\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_app_status',\n {\n title: 'Roxyon: application status',\n description:\n 'Current status, revisions and last error for an application (by id or project dir).',\n inputSchema: {\n application: z.string().optional(),\n dir: z\n .string()\n .optional()\n .describe('A project directory whose roxyon.json links an application.'),\n },\n },\n (args) =>\n guard(async () => {\n const session = await getSession();\n const { applicationId } = await resolveApp(args);\n const app = await session.roxyon.account.getApp(applicationId);\n if (!app) return errorResult(`Application ${applicationId} not found.`);\n const settled = app.configRevision <= app.appliedRevision;\n const body = [\n `${app.name} [${app.id}]`,\n `Status: ${app.status || '?'}${settled ? '' : ' (applying)'}`,\n `Revision: ${app.appliedRevision} / ${app.configRevision}`,\n `Runtime: ${app.runtime}`.trim(),\n app.lastError ? `\\nLast error:\\n${app.lastError}` : '',\n ]\n .filter(Boolean)\n .join('\\n');\n return text(body, {\n id: app.id,\n status: app.status,\n settled,\n configRevision: app.configRevision,\n appliedRevision: app.appliedRevision,\n lastError: app.lastError || undefined,\n });\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_logs',\n {\n title: 'Roxyon: application logs',\n description: 'Recent journal lines for an application (by id or project dir).',\n inputSchema: {\n application: z.string().optional(),\n dir: z.string().optional(),\n lines: z\n .number()\n .int()\n .min(1)\n .max(1000)\n .optional()\n .describe('How many lines (default 100).'),\n },\n },\n (args) =>\n guard(async () => {\n const session = await getSession();\n const { applicationId } = await resolveApp(args);\n const lines = await session.roxyon.applications.logs(applicationId, args.lines ?? 100);\n return text(lines.join('\\n') || '(no log lines)', { lines });\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_restart',\n {\n title: 'Roxyon: restart an application',\n description: 'Bounce the application process (no rebuild). Needs confirm:true.',\n inputSchema: {\n application: z.string().optional(),\n dir: z.string().optional(),\n confirm: z.boolean().optional(),\n },\n },\n (args) =>\n guard(async () => {\n const session = await getSession();\n const { applicationId } = await resolveApp(args);\n if (!args.confirm)\n return text(`Would restart ${applicationId}. Pass confirm:true.`, { dryRun: true });\n await session.roxyon.applications.restart(applicationId);\n return text(`Restart queued for ${applicationId}.`, { ok: true });\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_env_get',\n {\n title: 'Roxyon: read environment variables',\n description: \"An application's environment variables as KEY=value lines.\",\n inputSchema: { application: z.string().optional(), dir: z.string().optional() },\n },\n (args) =>\n guard(async () => {\n const session = await getSession();\n const { applicationId } = await resolveApp(args);\n const env = await session.roxyon.applications.getEnv(applicationId);\n return text(formatEnv(env) || '(none set)', { env });\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_env_set',\n {\n title: 'Roxyon: set environment variables',\n description:\n \"Merge variables into an application's environment and bump its revision. Run roxyon_deploy \" +\n 'afterwards to apply. Needs confirm:true. PORT and HOST are platform-managed and ignored.',\n inputSchema: {\n application: z.string().optional(),\n dir: z.string().optional(),\n vars: z.record(z.string()).describe('{ KEY: \"value\", ... } to set.'),\n remove: z.array(z.string()).optional().describe('Keys to delete.'),\n confirm: z.boolean().optional(),\n },\n },\n (args) =>\n guard(async () => {\n const session = await getSession();\n const { applicationId } = await resolveApp(args);\n const set: Record<string, string> = {};\n for (const [k, v] of Object.entries(args.vars)) {\n if (k === 'PORT' || k === 'HOST') continue;\n if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(k)) return errorResult(`Invalid env key \"${k}\".`);\n set[k] = v;\n }\n const planned = [...Object.keys(set), ...(args.remove ?? []).map((k) => `-${k}`)];\n if (!args.confirm) {\n return text(`Would update: ${planned.join(', ') || '(nothing)'}. Pass confirm:true.`, {\n dryRun: true,\n changed: planned,\n });\n }\n const r = await session.roxyon.applications.setEnv(applicationId, {\n set,\n remove: args.remove ?? [],\n });\n return text(`Updated ${r.changed.join(', ') || '(nothing)'}. Run roxyon_deploy to apply.`, {\n ok: true,\n changed: r.changed,\n });\n }),\n );\n\n // -----------------------------------------------------------------------\n server.registerTool(\n 'roxyon_link_github',\n {\n title: 'Roxyon: connect a git remote',\n description:\n 'Connect a git repository to an application for push-to-deploy. Returns the deploy key and ' +\n 'webhook URL to add to the repo. Needs confirm:true.',\n inputSchema: {\n application: z.string().optional(),\n dir: z.string().optional(),\n repoUrl: z.string().describe('SSH git URL, e.g. git@github.com:you/app.git'),\n branch: z.string().optional().describe('Branch to deploy (default main).'),\n confirm: z.boolean().optional(),\n },\n },\n (args) =>\n guard(async () => {\n const session = await getSession();\n const { applicationId } = await resolveApp(args);\n if (!args.confirm) {\n return text(\n `Would connect ${args.repoUrl} (${args.branch ?? 'main'}) to ${applicationId}. Pass confirm:true.`,\n { dryRun: true },\n );\n }\n const res = await session.roxyon.applications.repoConnect(\n applicationId,\n args.repoUrl,\n args.branch ?? 'main',\n );\n const body = [\n `Connected ${args.repoUrl} (${args.branch ?? 'main'}).`,\n res.deployKey ? `\\nDeploy key (add to the repo, read-only):\\n${res.deployKey}` : '',\n res.webhookUrl ? `\\nWebhook URL: ${res.webhookUrl}` : '',\n res.secret ? `Webhook secret: ${res.secret}` : '',\n res.hint ? `\\n${res.hint}` : '',\n ]\n .filter(Boolean)\n .join('\\n');\n return text(body, {\n ok: true,\n deployKey: res.deployKey,\n webhookUrl: res.webhookUrl,\n secret: res.secret,\n });\n }),\n );\n}\n\n// Re-exported for tests.\nexport { resolveApp };\nexport type { Roxyon, ToolResult };\n","import { AsyncLocalStorage } from 'node:async_hooks';\n\n/**\n * Per-request state for the HTTP transport. The stdio entry never opens a\n * context, so {@link currentContext} returns `{}` there and everything falls\n * back to the env / stored-login behaviour.\n */\nexport interface RequestContext {\n /** Bearer token presented on this HTTP request (from the OAuth layer). */\n token?: string;\n /**\n * True when serving the remote HTTP server. Tools that need the caller's\n * local filesystem (`roxyon_init`, `roxyon_deploy`) refuse in this mode.\n */\n remote?: boolean;\n}\n\nconst storage = new AsyncLocalStorage<RequestContext>();\n\n/** Run `fn` with `ctx` visible to {@link currentContext} for its whole async tree. */\nexport function runWithContext<T>(ctx: RequestContext, fn: () => T): T {\n return storage.run(ctx, fn);\n}\n\n/** The context for the in-flight request, or `{}` on the stdio transport. */\nexport function currentContext(): RequestContext {\n return storage.getStore() ?? {};\n}\n","import { Roxyon, isAuthError } from '@roxyon/api-client';\nimport { endpointsFromEnv, loadCredentials, tokenFromEnv } from '@roxyon/deploy-core';\nimport { currentContext } from './context.js';\n\nexport interface RoxyonSession {\n roxyon: Roxyon;\n preferredSubscription?: string;\n /** how the session was authenticated, for diagnostics */\n source: 'env-token' | 'stored-login' | 'oauth';\n}\n\nexport class NotAuthenticatedError extends Error {\n constructor() {\n super(\n 'Not signed in to Roxyon. Run `roxyon login` in a terminal, or set ROXYON_TOKEN ' +\n \"in this MCP server's environment.\",\n );\n this.name = 'NotAuthenticatedError';\n }\n}\n\n/**\n * Resolve a Roxyon client for a tool call. Order: `ROXYON_TOKEN` env var, then\n * the login stored by the CLI at `~/.roxyon/config.json`.\n */\nexport async function getSession(): Promise<RoxyonSession> {\n const { apiUrl, consoleUrl } = endpointsFromEnv();\n\n // HTTP transport: the bearer token from this request wins over any ambient\n // env/stored credentials, and each request gets its own client.\n const requestToken = currentContext().token;\n if (requestToken) {\n return {\n roxyon: new Roxyon({ sessionToken: requestToken, baseUrl: apiUrl, consoleUrl }),\n source: 'oauth',\n };\n }\n\n const envToken = tokenFromEnv();\n if (envToken) {\n return {\n roxyon: new Roxyon({ sessionToken: envToken, baseUrl: apiUrl, consoleUrl }),\n source: 'env-token',\n };\n }\n const creds = await loadCredentials();\n if (!creds?.sessionToken) throw new NotAuthenticatedError();\n return {\n roxyon: new Roxyon({ sessionToken: creds.sessionToken, baseUrl: apiUrl, consoleUrl }),\n preferredSubscription: creds.subscription,\n source: 'stored-login',\n };\n}\n\nexport function isSessionGone(err: unknown): boolean {\n return err instanceof NotAuthenticatedError || isAuthError(err);\n}\n","import { isSessionGone } from './session.js';\n\nexport interface ToolResult {\n content: Array<{ type: 'text'; text: string }>;\n structuredContent?: Record<string, unknown>;\n isError?: boolean;\n /** SDK's CallToolResult carries an open index signature. */\n [k: string]: unknown;\n}\n\nexport function text(body: string, structured?: Record<string, unknown>): ToolResult {\n return {\n content: [{ type: 'text', text: body }],\n ...(structured ? { structuredContent: structured } : {}),\n };\n}\n\nexport function errorResult(message: string, structured?: Record<string, unknown>): ToolResult {\n return {\n content: [{ type: 'text', text: message }],\n ...(structured ? { structuredContent: structured } : {}),\n isError: true,\n };\n}\n\n/** Wrap a tool body so thrown errors become clean `isError` results. */\nexport async function guard(fn: () => Promise<ToolResult>): Promise<ToolResult> {\n try {\n return await fn();\n } catch (err) {\n if (isSessionGone(err)) {\n return errorResult(\n (err as Error).message ||\n 'Roxyon session expired — run `roxyon login` again, or refresh ROXYON_TOKEN.',\n );\n }\n return errorResult(err instanceof Error ? err.message : String(err));\n }\n}\n"],"mappings":";;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB;;;ACA1B,SAAS,SAAS;AAEX,SAAS,gBAAgB,QAAyB;AACvD,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,aACE;AAAA,MACF,YAAY;AAAA,QACV,MAAM,EAAE,OAAO,EAAE,SAAS,yBAAyB;AAAA,QACnD,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,qBAAqB;AAAA,MAC3D;AAAA,IACF;AAAA,IACA,CAAC,EAAE,MAAM,IAAI,OAAO;AAAA,MAClB,UAAU;AAAA,QACR;AAAA,UACE,MAAM;AAAA,UACN,SAAS;AAAA,YACP,MAAM;AAAA,YACN,MAAM,oCAAoC,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA,wDAAuT,MAAM,OAAO,GAAG,KAAK,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