Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

feat(hostinger): add Mail API connection operations

Rahmane90932bd9102
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 3108e8ae..2456b24b 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -8,6 +8,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.
**Added**
+- `hostinger` add Mail API connection operations
- `integrations` add portable JSON transfer and standalone import adapter
- `integrations` unify native users connections and source-aware execution
- `artifacts` add private per-session screenshot storage and retention
diff --git a/docs/INTEGRATIONS.md b/docs/INTEGRATIONS.md
index 2b6b1c11..e770de71 100644
--- a/docs/INTEGRATIONS.md
+++ b/docs/INTEGRATIONS.md
@@ -174,3 +174,14 @@ metadata only; optional encrypted JSON can carry direct credential values. Impor
are previewed, create-only, unverified, and never change defaults or folder bindings.
See [Integration Bundle v1](INTEGRATION-PORTABILITY.md) for CLI syntax, mappings and
receiver support. There is no mandatory SC dependency or automatic data sharing.
+
+## Hostinger Mail API
+
+Hostinger is one provider with two direct connection methods:
+
+- **Account API token** — existing Hostinger account credential. It can keep serving VPS/DNS and can enumerate Mail API orders when that account has Hostinger Email.
+- **Scoped Mail API token** — a dedicated named connection bound to one Hostinger mail order. Store the Mail API token together with that order ID; MSO refuses a different order at execution time.
+
+The native connection executor supports read-only mail-order/plan/resource/log operations plus reviewed non-secret mailbox management for aliases, forwarders, autoreplies, catch-alls and mailbox deletion. Mailbox creation/password rotation, webhook creation/regeneration, and Mail API-token creation are deliberately not accepted through model/tool JSON because those operations create or consume secret values. Use a private Hostinger/browser flow for those secrets.
+
+Official reference: <https://developers.hostinger.com/> → **Mail**. The API documents Mail Orders, Mailboxes, Aliases, Autoreplies, Forwarders, Catchalls, Webhooks, API Tokens and Logs under `/api/mail/v1`.
diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md
index 8b2e6429..5a30cc31 100644
--- a/docs/PROGRESS.md
+++ b/docs/PROGRESS.md
@@ -1,5 +1,12 @@
## 2026-09-05 — Reconcile new connection-model findings before final publication
+## 2026-09-05 — Hostinger Mail API as a first-class connection capability
+
+Hostinger direct connections now distinguish the existing account API token from a scoped Hostinger Mail API token bound to one mail order. The same User → Provider → Named Connection → Source → Auth resolver drives DNS/VPS and mail operations; scoped Mail tokens cannot be silently redirected to another order.
+
+The reviewed Mail surface covers order/plan discovery, mailboxes, aliases, forwarders, autoreplies, catch-alls, webhooks and logs plus non-secret mutations for aliases/forwarders/autoreplies/catch-alls and mailbox deletion. Secret-bearing flows (mailbox create/password, generated Mail API tokens, generated webhook secrets) stay out of model/tool JSON. Existing SC Hostinger account credentials were verified read-only against the official `/api/mail/v1/orders` endpoint and saw five mail orders; no credential value was copied into native MSO automatically.
+
+
Published main advanced during the security review and introduced five additional CodeQL alerts. The integration model is preserved while migration backups use a no-follow descriptor for permissions and bounded reads; provider deletion reconstructs maps instead of indexed deletion. New HTML tests use the existing parser helper and CLI tests invoke a committed fixed-argv shell fixture rather than constructing source. The home-relative CLI contract now stubs its service manager and proves the expected teardown request without stopping host services. Source fixes and exact HEAD evidence are required again; no concurrent feature or alert is discarded.
## 2026-09-05 — Close final release review regressions
diff --git a/docs/generated/MCP-CATALOG.md b/docs/generated/MCP-CATALOG.md
index bc58e18b..03123f4b 100644
--- a/docs/generated/MCP-CATALOG.md
+++ b/docs/generated/MCP-CATALOG.md
@@ -4,13 +4,13 @@
## Full MSO catalog
-<!-- mcp-toolset: server=1.12.0 version=2026.09.05.9 tools=95 read=46 write=29 exec=20 -->
+<!-- mcp-toolset: server=1.12.0 version=2026.09.05.10 tools=95 read=46 write=29 exec=20 -->
| Fact | Current source value |
|---|---:|
| MCP server | `1.12.0` |
-| Toolset | `2026.09.05.9` |
-| Toolset changed at | `2026-09-05T14:55:00Z` |
+| Toolset | `2026.09.05.10` |
+| Toolset changed at | `2026-09-05T16:12:00Z` |
| Transport tools | **97** |
| Model/operator tools | **95** |
| Read | **46** |
@@ -129,7 +129,7 @@
## ChatGPT static profile
-<!-- mcp-chatgpt-profile: server=1.12.0 version=2026.09.05.9 tools=71 read=37 write=21 exec=13 app-only=2 total=73 -->
+<!-- mcp-chatgpt-profile: server=1.12.0 version=2026.09.05.10 tools=71 read=37 write=21 exec=13 app-only=2 total=73 -->
The ChatGPT profile is a fail-closed static projection defined by `CHATGPT_TOOL_NAMES`. OAuth scope is still enforced independently; project-owned MCP tool names remain dynamic data behind the generic project bridge.
diff --git a/lib/infra/catalog.ts b/lib/infra/catalog.ts
index ad04b48d..e27e85f6 100644
--- a/lib/infra/catalog.ts
+++ b/lib/infra/catalog.ts
@@ -39,10 +39,12 @@ const definitions: Record<InfraProviderId, InfraProviderDefinition> = {
hostinger: {
id: "hostinger",
title: "Hostinger",
- description: "Hostinger portfolio/VPS verification and DNS record automation for domains hosted in hPanel.",
+ description: "Hostinger VPS/DNS plus Hostinger Mail orders, mailboxes, aliases, forwarders, autoreplies and catch-alls.",
feature: false,
fields: [
- { key: "apiToken", label: "API token", secret: true, required: true, description: "Hostinger API token. DNS writes replace only the requested name/type RR-set." },
+ { key: "apiToken", label: "Account API token", secret: true, required: false, description: "Hostinger account API token for VPS, DNS and account-level Mail API access." },
+ { key: "mailApiToken", label: "Mail API token", secret: true, required: false, description: "Optional mailbox-scoped Hostinger Email API token." },
+ { key: "mailOrderId", label: "Mail order ID", secret: false, required: false, description: "Mail order resource ID bound to a scoped Email API token." },
],
},
};
@@ -95,6 +97,10 @@ export function normalizeInfraValues(id: InfraProviderId, raw: Record<string, un
let url: URL; try { url = new URL(out.apiUrl); } catch { throw new Error("Invalid deployment URL"); }
if (url.username || url.password || url.search || url.hash || (url.protocol !== "https:" && !(url.protocol === "http:" && ["localhost", "127.0.0.1", "[::1]"].includes(url.hostname)))) throw new Error("Invalid deployment URL");
}
- if (id === "hostinger" && out.apiToken && out.apiToken.length < 24) throw new Error("Hostinger API token is too short");
+ if (id === "hostinger") {
+ if (out.apiToken && out.apiToken.length < 24) throw new Error("Hostinger API token is too short");
+ if (out.mailApiToken && out.mailApiToken.length < 24) throw new Error("Hostinger Mail API token is too short");
+ if (out.mailOrderId && !/^[A-Za-z0-9._-]{3,128}$/.test(out.mailOrderId)) throw new Error("Invalid Hostinger Mail order ID");
+ }
return out;
}
diff --git a/lib/infra/clients.ts b/lib/infra/clients.ts
index 175217cf..4d6b9bd1 100644
--- a/lib/infra/clients.ts
+++ b/lib/infra/clients.ts
@@ -11,6 +11,7 @@ import { doctorComposio } from "./composio";
export { listCloudflareZones, upsertCloudflareDns } from "./cloudflare";
export { ensureDokployProject, listDokployProjects } from "./dokploy";
export { upsertHostingerDns } from "./hostinger";
+export { listHostingerMailOrders, getHostingerMailPlan, listHostingerMail, listHostingerMailLogs, mutateHostingerMail } from "./hostinger-mail";
export async function doctorInfraProvider(id: InfraProviderId, candidate?: InfraProviderValues): Promise<InfraDoctorResult> {
try {
diff --git a/lib/infra/connection-dispatch.ts b/lib/infra/connection-dispatch.ts
index c831d07a..07d1a3bd 100644
--- a/lib/infra/connection-dispatch.ts
+++ b/lib/infra/connection-dispatch.ts
@@ -2,7 +2,7 @@ import { integrationManage } from "./connection-manage";
import { integrationQuery, withIntegrationSelection, resolveIntegration } from "./connection-service";
import { authorizeIntegration, composioConnectionCall } from "./connection-external";
import { IntegrationError, identity, metadataOnly, type ConnectionSelector } from "./identity";
-import { doctorInfraProvider, ensureDokployProject, listDokployProjects, listCloudflareZones, upsertCloudflareDns, upsertHostingerDns } from "./clients";
+import { doctorInfraProvider, ensureDokployProject, listDokployProjects, listCloudflareZones, upsertCloudflareDns, upsertHostingerDns, listHostingerMailOrders, getHostingerMailPlan, listHostingerMail, listHostingerMailLogs, mutateHostingerMail } from "./clients";
import { isInfraProviderId } from "./catalog";
export const safeActionInput=(input:Record<string,unknown>)=>Object.fromEntries(Object.entries(input).filter(([key])=>key!=="workflow_id"));
export const selectionFrom=(a:Record<string,unknown>):ConnectionSelector=>({user:typeof a.user==="string"?a.user:undefined,connection:typeof a.connection==="string"?a.connection:undefined,cwd:typeof a.cwd==="string"?a.cwd:undefined});
@@ -29,6 +29,12 @@ export async function executeIntegrationAction(raw:Record<string,unknown>){
"cloudflare.zones.list":{provider:"cloudflare",fields:[],run:()=>listCloudflareZones()},
"cloudflare.dns.upsert":{provider:"cloudflare",fields:["name","type","content","ttl","proxied"],run:()=>upsertCloudflareDns(args as Parameters<typeof upsertCloudflareDns>[0])},
"hostinger.dns.upsert":{provider:"hostinger",fields:["name","type","content","ttl"],run:()=>upsertHostingerDns(args as Parameters<typeof upsertHostingerDns>[0])},
+ "hostinger.mail.orders.list":{provider:"hostinger",fields:[],run:()=>listHostingerMailOrders()},
+ "hostinger.mail.plan.get":{provider:"hostinger",fields:["orderId"],run:()=>getHostingerMailPlan((args as Record<string,unknown>).orderId)},
+ "hostinger.mail.list":{provider:"hostinger",fields:["orderId","resource","page"],run:()=>listHostingerMail((args as Record<string,unknown>).orderId,(args as Record<string,unknown>).resource,(args as Record<string,unknown>).page as number)},
+ "hostinger.mail.logs.list":{provider:"hostinger",fields:["orderId","kind","page"],run:()=>listHostingerMailLogs((args as Record<string,unknown>).orderId,(args as Record<string,unknown>).kind,(args as Record<string,unknown>).page as number)},
+ "hostinger.mail.mutate":{provider:"hostinger",fields:["orderId","mailboxId","aliasId","forwarderId","autoreplyId","catchallId","localPart","destination","keepCopy","subject","body","displayName","startsAt","endsAt","action"],run:()=>mutateHostingerMail(String((args as Record<string,unknown>).action),args as Record<string,unknown>)},
+
};
const verb=verbs[operation];if(!verb||verb.provider!==provider)throw new IntegrationError("provider_operation_mismatch");
if(route.source!=="direct")throw new IntegrationError("external_source_requires_own_executor",409);
diff --git a/lib/infra/connection-registry.ts b/lib/infra/connection-registry.ts
index 7fb1524c..8c7533a4 100644
--- a/lib/infra/connection-registry.ts
+++ b/lib/infra/connection-registry.ts
@@ -17,7 +17,7 @@ export function providerDefinition(provider:string) {
}
export function connectionMethods(provider:string, source:ConnectionSource) {
const p=providerDefinition(provider);
- if(source==="direct") return setupMethods(p.id).map(m=>({id:m.id as string,label:m.label,scope:provider==="convex-cloud"?(m.id==="deployment"?"deployment":"account"):provider==="composio"?m.id:provider==="dokploy"?"server":"account",fields:setupFields(p.id,m.id),guidance:setupGuidance(p.id,m.id)}));
+ if(source==="direct") return setupMethods(p.id).map(m=>({id:m.id as string,label:m.label,scope:provider==="convex-cloud"?(m.id==="deployment"?"deployment":"account"):provider==="composio"?m.id:provider==="dokploy"?"server":provider==="hostinger"&&m.id==="mail"?"mail-order":"account",fields:setupFields(p.id,m.id),guidance:setupGuidance(p.id,m.id)}));
if(source==="composio" && COMPOSIO[provider]) return COMPOSIO[provider].methods.map(id=>({id,label:id==="oauth2"?"OAuth2":"Hosted API key",scope:"account",fields:[],guidance:{url:"https://platform.composio.dev",reference:`https://docs.composio.dev/toolkits/${COMPOSIO[provider].toolkit}`,steps:["Configure a Composio project key under this same credential user.","Choose a matching authentication configuration for this provider and method.","Open the hosted authorization link. Enter credentials only on the provider/Composio page.","Return and refresh status. MSO stores routing identifiers, not provider OAuth tokens."]}}));
if(source==="native-mcp" && NATIVE[provider])return[{id:"provider-oauth",label:"Provider-owned MCP / OAuth",scope:"account",fields:[],guidance:{url:NATIVE[provider].reference,reference:NATIVE[provider].reference,steps:["Connect the provider-owned MCP server in your client.","Complete authorization in that provider's browser flow.","Use this named MSO connection to identify the intended provider route; the authenticated MCP session remains client-owned.","MSO does not copy provider access/refresh tokens or silently fall back to a local key."]}}];
throw new IntegrationError("unsupported_connection_source");
diff --git a/lib/infra/hostinger-mail.test.ts b/lib/infra/hostinger-mail.test.ts
new file mode 100644
index 00000000..1c2d86a2
--- /dev/null
+++ b/lib/infra/hostinger-mail.test.ts
@@ -0,0 +1,59 @@
+import { afterEach, describe, expect, it, vi } from "vitest";
+vi.mock("server-only", () => ({}));
+const readInfraProvider = vi.fn();
+const request = vi.fn();
+vi.mock("./store", () => ({ readInfraProvider }));
+vi.mock("./http", () => ({ obj: (v: unknown) => (v && typeof v === "object" && !Array.isArray(v) ? v : {}) as Record<string, unknown>, request }));
+const api = await import("./hostinger-mail");
+const TOKEN = "synthetic-hostinger-account-token-000001";
+const MAIL = "synthetic-hostinger-mail-token-00000001";
+afterEach(() => { vi.clearAllMocks(); });
+function response(body: unknown, status = 200) { return { ok: status >= 200 && status < 300, status, body, text: JSON.stringify(body) }; }
+describe("Hostinger Mail client", () => {
+ it("verifies an account token through the official Mail orders endpoint", async () => {
+ request.mockResolvedValue(response({ data: [{ id: "ORdemo" }], meta: { total: 1 } }));
+ expect(await api.doctorHostingerMail({ apiToken: TOKEN })).toContain("1 mail order");
+ expect(request.mock.calls[0][0]).toBe("https://developers.hostinger.com/api/mail/v1/orders?per_page=1");
+ expect(request.mock.calls[0][1].headers.authorization).toBe(`Bearer ${TOKEN}`);
+ });
+ it("binds a scoped Mail token to its stored mail order", async () => {
+ readInfraProvider.mockResolvedValue({ mailApiToken: MAIL, mailOrderId: "ORdemo" });
+ request.mockResolvedValue(response({ data: [{ id: "ACdemo" }], meta: { total: 1 } }));
+ await api.listHostingerMail(undefined, "mailboxes");
+ expect(request.mock.calls[0][0]).toContain("/orders/ORdemo/mailboxes?page=1&per_page=100");
+ await expect(api.listHostingerMail("ORother", "mailboxes")).rejects.toThrow("does not match");
+ expect(request).toHaveBeenCalledTimes(1);
+ });
+ it("requires an account token to enumerate mail orders", async () => {
+ readInfraProvider.mockResolvedValue({ mailApiToken: MAIL, mailOrderId: "ORdemo" });
+ await expect(api.listHostingerMailOrders()).rejects.toThrow("account API token required");
+ expect(request).not.toHaveBeenCalled();
+ });
+ it("only permits documented list/log resources", async () => {
+ readInfraProvider.mockResolvedValue({ apiToken: TOKEN }); request.mockResolvedValue(response({ data: [] }));
+ await api.listHostingerMail("ORdemo", "aliases", 2);
+ await api.listHostingerMailLogs("ORdemo", "outbound", 3);
+ expect(request.mock.calls[0][0]).toContain("/orders/ORdemo/aliases?page=2&per_page=100");
+ expect(request.mock.calls[1][0]).toContain("/orders/ORdemo/logs/outbound?page=3&per_page=100");
+ await expect(api.listHostingerMail("ORdemo", "messages")).rejects.toThrow("unsupported");
+ });
+ it("uses exact documented mutation routes and refuses secret-returning/unreviewed operations", async () => {
+ readInfraProvider.mockResolvedValue({ apiToken: TOKEN }); request.mockResolvedValue(response({ id: "AA1" }, 201));
+ await api.mutateHostingerMail("alias.create", { orderId: "ORdemo", mailboxId: "ACdemo", localPart: "support" });
+ expect(request.mock.calls[0][0]).toContain("/mailboxes/ACdemo/aliases");
+ expect(request.mock.calls[0][1].method).toBe("POST");
+ expect(JSON.parse(request.mock.calls[0][1].body)).toEqual({ local_part: "support" });
+ await expect(api.mutateHostingerMail("mailbox.create", { orderId: "ORdemo" })).rejects.toThrow("unsupported");
+ await expect(api.mutateHostingerMail("webhook.create", { orderId: "ORdemo" })).rejects.toThrow("unsupported");
+ await expect(api.mutateHostingerMail("api-token.create", { orderId: "ORdemo" })).rejects.toThrow("unsupported");
+ });
+});
+it("fails closed for a rejected scoped Mail token instead of treating it as merely unverified", async () => {
+ request.mockResolvedValue(response({}, 403));
+ await expect(api.doctorHostingerMail({ mailApiToken: MAIL, mailOrderId: "ORdemo" })).rejects.toThrow("HTTP 403");
+});
+it("advertises scoped Mail credentials as mail-order scope instead of account scope", async () => {
+ const { connectionMethod } = await import("./connection-registry");
+ expect(connectionMethod("hostinger", "direct", "mail").scope).toBe("mail-order");
+ expect(connectionMethod("hostinger", "direct", "direct").scope).toBe("account");
+});
diff --git a/lib/infra/hostinger-mail.ts b/lib/infra/hostinger-mail.ts
new file mode 100644
index 00000000..3f657af7
--- /dev/null
+++ b/lib/infra/hostinger-mail.ts
@@ -0,0 +1,127 @@
+import { readInfraProvider } from "./store";
+import { obj, request } from "./http";
+import type { InfraProviderValues } from "./types";
+
+const API = "https://developers.hostinger.com/api/mail/v1";
+const auth = (token: string) => ({ authorization: `Bearer ${token}`, accept: "application/json", "content-type": "application/json" });
+const ID = /^[A-Za-z0-9._-]{3,128}$/;
+const LOCAL = /^[A-Za-z0-9](?:[A-Za-z0-9._-]{0,48}[A-Za-z0-9])?$/;
+
+function resourceId(value: unknown, name: string) {
+ const text = String(value ?? "");
+ if (!ID.test(text)) throw new Error(`invalid Hostinger Mail ${name}`);
+ return text;
+}
+function email(value: unknown) {
+ const text = String(value ?? "").trim();
+ if (text.length > 254 || !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(text)) throw new Error("invalid email address");
+ return text;
+}
+async function context(order?: unknown) {
+ const values = await readInfraProvider("hostinger");
+ const token = values.mailApiToken || values.apiToken;
+ if (!token) throw new Error("Hostinger Mail is not configured");
+ const stored = values.mailOrderId;
+ const supplied = order ? resourceId(order, "order id") : undefined;
+ if (stored && supplied && stored !== supplied) throw new Error("Hostinger Mail order does not match the selected connection");
+ return { token, orderId: stored || supplied };
+}
+function redact(value: unknown, depth = 0): unknown {
+ if (depth > 16) return "[depth limited]";
+ if (Array.isArray(value)) return value.map(item => redact(item, depth + 1));
+ if (value && typeof value === "object") {
+ return Object.fromEntries(Object.entries(value as Record<string, unknown>).map(([key, item]) => [
+ key,
+ /password|secret|token|authorization|api.?key/i.test(key) ? "[redacted]" : redact(item, depth + 1),
+ ]));
+ }
+ return value;
+}
+async function call(token: string, path: string, method = "GET", body?: unknown) {
+ const res = await request(`${API}${path}`, { method, headers: auth(token), ...(body === undefined ? {} : { body: JSON.stringify(body) }) });
+ if (!res.ok) throw new Error(`Hostinger Mail HTTP ${res.status}`);
+ return redact(res.body);
+}
+function totalRows(body: unknown) {
+ const row = obj(body);
+ return Number(obj(row.meta).total ?? (Array.isArray(row.data) ? row.data.length : 0));
+}
+
+export async function doctorHostingerMail(candidate?: InfraProviderValues) {
+ const values = candidate ?? await readInfraProvider("hostinger");
+ if (values.mailApiToken) {
+ if (!values.mailOrderId) return null;
+ const body = await call(values.mailApiToken, `/orders/${encodeURIComponent(values.mailOrderId)}/mailboxes?per_page=1`);
+ return `mail token valid; ${totalRows(body)} mailbox(es) visible`;
+ }
+ if (values.apiToken) {
+ const res = await request(`${API}/orders?per_page=1`, { headers: auth(values.apiToken) });
+ if (res.ok) return `account token valid; Hostinger Mail API available; ${totalRows(res.body)} mail order(s)`;
+ return null;
+ }
+ return null;
+}
+
+export async function listHostingerMailOrders() {
+ const values = await readInfraProvider("hostinger");
+ if (!values.apiToken || values.mailApiToken) throw new Error("Hostinger account API token required to list mail orders");
+ return call(values.apiToken, "/orders?per_page=100");
+}
+export async function getHostingerMailPlan(order: unknown) {
+ const selected = await context(order);
+ if (!selected.orderId) throw new Error("Hostinger Mail order id required");
+ return call(selected.token, `/orders/${encodeURIComponent(selected.orderId)}/plan`);
+}
+
+const LIST = new Set(["mailboxes", "aliases", "forwarders", "autoreplies", "catchalls", "webhooks"]);
+export async function listHostingerMail(order: unknown, resource: unknown, page = 1) {
+ const kind = String(resource);
+ if (!LIST.has(kind)) throw new Error("unsupported Hostinger Mail resource");
+ const selected = await context(order);
+ if (!selected.orderId) throw new Error("Hostinger Mail order id required");
+ const current = Math.max(1, Math.min(100, Number(page) || 1));
+ return call(selected.token, `/orders/${encodeURIComponent(selected.orderId)}/${kind}?page=${current}&per_page=100`);
+}
+
+const LOGS = new Set(["access", "action", "inbound", "mailbox-actions", "outbound"]);
+export async function listHostingerMailLogs(order: unknown, kind: unknown, page = 1) {
+ const name = String(kind);
+ if (!LOGS.has(name)) throw new Error("unsupported Hostinger Mail log");
+ const selected = await context(order);
+ if (!selected.orderId) throw new Error("Hostinger Mail order id required");
+ const current = Math.max(1, Math.min(100, Number(page) || 1));
+ return call(selected.token, `/orders/${encodeURIComponent(selected.orderId)}/logs/${name}?page=${current}&per_page=100`);
+}
+
+export async function mutateHostingerMail(operation: string, args: Record<string, unknown>) {
+ const selected = await context(args.orderId);
+ const mailbox = () => resourceId(args.mailboxId, "mailbox id");
+ const id = (key: string) => resourceId(args[key], key);
+ switch (operation) {
+ case "alias.create": {
+ const part = String(args.localPart ?? "").toLowerCase();
+ if (!LOCAL.test(part) || part.length > 50) throw new Error("invalid alias local part");
+ return call(selected.token, `/mailboxes/${mailbox()}/aliases`, "POST", { local_part: part });
+ }
+ case "alias.delete": return call(selected.token, `/aliases/${id("aliasId")}`, "DELETE");
+ case "forwarder.create": return call(selected.token, `/mailboxes/${mailbox()}/forwarders`, "POST", { destination: email(args.destination), is_keep_copy_enabled: args.keepCopy === true });
+ case "forwarder.delete": return call(selected.token, `/forwarders/${id("forwarderId")}`, "DELETE");
+ case "forwarder.resend": return call(selected.token, `/forwarders/${id("forwarderId")}/confirmation/resend`, "POST");
+ case "forwarder.keep-copy": return call(selected.token, `/forwarders/${id("forwarderId")}/keep-copy`, "PATCH", { is_keep_copy_enabled: args.keepCopy === true });
+ case "autoreply.create":
+ case "autoreply.update": {
+ const subject = String(args.subject ?? ""), body = String(args.body ?? "");
+ if (!subject || subject.length > 500 || !body || body.length > 20_000) throw new Error("invalid autoreply content");
+ const payload = { subject, body, ...(args.displayName ? { display_name: String(args.displayName).slice(0, 255) } : {}), ...(args.startsAt ? { starts_at: String(args.startsAt) } : {}), ...(args.endsAt ? { ends_at: String(args.endsAt) } : {}) };
+ return operation.endsWith("create")
+ ? call(selected.token, `/mailboxes/${mailbox()}/autoreplies`, "POST", payload)
+ : call(selected.token, `/autoreplies/${id("autoreplyId")}`, "PUT", payload);
+ }
+ case "autoreply.delete": return call(selected.token, `/autoreplies/${id("autoreplyId")}`, "DELETE");
+ case "catchall.create": return call(selected.token, `/mailboxes/${mailbox()}/catchalls`, "POST");
+ case "catchall.delete": return call(selected.token, `/catchalls/${id("catchallId")}`, "DELETE");
+ case "catchall.resend": return call(selected.token, `/catchalls/${id("catchallId")}/confirmation/resend`, "POST");
+ case "mailbox.delete": return call(selected.token, `/mailboxes/${mailbox()}`, "DELETE");
+ default: throw new Error("unsupported Hostinger Mail mutation");
+ }
+}
diff --git a/lib/infra/hostinger.ts b/lib/infra/hostinger.ts
index 8d982f90..0185dbbc 100644
--- a/lib/infra/hostinger.ts
+++ b/lib/infra/hostinger.ts
@@ -1,16 +1,20 @@
import type { InfraProviderValues } from "./types";
import { readInfraProvider } from "./store";
import { HOST_RE, IPV4_RE, obj, request } from "./http";
+import { doctorHostingerMail } from "./hostinger-mail";
const API = "https://developers.hostinger.com/api";
const headers = (token: string) => ({ authorization: `Bearer ${token}`, accept: "application/json", "content-type": "application/json" });
export async function doctorHostinger(candidate?: InfraProviderValues): Promise<string | null> {
const values = candidate ?? await readInfraProvider("hostinger");
+ if (values.mailApiToken) return doctorHostingerMail(values);
+ const mail = await doctorHostingerMail(values).catch(() => null);
+ if (mail) return mail;
if (!values.apiToken) return null;
const res = await request(`${API}/vps/v1/virtual-machines`, { headers: headers(values.apiToken) });
if (!res.ok) throw new Error(`Hostinger HTTP ${res.status}`);
- return `token valid; ${Array.isArray(res.body) ? res.body.length : 0} VPS visible`;
+ return `account token valid; ${Array.isArray(res.body) ? res.body.length : 0} VPS visible; Mail API unavailable for this token/account`;
}
async function rootFor(fullDomain: string, token: string): Promise<{ root: string; name: string }> {
diff --git a/lib/infra/portable/mapping.ts b/lib/infra/portable/mapping.ts
index ef069295..e8e4a1c4 100644
--- a/lib/infra/portable/mapping.ts
+++ b/lib/infra/portable/mapping.ts
@@ -3,7 +3,7 @@ export const FIELD_MAP:Record<string,Record<string,string>>={
github:{GITHUB_TOKEN:'apiKey',GH_OWNER:'owner'},
dokploy:{DOKPLOY_API_URL:'apiUrl',DOKPLOY_API_KEY:'apiKey',DOKPLOY_PUBLIC_IP:'publicIp'},
cloudflare:{CLOUDFLARE_API_TOKEN:'apiToken',CLOUDFLARE_ZONE_ID:'zoneId',CLOUDFLARE_ACCOUNT_ID:'accountId'},
- hostinger:{HOSTINGER_API_TOKEN:'apiToken'},
+ hostinger:{HOSTINGER_API_TOKEN:'apiToken',HOSTINGER_MAIL_API_TOKEN:'mailApiToken',HOSTINGER_MAIL_ORDER_ID:'mailOrderId'},
composio:{COMPOSIO_API_KEY:'apiKey',COMPOSIO_ORG_API_KEY:'orgApiKey'},
'convex-cloud':{CONVEX_PERSONAL_ACCESS_TOKEN:'personalToken',CONVEX_DEPLOY_KEY:'deployKey',CONVEX_DEPLOYMENT_NAME:'deploymentName'},
convex:{CONVEX_ADMIN_KEY:'adminKey',CONVEX_URL:'apiUrl'},
@@ -16,12 +16,13 @@ export const FIELD_MAP:Record<string,Record<string,string>>={
const DIRECT:Record<string,string>={github:'classic-pat',dokploy:'admin-api-key',cloudflare:'api-token',hostinger:'api-token',convex:'self-hosted-admin',vercel:'account-token',stripe:'secret-key',resend:'api-key',clerk:'instance-keys',supabase:'personal-access-token'};
export function wireMethod(provider:string,source:string,method:string){
if(source!=='direct')return source==='native-mcp'?'provider-oauth':method;
- return provider==='composio'?(method==='organization'?'organization-token':'project-api-key'):provider==='convex-cloud'?(method==='deployment'?'deployment-key':'personal-access-token'):DIRECT[provider]??method;
+ return provider==='composio'?(method==='organization'?'organization-token':'project-api-key'):provider==='convex-cloud'?(method==='deployment'?'deployment-key':'personal-access-token'):provider==='hostinger'?(method==='mail'?'mail-api-token':'api-token'):DIRECT[provider]??method;
}
export function nativeMethod(provider:string,source:string,method:string){
if(source==='native-mcp')return ['provider-oauth','dcr-oauth','mcp-oauth'].includes(method)?'provider-oauth':method;
if(source!=='direct')return method;
if(provider==='composio')return({'project-api-key':'project','organization-token':'organization'} as Record<string,string>)[method]??method;
if(provider==='convex-cloud')return({'deployment-key':'deployment','personal-access-token':'personal'} as Record<string,string>)[method]??method;
+ if(provider==='hostinger')return({'mail-api-token':'mail','api-token':'direct'} as Record<string,string>)[method]??method;
return method===DIRECT[provider]?'direct':method;
}
diff --git a/lib/infra/setup-guidance.ts b/lib/infra/setup-guidance.ts
index 82b75030..9152ca41 100644
--- a/lib/infra/setup-guidance.ts
+++ b/lib/infra/setup-guidance.ts
@@ -2,8 +2,13 @@ import { ADDITIONAL_GUIDANCE, type AdditionalProviderId } from "./additional-pro
import { getInfraProviderDefinition } from "./catalog";
import type { InfraProviderId } from "./types";
-export type SetupMethod = "direct" | "project" | "organization" | "personal" | "deployment";
+export type SetupMethod = "direct" | "project" | "organization" | "personal" | "deployment" | "mail";
export function setupFields(provider: InfraProviderId, method: SetupMethod) {
+ if (provider === "hostinger") {
+ if (!["direct", "mail"].includes(method)) throw new Error("Choose Hostinger account or scoped Mail API token");
+ const keys = method === "mail" ? ["mailApiToken", "mailOrderId"] : ["apiToken"];
+ return getInfraProviderDefinition(provider).fields.filter(f => keys.includes(f.key)).map(f => ({ ...f, required: true }));
+ }
if (provider === "convex-cloud") {
if (!["personal", "deployment"].includes(method)) throw new Error("Choose a Convex personal token or deployment key");
const keys = method === "personal" ? ["personalToken"] : ["deployKey", "deploymentName"];
@@ -18,11 +23,12 @@ export function setupFields(provider: InfraProviderId, method: SetupMethod) {
}
export function setupMethod(provider: InfraProviderId, method?: string): SetupMethod {
const value = method ?? (provider === "composio" ? "project" : provider === "convex-cloud" ? "personal" : "direct");
- if (!["direct", "project", "organization", "personal", "deployment"].includes(value)) throw new Error("Unsupported authentication method");
+ if (!["direct", "project", "organization", "personal", "deployment", "mail"].includes(value)) throw new Error("Unsupported authentication method");
setupFields(provider, value as SetupMethod);
return value as SetupMethod;
}
export function setupMethods(provider: InfraProviderId): Array<{id: SetupMethod; label: string}> {
+ if (provider === "hostinger") return [{ id: "direct", label: "Account API token" }, { id: "mail", label: "Scoped Mail API token" }];
if (provider === "composio") return [{ id: "project", label: "Project API key" }, { id: "organization", label: "Organization API key" }];
if (provider === "convex-cloud") return [{ id: "personal", label: "Personal access token" }, { id: "deployment", label: "Deployment key" }];
return [{ id: "direct", label: "Direct credential" }];
@@ -45,7 +51,7 @@ export function setupGuidance(provider: InfraProviderId, method: SetupMethod) {
hostinger: {
url: "https://hpanel.hostinger.com/",
reference: "https://developers.hostinger.com/",
- steps: ["Sign in to the intended Hostinger account.", "Open Dev Tools → API in the hPanel sidebar.", "Create a named token with a limited expiry. It inherits the owning account permissions.", "Copy it into this form. MSO validates access before saving."],
+ steps: method === "mail" ? ["Use the Hostinger Mail API token created for the intended mail order.", "Keep its scope limited to only the mailboxes this connection should manage.", "Copy the token and its mail order ID into this named connection.", "MSO validates it by listing one mailbox from that exact order."] : ["Sign in to the intended Hostinger account.", "Open Dev Tools → API in the hPanel sidebar.", "Create a named account token with a limited expiry.", "This token can manage VPS/DNS and, when the account has mail service, Hostinger Mail API orders."],
},
dokploy: {
url: "https://docs.dokploy.com/docs/core/api",
diff --git a/lib/infra/store.ts b/lib/infra/store.ts
index 2f020f3c..bd93f0b4 100644
--- a/lib/infra/store.ts
+++ b/lib/infra/store.ts
@@ -35,6 +35,7 @@ export function summarizeInfraProvider(id: InfraProviderId, values: InfraProvide
const def = getInfraProviderDefinition(id);
const missing = def.fields.filter((field) => field.required && !values[field.key]).map((field) => field.key);
if (id === "composio" && !values.apiKey && !values.orgApiKey) missing.push("project or organization API key");
+ if (id === "hostinger" && !values.apiToken && !(values.mailApiToken && values.mailOrderId)) missing.push("account token or scoped Mail API token + order ID");
if (id === "convex-cloud" && !values.personalToken && !(values.deployKey && values.deploymentName)) missing.push("personal token or deployment key and name");
const safeValues = Object.fromEntries(def.fields
.filter((field) => values[field.key])
diff --git a/lib/mcp/tools-integrations.ts b/lib/mcp/tools-integrations.ts
index b6e93db4..e37e876c 100644
--- a/lib/mcp/tools-integrations.ts
+++ b/lib/mcp/tools-integrations.ts
@@ -19,7 +19,7 @@ export const INTEGRATION_TOOLS:McpTool[]=[
},
{name:"integration_execute",title:"Use an Exact Integration Connection",scope:"exec",annotations:{readOnlyHint:false,destructiveHint:true,openWorldHint:true},audit:{action:"infra.write",targetArg:"connection"},limit:{key:"integration.execute",max:30,windowMs:60000},
description:"Execute using an explicit user/provider/named connection. Verify or inspect its route; bounded direct operations reject external backends. Composio tool execution requires an ACTIVE matching connected account and a toolkit-prefixed tool. Native-MCP returns the provider route without copying OAuth tokens. Non-verification operations require confirm=true. No credentials in arguments.",
- inputSchema:S({...BASE,operation:{type:"string",enum:["route","verify","dokploy.projects.list","dokploy.project.ensure","cloudflare.zones.list","cloudflare.dns.upsert","hostinger.dns.upsert","composio.tool"]},confirm:{type:"boolean"},tool:{type:"string",maxLength:180},arguments:{type:"object",additionalProperties:true}},["user","provider","connection","operation"]),outputSchema:OUTPUT,
+ inputSchema:S({...BASE,operation:{type:"string",enum:["route","verify","dokploy.projects.list","dokploy.project.ensure","cloudflare.zones.list","cloudflare.dns.upsert","hostinger.dns.upsert","hostinger.mail.orders.list","hostinger.mail.plan.get","hostinger.mail.list","hostinger.mail.logs.list","hostinger.mail.mutate","composio.tool"]},confirm:{type:"boolean"},tool:{type:"string",maxLength:180},arguments:{type:"object",additionalProperties:true}},["user","provider","connection","operation"]),outputSchema:OUTPUT,
meta:{ui:{visibility:["model","app"]},"openai/widgetAccessible":true},run:async a=>({result:await executeIntegrationAction(a)}),
},
];
diff --git a/lib/mcp/toolset.ts b/lib/mcp/toolset.ts
index 685b12a4..0a3fa059 100644
--- a/lib/mcp/toolset.ts
+++ b/lib/mcp/toolset.ts
@@ -4,8 +4,8 @@ import type { McpTool } from "./tool-kit";
import { toolDescriptor, type McpToolProfile } from "./tool-contract";
export const MCP_SERVER_VERSION = "1.12.0";
-export const MCP_TOOLSET_VERSION = "2026.09.05.9";
-export const MCP_TOOLSET_CHANGED_AT = "2026-09-05T14:55:00Z";
+export const MCP_TOOLSET_VERSION = "2026.09.05.10";
+export const MCP_TOOLSET_CHANGED_AT = "2026-09-05T16:12:00Z";
export type McpToolsetInfo = {
serverVersion: string;
diff --git a/lib/mcp/ui-resources.test.ts b/lib/mcp/ui-resources.test.ts
index 629dfc51..a7ea8fc2 100644
--- a/lib/mcp/ui-resources.test.ts
+++ b/lib/mcp/ui-resources.test.ts
@@ -150,7 +150,7 @@ describe("MCP Apps Block and Page contract", () => {
frameDomains: ["https://game.rahmanef.com"],
});
expect(content._meta["openai/widgetCSP"]).toEqual({ connect_domains: [MSO_ORIGIN], frame_domains: ["https://game.rahmanef.com"], redirect_domains: [MSO_ORIGIN, "https://game.rahmanef.com"] });
- expect(MSO_PAGE_URI).toContain("page-v8.html");
+ expect(MSO_PAGE_URI).toContain("page-v9.html");
});
it("returns only redacted structured workflow state and keeps status polling out of workflow memory", async () => {
diff --git a/lib/mcp/ui-resources.ts b/lib/mcp/ui-resources.ts
index e6bd3662..63b7c3d6 100644
--- a/lib/mcp/ui-resources.ts
+++ b/lib/mcp/ui-resources.ts
@@ -8,6 +8,7 @@ export const MCP_APP_MIME_TYPE = "text/html;profile=mcp-app";
// across the UI-contract migration. They are intentionally not advertised by
// resources/list: the public product contract has exactly Block and Page.
export const LEGACY_BLOCK_V1_URI = "ui://mso/block-v1.html";
+export const LEGACY_PAGE_V8_URI = "ui://mso/page-v8.html";
export const LEGACY_PAGE_V7_URI = "ui://mso/page-v7.html";
export const LEGACY_PAGE_V6_URI = "ui://mso/page-v6.html";
export const LEGACY_PAGE_V5_URI = "ui://mso/page-v5.html";
@@ -29,6 +30,7 @@ export type McpUiResource = {
const RESOURCES: readonly McpUiResource[] = [MSO_BLOCK_RESOURCE, MSO_PAGE_RESOURCE];
const LEGACY_ALIASES = new Map<string, McpUiResource>([
+ [LEGACY_PAGE_V8_URI, MSO_PAGE_RESOURCE],
[LEGACY_PAGE_V7_URI, MSO_PAGE_RESOURCE],
[LEGACY_PAGE_V6_URI, MSO_PAGE_RESOURCE],
[LEGACY_PAGE_V5_URI, MSO_PAGE_RESOURCE],
diff --git a/lib/mcp/ui-surface.ts b/lib/mcp/ui-surface.ts
index 9f4889b6..b65b7ba8 100644
--- a/lib/mcp/ui-surface.ts
+++ b/lib/mcp/ui-surface.ts
@@ -6,7 +6,7 @@ import { surfaceFrameDomains } from "./surface-catalog";
import { MSO_SURFACE_SCRIPT } from "./ui-surface-script";
import { MSO_SURFACE_STYLE } from "./ui-surface-style";
-export const MSO_PAGE_URI = "ui://mso/page-v8.html";
+export const MSO_PAGE_URI = "ui://mso/page-v9.html";
const MIME = "text/html;profile=mcp-app";
const html = String.raw`<main class="surface" aria-label="MSO Page">
diff --git a/scripts/cli/commands.sh b/scripts/cli/commands.sh
index 27b1757a..d5abf00f 100755
--- a/scripts/cli/commands.sh
+++ b/scripts/cli/commands.sh
@@ -24,7 +24,7 @@ verbs() {
U_camoufox="camoufox status|start|stop|session"
U_gateway="gateway start [--config <cloudflared.yml> --tunnel <name|uuid>]|stop|status|url|doctor|install|domain show|set <https://host>|clear"
U_doctor="doctor [--fix]"
-U_integrations="integrations transfer|status|users|catalog|connections [user] [provider]|which [folder]|request|resolve <user> <provider> [connection]|create-user <id> [label]|create-connection <user> <provider> <id> <source> <auth>|manage <JSON>|setup|verify <user> <provider> <connection>|execute <JSON>"
+U_integrations="integrations transfer|status|users|catalog|connections [user] [provider]|which [folder]|request|resolve <user> <provider> [connection]|create-user <id> [label]|create-connection <user> <provider> <id> <source> <auth>|manage <JSON>|setup|verify <user> <provider> <connection>|hostinger-mail-orders|hostinger-mail-list|hostinger-mail-logs|execute <JSON>"
U_provider="provider list|show <id>|setup <provider> <user> <connection>|set <id>|rm <id>|doctor [id]|projects|zones"
U_model="model [current|list [provider]|set <provider> <model>|set <provider/model>|<model-or-ref>]"
U_agent="agent [--continue|-c|--resume|-r <latest|index|id|title>|--yolo|-yolo] | agent --oneshot <prompt> [--json] [--approve-scope read|write|exec]"
diff --git a/scripts/mso-cli-integrations.sh b/scripts/mso-cli-integrations.sh
index 8ab9609d..deb1eafd 100644
--- a/scripts/mso-cli-integrations.sh
+++ b/scripts/mso-cli-integrations.sh
@@ -35,7 +35,6 @@ run_integrations() {
[ $# -eq 1 ] || die 'usage: mso integrations manage <metadata-JSON with action and confirm:true>'
body=$(jq -ce 'if type=="object" and .confirm==true then .+{mode:"manage"} else error("explicit confirmation required") end' <<<"$1")
data=$(jpost "/api/v1/integrations" "$body")
- # Hosted authorization links must not be emitted by non-interactive agent calls.
if jq -e '.privateUrl' >/dev/null <<<"$data"; then
if tty_ok; then jq . <<<"$data"; else jq 'del(.privateUrl)+{notice:"Authorization link available only in the private UI or interactive terminal"}' <<<"$data"; fi
else printf '%s\n' "$data"; fi ;;
@@ -43,10 +42,22 @@ run_integrations() {
[ $# -eq 3 ] || die "usage: mso integrations $sub <user> <provider> <connection>"
body=$(jq -nc --arg op "$sub" --arg user "$1" --arg provider "$2" --arg connection "$3" '{mode:"execute",operation:$op,user:$user,provider:$provider,connection:$connection}')
jpost "/api/v1/integrations" "$body" ;;
+ hostinger-mail-orders)
+ [ $# -eq 2 ] || die "usage: mso integrations hostinger-mail-orders <user> <connection>"
+ body=$(jq -nc --arg user "$1" --arg connection "$2" '{mode:"execute",operation:"hostinger.mail.orders.list",user:$user,provider:"hostinger",connection:$connection,confirm:true,arguments:{}}')
+ jpost "/api/v1/integrations" "$body" ;;
+ hostinger-mail-list)
+ [ $# -ge 3 ] || die "usage: mso integrations hostinger-mail-list <user> <connection> <mailboxes|aliases|forwarders|autoreplies|catchalls|webhooks> [orderId] [page]"
+ body=$(jq -nc --arg user "$1" --arg connection "$2" --arg resource "$3" --arg orderId "${4-}" --argjson page "${5:-1}" '{mode:"execute",operation:"hostinger.mail.list",user:$user,provider:"hostinger",connection:$connection,confirm:true,arguments:({resource:$resource,page:$page}+if $orderId!="" then {orderId:$orderId} else {} end)}')
+ jpost "/api/v1/integrations" "$body" ;;
+ hostinger-mail-logs)
+ [ $# -ge 3 ] || die "usage: mso integrations hostinger-mail-logs <user> <connection> <access|action|inbound|mailbox-actions|outbound> [orderId] [page]"
+ body=$(jq -nc --arg user "$1" --arg connection "$2" --arg kind "$3" --arg orderId "${4-}" --argjson page "${5:-1}" '{mode:"execute",operation:"hostinger.mail.logs.list",user:$user,provider:"hostinger",connection:$connection,confirm:true,arguments:({kind:$kind,page:$page}+if $orderId!="" then {orderId:$orderId} else {} end)}')
+ jpost "/api/v1/integrations" "$body" ;;
execute)
[ $# -eq 1 ] || die 'usage: mso integrations execute <metadata-JSON with user, provider, connection, operation and confirm:true>'
body=$(jq -ce 'if type=="object" then .+{mode:"execute"} else error("object required") end' <<<"$1")
jpost "/api/v1/integrations" "$body" ;;
- *) die 'usage: mso integrations status|users|catalog|connections|which|request|resolve|create-user|create-connection|manage|setup|verify|route|execute' ;;
+ *) die 'usage: mso integrations transfer|status|users|catalog|connections|which|request|resolve|create-user|create-connection|manage|setup|verify|route|hostinger-mail-orders|hostinger-mail-list|hostinger-mail-logs|execute' ;;
esac
}