@prontosite/mcp 0.9.0 → 0.9.1
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/api.mjs +27 -8
- package/index.mjs +3 -3
- package/package.json +1 -1
package/api.mjs
CHANGED
|
@@ -69,7 +69,9 @@ export function resolveTarget(cfg, site) {
|
|
|
69
69
|
if (!key) throw new Error(`„${label}" ist kein Profil in deiner sites-Map. Verfügbar: ${keys.join(", ")}.`);
|
|
70
70
|
return { token: needToken(cfg.sites[key].token, key), slug: "new" };
|
|
71
71
|
}
|
|
72
|
-
|
|
72
|
+
// Einzel-/Betreuer-Token: „<Konto-ID>:new" trägt die Ziel-Konto-ID (k-…) im Label → als customer
|
|
73
|
+
// durchreichen (Betreuer-Erst-Import ohne separaten customer-Parameter). Bare „new" hat keine.
|
|
74
|
+
return { token: needToken(cfg.token, "new"), slug: "new", customer: newMatch ? newMatch[1] : null };
|
|
73
75
|
}
|
|
74
76
|
if (cfg.sites) {
|
|
75
77
|
const keys = Object.keys(cfg.sites);
|
|
@@ -125,20 +127,36 @@ export async function apiExport(cfg, { site, which = "published", outDir = "." }
|
|
|
125
127
|
/** POST /api/deploy/<site> – ZIP übergeben (+ optional publish/resetOverlay/legal). site="new" = anlegen. */
|
|
126
128
|
export async function apiDeploy(cfg, { site, customer = null, slug: wishSlug = null, zipPath, publish = false, resetOverlay = false, legal = null, company = null, siteOverride = false } = {}, fetchImpl = fetch) {
|
|
127
129
|
if (!zipPath || !fs.existsSync(zipPath)) throw new Error(`ZIP nicht gefunden: ${zipPath}`);
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
const
|
|
130
|
+
const target = resolveTarget(cfg, site);
|
|
131
|
+
const { token, slug } = target;
|
|
132
|
+
const isNew = slug === "new";
|
|
133
|
+
const effCustomer = customer || target.customer || null; // „<Konto-ID>:new" liefert customer; sonst Parameter
|
|
134
|
+
const hasCompany = company && typeof company === "object";
|
|
135
|
+
// Bestandssite: Firmendaten VOR dem Deploy (Rechtstext-Automatik nutzt sie sofort). ERST-Import: NICHT vorab –
|
|
136
|
+
// die Website existiert noch nicht (company-/legal-Gate → 404); Firmendaten kommen NACH dem Anlegen (unten).
|
|
137
|
+
if (hasCompany && !isNew) await apiCompanySet(cfg, { site, company, siteOverride }, fetchImpl);
|
|
131
138
|
const q = new URLSearchParams();
|
|
132
139
|
if (publish) q.set("publish", "1");
|
|
133
140
|
if (resetOverlay) q.set("resetOverlay", "1");
|
|
134
141
|
if (legal === true) q.set("legal", "1");
|
|
135
142
|
if (legal === false) q.set("legal", "0");
|
|
136
|
-
if (
|
|
143
|
+
if (effCustomer) q.set("customer", effCustomer); // Betreuer-Token + „new": Ziel-Konto für den Erst-Import
|
|
137
144
|
if (wishSlug) q.set("slug", String(wishSlug)); // Erst-Import: Wunsch-Adresse (sonst wird sie abgeleitet)
|
|
138
145
|
const qs = q.toString() ? `?${q}` : "";
|
|
139
146
|
const res = await fetchImpl(`${baseUrl(cfg)}/deploy/${encodeURIComponent(slug)}${qs}`, {
|
|
140
147
|
method: "POST", headers: { ...authHeaders(token), "content-type": "application/zip" }, body: fs.readFileSync(zipPath) });
|
|
141
|
-
|
|
148
|
+
const out = await asJson(res);
|
|
149
|
+
// ERST-Import + Firmendaten: jetzt auf die ERSTELLTE Website setzen (out.slug/out.site). Hinweis: die beim
|
|
150
|
+
// Erst-Import automatisch erzeugten Rechtstexte kennen diese Daten noch nicht – ein erneuter Rechts-Lauf/
|
|
151
|
+
// Publish übernimmt sie. Das melden wir als companyApplied/companyNote statt still zu lassen.
|
|
152
|
+
if (hasCompany && isNew && out && (out.slug || out.site)) {
|
|
153
|
+
try {
|
|
154
|
+
await apiCompanySet(cfg, { site: out.slug || out.site, company, siteOverride }, fetchImpl);
|
|
155
|
+
out.companyApplied = true;
|
|
156
|
+
if (out.legal && !out.legal.disabled) out.companyNote = "Firmendaten wurden NACH dem Erst-Import gesetzt – die automatisch erzeugten Rechtstexte übernehmen sie erst beim nächsten Rechts-Lauf/Publish.";
|
|
157
|
+
} catch (e) { out.companyApplied = false; out.companyError = e.message; }
|
|
158
|
+
}
|
|
159
|
+
return out;
|
|
142
160
|
}
|
|
143
161
|
|
|
144
162
|
/** POST /api/publish/<site> – erneut veröffentlichen (ohne ZIP). force=true = „trotzdem veröffentlichen"
|
|
@@ -246,9 +264,10 @@ export async function apiLegalOptions(cfg, { site, impressum, datenschutz } = {}
|
|
|
246
264
|
// GET /api/sites mit EINEM Token → normalisierte Liste (Betreuer-Token: alle betreuten Kunden).
|
|
247
265
|
async function apiSitesWithToken(cfg, token, fetchImpl) {
|
|
248
266
|
const body = await asJson(await fetchImpl(`${baseUrl(cfg)}/sites`, { headers: authHeaders(token) }));
|
|
249
|
-
const sites = (body.sites || []).map(s => ({ label: s.slug || s.site, slug: s.slug || null, id: s.site || null,
|
|
267
|
+
const sites = (body.sites || []).map(s => ({ label: s.slug || s.site || s.customer, slug: s.slug || null, id: s.site || null,
|
|
250
268
|
name: s.name || null, plan: s.plan, everPublished: s.everPublished, publishNeeded: s.publishNeeded,
|
|
251
|
-
lastChangeAt: s.lastChangeAt || null, liveUrl: s.liveUrl || null, customer: s.customer
|
|
269
|
+
lastChangeAt: s.lastChangeAt || null, liveUrl: s.liveUrl || null, customer: s.customer,
|
|
270
|
+
...(s.needsFirstImport ? { needsFirstImport: true, hint: s.hint || null } : {}) }));
|
|
252
271
|
return { count: sites.length, manager: !!body.manager, hint: body.hint || null, sites };
|
|
253
272
|
}
|
|
254
273
|
// sites-Map abfragen: jeden Eintrag einzeln (jeder Token → seine Site).
|
package/index.mjs
CHANGED
|
@@ -17,7 +17,7 @@ const cfg = loadConfig();
|
|
|
17
17
|
// Deutliche Startwarnung bei ambiger Konfiguration (Top-Level-Token NEBEN sites-Map). Nach stderr, damit
|
|
18
18
|
// es im MCP-Log/Terminal auffällt; die endgültige Auflösung (Betreuer-Token-Vorrang vs. Map) klärt sites_list.
|
|
19
19
|
for (const w of (cfg.warnings || [])) process.stderr.write("[prontosite-mcp] ⚠ " + w + "\n");
|
|
20
|
-
const server = new McpServer({ name: "prontosite", version: "0.9.
|
|
20
|
+
const server = new McpServer({ name: "prontosite", version: "0.9.1" });
|
|
21
21
|
const asText = obj => ({ content: [{ type: "text", text: JSON.stringify(obj, null, 2) }] });
|
|
22
22
|
const asError = e => ({ isError: true, content: [{ type: "text", text: "Fehler: " + (e?.message || String(e)) }] });
|
|
23
23
|
const SITE_DESC = "Website-Slug (z. B. 'mas-monti'). Ohne Angabe die Standard-Site der Config. Bei Betreuer-"
|
|
@@ -86,9 +86,9 @@ server.tool(
|
|
|
86
86
|
+ "data-ps=\"datenschutz\" (Rechtstext-Seite) und data-ps=\"link-impressum\" / data-ps=\"link-datenschutz\" "
|
|
87
87
|
+ "(Footer-Links auf die Rechtstexte). Beim Import legt ProntoSite die Bausteine automatisch an. "
|
|
88
88
|
+ "Syntax-Referenz: https://prontosite.io/docs/marker-shortcodes",
|
|
89
|
-
{ site: z.string().optional().describe(SITE_DESC + " Erst-Import: 'new' (Einzel) bzw. '<label>:new' (Multi-Site)."),
|
|
89
|
+
{ site: z.string().optional().describe(SITE_DESC + " Erst-Import: 'new' (Einzel) bzw. '<label>:new' (Multi-Site). Betreuer-Token: '<Konto-ID>:new' (k-…) legt im betreuten Konto an – die Konto-ID im Label ersetzt den customer-Parameter. sites_list zeigt betreute Konten OHNE Website (needsFirstImport) samt ihrer k-ID."),
|
|
90
90
|
slug: z.string().optional().describe("Erst-Import: gewünschte Web-Adresse (Subdomain-Label, z. B. 'wuerttemberg' → wuerttemberg.prontosite.io). Beim Erst-Import den Nutzer danach FRAGEN; wird sie weggelassen, leitet ProntoSite eine Adresse ab. Bei Updates ignoriert."),
|
|
91
|
-
customer: z.string().optional().describe("
|
|
91
|
+
customer: z.string().optional().describe("Betreuer-Token + Erst-Import: Ziel-Konto-ID (k-…) für die neue Website. Alternativ direkt im site-Argument als '<Konto-ID>:new'."),
|
|
92
92
|
zipPath: z.string().describe("Pfad zur ZIP-Datei der Website (lokal)."),
|
|
93
93
|
publish: z.boolean().default(false).describe("true = nach dem Import direkt veröffentlichen (LIVE)."),
|
|
94
94
|
resetOverlay: z.boolean().default(false).describe("true = bisherige Dashboard-Änderungen verwerfen."),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prontosite/mcp",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "MCP-Server für ProntoSite – Website-Status, Export, Deploy und Veröffentlichen direkt aus einem KI-Assistenten (Claude Desktop). Dünner Client um die ProntoSite Deploy-API.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|