@daileyos/mcp-server 1.19.0 → 1.20.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/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/tools/addons.d.ts +3 -0
- package/dist/tools/addons.d.ts.map +1 -0
- package/dist/tools/addons.js +69 -0
- package/dist/tools/addons.js.map +1 -0
- package/dist/tools/credits.d.ts +3 -0
- package/dist/tools/credits.d.ts.map +1 -0
- package/dist/tools/credits.js +57 -0
- package/dist/tools/credits.js.map +1 -0
- package/dist/tools/email.d.ts +3 -0
- package/dist/tools/email.d.ts.map +1 -0
- package/dist/tools/email.js +61 -0
- package/dist/tools/email.js.map +1 -0
- package/dist/tools/wordpress-snapshot.d.ts +3 -0
- package/dist/tools/wordpress-snapshot.d.ts.map +1 -0
- package/dist/tools/wordpress-snapshot.js +121 -0
- package/dist/tools/wordpress-snapshot.js.map +1 -0
- package/package.json +1 -1
- package/src/index.ts +9 -0
- package/src/tools/addons.ts +124 -0
- package/src/tools/credits.ts +97 -0
- package/src/tools/email.ts +101 -0
- package/src/tools/wordpress-snapshot.ts +221 -0
- package/tests/wp-snapshot.test.mjs +261 -0
- package/dist/tools/buddy.d.ts +0 -3
- package/dist/tools/buddy.d.ts.map +0 -1
- package/dist/tools/buddy.js +0 -765
- package/dist/tools/buddy.js.map +0 -1
- package/dist/tools/payments.d.ts +0 -3
- package/dist/tools/payments.d.ts.map +0 -1
- package/dist/tools/payments.js +0 -96
- package/dist/tools/payments.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -21,11 +21,15 @@ import { registerBillingTools } from './tools/billing.js';
|
|
|
21
21
|
import { registerPlatformTools } from './tools/platform.js';
|
|
22
22
|
import { registerStorageTools } from './tools/storage.js';
|
|
23
23
|
import { registerAiTools } from './tools/ai.js';
|
|
24
|
+
import { registerEmailTools } from './tools/email.js';
|
|
25
|
+
import { registerCreditTools } from './tools/credits.js';
|
|
26
|
+
import { registerAddonTools } from './tools/addons.js';
|
|
24
27
|
import { registerImageTools } from './tools/images.js';
|
|
25
28
|
import { registerProcessTools } from './tools/processes.js';
|
|
26
29
|
import { registerLifecycleTools } from './tools/lifecycle.js';
|
|
27
30
|
import { registerBackupTools } from './tools/backups.js';
|
|
28
31
|
import { registerWordPressMigrateTools } from './tools/wordpress-migrate.js';
|
|
32
|
+
import { registerWordPressSnapshotTools } from './tools/wordpress-snapshot.js';
|
|
29
33
|
import { registerResourceConfigTools } from './tools/resource-config.js';
|
|
30
34
|
import { registerLinkTools } from './tools/links.js';
|
|
31
35
|
import { registerCredentialRevealTools } from './tools/credentials-reveal.js';
|
|
@@ -100,6 +104,9 @@ registerAccountTools(server);
|
|
|
100
104
|
registerPlatformTools(server);
|
|
101
105
|
registerUsageTools(server);
|
|
102
106
|
registerBillingTools(server);
|
|
107
|
+
// À-la-carte billing surfaces — prepaid credits + capacity add-ons.
|
|
108
|
+
registerCreditTools(server);
|
|
109
|
+
registerAddonTools(server);
|
|
103
110
|
// Projects + deploys
|
|
104
111
|
registerProjectTools(server);
|
|
105
112
|
registerAnalyzeTools(server);
|
|
@@ -122,8 +129,10 @@ registerDbTools(server);
|
|
|
122
129
|
registerMigrateTools(server);
|
|
123
130
|
registerStorageTools(server);
|
|
124
131
|
registerAiTools(server);
|
|
132
|
+
registerEmailTools(server);
|
|
125
133
|
registerBackupTools(server);
|
|
126
134
|
registerWordPressMigrateTools(server);
|
|
135
|
+
registerWordPressSnapshotTools(server);
|
|
127
136
|
// Runtime operations — exec into a pod, run one-off jobs
|
|
128
137
|
registerExecRunTools(server);
|
|
129
138
|
// Admin-only — customer onboarding, project transfer
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,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B,CAAC,MAAM,CAAC,CAAC;AAE7B,qDAAqD;AACrD,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAC3B,4BAA4B,CAAC,MAAM,CAAC,CAAC;AAErC,aAAa;AACb,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAEzB,uBAAuB;AACvB,mBAAmB,CAAC,MAAM,CAAC,CAAC;AAE5B,2EAA2E;AAC3E,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAE9B,uCAAuC;AACvC,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAE7B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addons.d.ts","sourceRoot":"","sources":["../../src/tools/addons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA0CpE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,QAiFnD"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { apiRequest, formatError, textResult } from '../api.js';
|
|
3
|
+
export function registerAddonTools(server) {
|
|
4
|
+
server.tool('dailey_addons', 'List à-la-carte capacity add-ons: the account\'s ACTIVE add-ons (with monthly cost) plus the AVAILABLE catalog (extra_vcpu, extra_ram, extra_db_storage, extra_object_storage, db_replica, app_ha, email_pro, ...) and per-unit pricing. Purchase with dailey_addon_purchase; cancel with dailey_addon_cancel.', {}, async () => {
|
|
5
|
+
const [activeRes, catalogRes] = await Promise.all([
|
|
6
|
+
apiRequest('GET', '/billing/addons'),
|
|
7
|
+
apiRequest('GET', '/billing/addons/catalog'),
|
|
8
|
+
]);
|
|
9
|
+
if (!activeRes.ok)
|
|
10
|
+
return textResult(formatError(activeRes));
|
|
11
|
+
const lines = ['Active add-ons:'];
|
|
12
|
+
const active = activeRes.data.addons || [];
|
|
13
|
+
if (active.length === 0) {
|
|
14
|
+
lines.push(' (none)');
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
for (const a of active) {
|
|
18
|
+
lines.push(` ${a.id} ${a.addon_type} x${a.quantity} $${a.monthly_cost ?? 0}/mo [${a.status}]`);
|
|
19
|
+
}
|
|
20
|
+
lines.push(` Total: $${activeRes.data.total_monthly ?? 0}/mo`);
|
|
21
|
+
}
|
|
22
|
+
if (catalogRes.ok) {
|
|
23
|
+
lines.push('');
|
|
24
|
+
lines.push('Available add-ons (catalog):');
|
|
25
|
+
for (const c of catalogRes.data.addons || []) {
|
|
26
|
+
lines.push(` ${c.type} $${c.unit_price}/${c.unit_label} — ${c.description || c.name}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
lines.push('');
|
|
30
|
+
lines.push('Purchase: dailey_addon_purchase (type[, quantity]) → returns a Stripe Checkout URL to pay.');
|
|
31
|
+
return textResult(lines.join('\n'));
|
|
32
|
+
});
|
|
33
|
+
server.tool('dailey_addon_purchase', 'Purchase an à-la-carte capacity add-on (extra_vcpu, extra_ram, extra_db_storage, extra_object_storage, db_replica, app_ha, email_pro, ...). PAY-AT-PURCHASE and billing-owner-only: the normal response is a Stripe Checkout URL the user MUST open to pay the monthly subscription before the capacity is granted — do NOT treat the add-on as active until payment completes. (Some early-stage types with no Stripe price provision immediately.) See dailey_addons for valid types + pricing.', {
|
|
34
|
+
addon_type: z.string().describe('Add-on type, e.g. extra_vcpu, extra_ram, extra_db_storage, extra_object_storage, db_replica, app_ha, email_pro'),
|
|
35
|
+
quantity: z.number().int().min(1).optional().describe('Number of units (default 1)'),
|
|
36
|
+
}, async ({ addon_type, quantity }) => {
|
|
37
|
+
const body = { addon_type };
|
|
38
|
+
if (typeof quantity === 'number')
|
|
39
|
+
body.quantity = quantity;
|
|
40
|
+
const res = await apiRequest('POST', '/billing/addons', body);
|
|
41
|
+
if (!res.ok)
|
|
42
|
+
return textResult(formatError(res));
|
|
43
|
+
const d = res.data;
|
|
44
|
+
if (d.checkout_url) {
|
|
45
|
+
return textResult([
|
|
46
|
+
`Add-on "${addon_type}" x${quantity ?? 1} — pay-at-purchase.`,
|
|
47
|
+
'',
|
|
48
|
+
'➜ Open this URL to complete the subscription payment:',
|
|
49
|
+
d.checkout_url,
|
|
50
|
+
'',
|
|
51
|
+
'The capacity is granted automatically once the Stripe Checkout is paid. It is NOT active yet.',
|
|
52
|
+
].join('\n'));
|
|
53
|
+
}
|
|
54
|
+
// No Stripe price configured — provisioned immediately.
|
|
55
|
+
const lines = [d.message || `Add-on "${addon_type}" added.`];
|
|
56
|
+
if (d.addon)
|
|
57
|
+
lines.push(`id: ${d.addon.id} $${d.addon.monthly_cost}/mo`);
|
|
58
|
+
if (d.note)
|
|
59
|
+
lines.push(d.note);
|
|
60
|
+
return textResult(lines.join('\n'));
|
|
61
|
+
});
|
|
62
|
+
server.tool('dailey_addon_cancel', 'Cancel an active à-la-carte add-on by its add-on id (from dailey_addons). Cancels the Stripe subscription item and removes the capacity from the account quota. Billing-owner-only.', { addon_id: z.string().describe('The add-on id to cancel (from dailey_addons)') }, async ({ addon_id }) => {
|
|
63
|
+
const res = await apiRequest('DELETE', `/billing/addons/${addon_id}`);
|
|
64
|
+
if (!res.ok)
|
|
65
|
+
return textResult(formatError(res));
|
|
66
|
+
return textResult(`${res.data.message || 'Add-on cancelled'} (${res.data.addon_id || addon_id}).`);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=addons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addons.js","sourceRoot":"","sources":["../../src/tools/addons.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAwChE,MAAM,UAAU,kBAAkB,CAAC,MAAiB;IAClD,MAAM,CAAC,IAAI,C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AM,EAAE,SAAS,QAgEpD"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { apiRequest, formatError, textResult } from '../api.js';
|
|
3
|
+
const dollars = (cents) => `$${(((cents ?? 0)) / 100).toFixed(2)}`;
|
|
4
|
+
export function registerCreditTools(server) {
|
|
5
|
+
server.tool('dailey_credits', 'Show the account prepaid credit balance and settings: current balance, whether prepaid is enabled, auto-recharge config, and the recent credit ledger. Prepaid credits are drawn down in real time by metered AI / Compute / Email overage; a $0 balance hard-stops those. Top up with dailey_credits_topup.', {}, async () => {
|
|
6
|
+
const res = await apiRequest('GET', '/account/credits');
|
|
7
|
+
if (!res.ok)
|
|
8
|
+
return textResult(formatError(res));
|
|
9
|
+
const d = res.data;
|
|
10
|
+
const lines = [
|
|
11
|
+
'Prepaid Credits',
|
|
12
|
+
`Balance: ${dollars(d.balance_cents)}`,
|
|
13
|
+
`Prepaid enabled: ${d.prepaid_enabled ? 'yes' : 'no'}`,
|
|
14
|
+
`Auto-recharge: ${d.auto_recharge_enabled ? 'on' : 'off'}`,
|
|
15
|
+
];
|
|
16
|
+
if (d.auto_recharge_enabled) {
|
|
17
|
+
lines.push(` when below: ${dollars(d.auto_recharge_threshold_cents)}`);
|
|
18
|
+
lines.push(` top up by: ${dollars(d.auto_recharge_amount_cents)}`);
|
|
19
|
+
}
|
|
20
|
+
const ledger = d.ledger || [];
|
|
21
|
+
lines.push('');
|
|
22
|
+
lines.push('Recent ledger:');
|
|
23
|
+
if (ledger.length === 0) {
|
|
24
|
+
lines.push(' (none)');
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
for (const e of ledger.slice(0, 20)) {
|
|
28
|
+
const sign = (e.delta_cents ?? 0) >= 0 ? '+' : '-';
|
|
29
|
+
lines.push(` ${e.created_at || '?'} ${sign}${dollars(Math.abs(e.delta_cents ?? 0))} ${e.reason || ''}${e.ref ? ` (${e.ref})` : ''}`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
lines.push('');
|
|
33
|
+
lines.push('Top up with dailey_credits_topup (opens a Stripe Checkout).');
|
|
34
|
+
return textResult(lines.join('\n'));
|
|
35
|
+
});
|
|
36
|
+
server.tool('dailey_credits_topup', 'Buy a one-time prepaid credit top-up. Returns a Stripe Checkout URL the user MUST open to pay — the balance is only credited after payment completes (do NOT treat credits as added until then). The card is saved for off_session auto-recharge. Amount is $5–$1,000.', {
|
|
37
|
+
amount_usd: z.number().min(5).max(1000).describe('Top-up amount in US dollars (5 to 1000).'),
|
|
38
|
+
}, async ({ amount_usd }) => {
|
|
39
|
+
const amount_cents = Math.round(amount_usd * 100);
|
|
40
|
+
const res = await apiRequest('POST', '/account/credits/checkout', { amount_cents });
|
|
41
|
+
if (!res.ok)
|
|
42
|
+
return textResult(formatError(res));
|
|
43
|
+
const d = res.data;
|
|
44
|
+
if (!d.checkout_url) {
|
|
45
|
+
return textResult('Top-up created but no checkout_url was returned. Retry, or top up from Billing → Credits.');
|
|
46
|
+
}
|
|
47
|
+
return textResult([
|
|
48
|
+
`Prepaid top-up of ${dollars(amount_cents)}.`,
|
|
49
|
+
'',
|
|
50
|
+
'➜ Open this URL to complete payment:',
|
|
51
|
+
d.checkout_url,
|
|
52
|
+
'',
|
|
53
|
+
'Your balance is credited automatically once the Stripe Checkout is paid. It is NOT added yet.',
|
|
54
|
+
].join('\n'));
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=credits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credits.js","sourceRoot":"","sources":["../../src/tools/credits.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AA2BhE,MAAM,OAAO,GAAG,CAAC,KAAyB,EAAE,EAAE,CAC5C,IAAI,CAAC,CAAC,CAAC,KAAK,I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E;YAAE,OAAO,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;QACjD,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC;QACnB,IAAI,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC;YACpB,OAAO,UAAU,CAAC,2FAA2F,CAAC,CAAC;QACjH,CAAC;QACD,OAAO,UAAU,CACf;YACE,qBAAqB,OAAO,CAAC,YAAY,CAAC,GAAG;YAC7C,EAAE;YACF,sCAAsC;YACtC,CAAC,CAAC,YAAY;YACd,EAAE;YACF,+FAA+F;SAChG,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../src/tools/email.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA8BpE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,QAsEnD"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { apiRequest, formatError, textResult } from '../api.js';
|
|
3
|
+
export function registerEmailTools(server) {
|
|
4
|
+
server.tool('dailey_email_enable', 'Enable Dailey Email ($10/mo, per project) so the app can send from <slug>@send.dailey.cloud. This is PAY-AT-PURCHASE and billing-owner-only: the normal response is a Stripe Checkout URL the user MUST open to pay $10/mo before email turns on — do NOT treat email as enabled until payment completes. The operator/internal path enables immediately (email_enabled:true). After it turns on, redeploy so DAILEY_EMAIL_* env is injected.', { project_id: z.string().describe('The project ID') }, async ({ project_id }) => {
|
|
5
|
+
const res = await apiRequest('POST', `/projects/${project_id}/email/enable`, {});
|
|
6
|
+
if (!res.ok)
|
|
7
|
+
return textResult(formatError(res));
|
|
8
|
+
const d = res.data;
|
|
9
|
+
// Pay-at-purchase: a checkout_url means email is NOT on yet.
|
|
10
|
+
if (d.pending && d.checkout_url) {
|
|
11
|
+
return textResult([
|
|
12
|
+
'Dailey Email is $10/mo and requires payment to enable.',
|
|
13
|
+
'',
|
|
14
|
+
'➜ Open this URL to finish enabling email (pay $10/mo):',
|
|
15
|
+
d.checkout_url,
|
|
16
|
+
'',
|
|
17
|
+
'Email turns on automatically once the Stripe Checkout is paid. It is NOT active yet.',
|
|
18
|
+
'After it turns on, redeploy the project (dailey_deploy) to pick up DAILEY_EMAIL_* env.',
|
|
19
|
+
].join('\n'));
|
|
20
|
+
}
|
|
21
|
+
// Operator / already-on path — provisioned immediately.
|
|
22
|
+
const lines = ['Dailey Email enabled.'];
|
|
23
|
+
if (d.from)
|
|
24
|
+
lines.push(`From: ${d.from}`);
|
|
25
|
+
if (d.key_masked)
|
|
26
|
+
lines.push(`Key: ${d.key_masked}`);
|
|
27
|
+
lines.push('');
|
|
28
|
+
lines.push('Redeploy the project (dailey_deploy) to pick up the DAILEY_EMAIL_* env vars.');
|
|
29
|
+
return textResult(lines.join('\n'));
|
|
30
|
+
});
|
|
31
|
+
server.tool('dailey_email_disable', 'Disable Dailey Email for a project: cancels the $10/mo email_pro subscription, revokes the email key, and removes the DAILEY_EMAIL_* env vars. Billing-owner-only (a manager acting-as a managed account is denied).', { project_id: z.string().describe('The project ID') }, async ({ project_id }) => {
|
|
32
|
+
const res = await apiRequest('DELETE', `/projects/${project_id}/email/enable`);
|
|
33
|
+
if (!res.ok)
|
|
34
|
+
return textResult(formatError(res));
|
|
35
|
+
return textResult('Dailey Email disabled. The $10/mo subscription was cancelled and the DAILEY_EMAIL_* env vars removed.');
|
|
36
|
+
});
|
|
37
|
+
server.tool('dailey_email_status', 'Show Dailey Email status for a project: whether email is enabled, the From address (<slug>@send.dailey.cloud), any suspension, and current-month usage (messages sent, bounced, complained).', { project_id: z.string().describe('The project ID') }, async ({ project_id }) => {
|
|
38
|
+
const res = await apiRequest('GET', `/projects/${project_id}/email`);
|
|
39
|
+
if (!res.ok)
|
|
40
|
+
return textResult(formatError(res));
|
|
41
|
+
const d = res.data;
|
|
42
|
+
const lines = [
|
|
43
|
+
`Dailey Email — ${d.project_id}`,
|
|
44
|
+
`Enabled: ${d.email_enabled ? 'yes' : 'no'}`,
|
|
45
|
+
`From: ${d.from_address || '(not set)'}`,
|
|
46
|
+
];
|
|
47
|
+
if (d.suspended)
|
|
48
|
+
lines.push(`Suspended: yes${d.suspend_reason ? ` (${d.suspend_reason})` : ''}`);
|
|
49
|
+
lines.push('');
|
|
50
|
+
lines.push(`Usage (${d.month}):`);
|
|
51
|
+
lines.push(` messages_sent: ${d.usage?.messages_sent ?? 0}`);
|
|
52
|
+
lines.push(` bounced: ${d.usage?.bounced ?? 0}`);
|
|
53
|
+
lines.push(` complained: ${d.usage?.complained ?? 0}`);
|
|
54
|
+
if (!d.email_enabled) {
|
|
55
|
+
lines.push('');
|
|
56
|
+
lines.push('Email is off. Enable with dailey_email_enable (opens a $10/mo Stripe Checkout).');
|
|
57
|
+
}
|
|
58
|
+
return textResult(lines.join('\n'));
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=email.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email.js","sourceRoot":"","sources":["../../src/tools/email.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AA4BhE,MAAM,UAAU,kBAAkB,CAAC,MAAiB;IAClD,MAAM,CAAC,IAAI,CACT,qBAAqB,EACrB,+aAA+a,EAC/a,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,EACrD,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;QACvB,MAAM,GAAG,GAAG,MAAM,UAAU,CAAsB,MAAM,EAAE,aAAa,UAAU,eAAe,EAAE,EAAE,CAAC,CA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,IAAI,CAAC,oBAAoB,CAAC,CAAC,KAAK,EAAE,UAAU,IAAI,CAAC,EAAE,CAAC,CAAC;QAC3D,IAAI,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;YACrB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACf,KAAK,CAAC,IAAI,CAAC,iFAAiF,CAAC,CAAC;QAChG,CAAC;QACD,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACtC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wordpress-snapshot.d.ts","sourceRoot":"","sources":["../../src/tools/wordpress-snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA8DpE,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,SAAS,QA8J/D"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { apiRequest, textResult, formatError } from '../api.js';
|
|
3
|
+
function fmtBytes(bytes) {
|
|
4
|
+
if (bytes == null)
|
|
5
|
+
return '-';
|
|
6
|
+
if (bytes < 1024)
|
|
7
|
+
return `${bytes}B`;
|
|
8
|
+
if (bytes < 1024 * 1024)
|
|
9
|
+
return `${(bytes / 1024).toFixed(1)}KB`;
|
|
10
|
+
if (bytes < 1024 * 1024 * 1024)
|
|
11
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;
|
|
12
|
+
return `${(bytes / (1024 * 1024 * 1024)).toFixed(2)}GB`;
|
|
13
|
+
}
|
|
14
|
+
export function registerWordPressSnapshotTools(server) {
|
|
15
|
+
server.tool('dailey_wp_snapshots', 'List WordPress snapshots for a project', {
|
|
16
|
+
project_id: z.string().describe('The project ID'),
|
|
17
|
+
}, async ({ project_id }) => {
|
|
18
|
+
const res = await apiRequest('GET', `/projects/${project_id}/wp/snapshots`);
|
|
19
|
+
if (!res.ok)
|
|
20
|
+
return textResult(formatError(res));
|
|
21
|
+
const snapshots = res.data.snapshots;
|
|
22
|
+
if (!snapshots || snapshots.length === 0) {
|
|
23
|
+
return textResult('No snapshots found for this project.');
|
|
24
|
+
}
|
|
25
|
+
const lines = [
|
|
26
|
+
`Snapshots for project ${project_id}`,
|
|
27
|
+
`${'ID'.padEnd(38)} ${'Created'.padEnd(26)} ${'Kind'.padEnd(12)} ${'Status'.padEnd(12)} ${'DB'.padEnd(10)} Uploads`,
|
|
28
|
+
'─'.repeat(115),
|
|
29
|
+
];
|
|
30
|
+
for (const s of snapshots) {
|
|
31
|
+
lines.push(`${(s.id || '').padEnd(38)} ${(s.created_at || '-').padEnd(26)} ${(s.kind || '-').padEnd(12)} ${(s.status || '-').padEnd(12)} ${fmtBytes(s.db_bytes).padEnd(10)} ${fmtBytes(s.uploads_bytes)}`);
|
|
32
|
+
}
|
|
33
|
+
return textResult(lines.join('\n'));
|
|
34
|
+
});
|
|
35
|
+
server.tool('dailey_wp_snapshot', 'Create a snapshot (DB + uploads) of a WordPress project', {
|
|
36
|
+
project_id: z.string().describe('The project ID'),
|
|
37
|
+
}, async ({ project_id }) => {
|
|
38
|
+
const res = await apiRequest('POST', `/projects/${project_id}/wp/snapshot`);
|
|
39
|
+
if (!res.ok)
|
|
40
|
+
return textResult(formatError(res));
|
|
41
|
+
const { operation_id } = res.data;
|
|
42
|
+
return textResult(`Snapshot started. operation_id=${operation_id}. Poll with dailey_wp_operation_status (project_id, operation_id).`);
|
|
43
|
+
});
|
|
44
|
+
server.tool('dailey_wp_restore', 'Restore a WordPress project from a snapshot (DESTRUCTIVE — two-phase). Call WITHOUT confirm_token to get the plan; re-call WITH the returned confirm_token to execute.', {
|
|
45
|
+
project_id: z.string().describe('The project ID'),
|
|
46
|
+
snapshot_id: z.string().describe('The snapshot ID to restore'),
|
|
47
|
+
confirm_token: z.string().optional().describe('Token from the plan response. Omit to preview the plan; provide to execute. Bound to this project+snapshot, ~10min TTL.'),
|
|
48
|
+
}, async ({ project_id, snapshot_id, confirm_token }) => {
|
|
49
|
+
if (!confirm_token) {
|
|
50
|
+
// Phase 1: preview
|
|
51
|
+
const res = await apiRequest('POST', `/projects/${project_id}/wp/restore/preview`, { snapshot_id });
|
|
52
|
+
if (!res.ok)
|
|
53
|
+
return textResult(formatError(res));
|
|
54
|
+
const { plan, confirm_token: token } = res.data;
|
|
55
|
+
const lines = [];
|
|
56
|
+
if (plan.sourceLabel || plan.targetLabel) {
|
|
57
|
+
lines.push(`Restore plan: ${plan.sourceLabel ?? snapshot_id} → ${plan.targetLabel ?? 'this project'}`);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
lines.push(`Restore plan for snapshot ${snapshot_id}:`);
|
|
61
|
+
}
|
|
62
|
+
if (plan.backupFirst) {
|
|
63
|
+
lines.push('• Backs up the target first as a rollback point.');
|
|
64
|
+
}
|
|
65
|
+
if (plan.steps && plan.steps.length > 0) {
|
|
66
|
+
lines.push('');
|
|
67
|
+
lines.push('Steps:');
|
|
68
|
+
plan.steps.forEach((step, i) => {
|
|
69
|
+
lines.push(` ${i + 1}. ${step}`);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
lines.push('');
|
|
73
|
+
lines.push(`confirm_token: ${token}`);
|
|
74
|
+
lines.push('');
|
|
75
|
+
lines.push('This is destructive. To proceed, re-call dailey_wp_restore with the same project_id + snapshot_id and this confirm_token.');
|
|
76
|
+
return textResult(lines.join('\n'));
|
|
77
|
+
}
|
|
78
|
+
// Phase 2: execute
|
|
79
|
+
const res = await apiRequest('POST', `/projects/${project_id}/wp/restore`, { snapshot_id, confirm_token, confirmation: 'RESTORE' });
|
|
80
|
+
if (!res.ok) {
|
|
81
|
+
if (res.status === 409) {
|
|
82
|
+
return textResult('A restore is already in progress for this project.');
|
|
83
|
+
}
|
|
84
|
+
// 400 (expired/invalid token) — surface the message
|
|
85
|
+
return textResult(formatError(res));
|
|
86
|
+
}
|
|
87
|
+
const { operation_id } = res.data;
|
|
88
|
+
return textResult(`Restore started. operation_id=${operation_id}. Poll with dailey_wp_operation_status.`);
|
|
89
|
+
});
|
|
90
|
+
server.tool('dailey_wp_operation_status', 'Check the status of a WordPress snapshot/restore operation', {
|
|
91
|
+
project_id: z.string().describe('The project ID'),
|
|
92
|
+
operation_id: z.string().describe('The operation ID'),
|
|
93
|
+
}, async ({ project_id, operation_id }) => {
|
|
94
|
+
const res = await apiRequest('GET', `/projects/${project_id}/wp/operations/${operation_id}`);
|
|
95
|
+
if (!res.ok)
|
|
96
|
+
return textResult(formatError(res));
|
|
97
|
+
const op = res.data.operation;
|
|
98
|
+
const lines = [];
|
|
99
|
+
if (op.type)
|
|
100
|
+
lines.push(`Type: ${op.type}`);
|
|
101
|
+
lines.push(`Status: ${op.status ?? '-'}`);
|
|
102
|
+
if (op.current_step)
|
|
103
|
+
lines.push(`Current step: ${op.current_step}`);
|
|
104
|
+
if (op.verify != null)
|
|
105
|
+
lines.push(`Verify: ${JSON.stringify(op.verify)}`);
|
|
106
|
+
if (op.error)
|
|
107
|
+
lines.push(`Error: ${op.error}`);
|
|
108
|
+
if (op.backup_snapshot_id)
|
|
109
|
+
lines.push(`Backup snapshot ID: ${op.backup_snapshot_id}`);
|
|
110
|
+
if (op.step_log && op.step_log.length > 0) {
|
|
111
|
+
const tail = op.step_log.slice(-10);
|
|
112
|
+
lines.push('');
|
|
113
|
+
lines.push('Step log (last 10):');
|
|
114
|
+
for (const entry of tail) {
|
|
115
|
+
lines.push(` ${entry}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return textResult(lines.join('\n'));
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=wordpress-snapshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wordpress-snapshot.js","sourceRoot":"","sources":["../../src/tools/wordpress-snapshot.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MA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AI,EAAE,CAAC,KAAK;YAAE,KAAK,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;QAC7D,IAAI,EAAE,CAAC,kBAAkB;YAAE,KAAK,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC,kBAAkB,EAAE,CAAC,CAAC;QAEvF,IAAI,EAAE,CAAC,QAAQ,IAAI,EAAE,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1C,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;YACpC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACf,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;YAClC,KAAK,MAAM,KAAK,IAAI,IAAI,EAAE,CAAC;gBACzB,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;QAED,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACtC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -23,11 +23,15 @@ import { registerBillingTools } from './tools/billing.js';
|
|
|
23
23
|
import { registerPlatformTools } from './tools/platform.js';
|
|
24
24
|
import { registerStorageTools } from './tools/storage.js';
|
|
25
25
|
import { registerAiTools } from './tools/ai.js';
|
|
26
|
+
import { registerEmailTools } from './tools/email.js';
|
|
27
|
+
import { registerCreditTools } from './tools/credits.js';
|
|
28
|
+
import { registerAddonTools } from './tools/addons.js';
|
|
26
29
|
import { registerImageTools } from './tools/images.js';
|
|
27
30
|
import { registerProcessTools } from './tools/processes.js';
|
|
28
31
|
import { registerLifecycleTools } from './tools/lifecycle.js';
|
|
29
32
|
import { registerBackupTools } from './tools/backups.js';
|
|
30
33
|
import { registerWordPressMigrateTools } from './tools/wordpress-migrate.js';
|
|
34
|
+
import { registerWordPressSnapshotTools } from './tools/wordpress-snapshot.js';
|
|
31
35
|
import { registerResourceConfigTools } from './tools/resource-config.js';
|
|
32
36
|
import { registerLinkTools } from './tools/links.js';
|
|
33
37
|
import { registerCredentialRevealTools } from './tools/credentials-reveal.js';
|
|
@@ -116,6 +120,9 @@ registerAccountTools(server);
|
|
|
116
120
|
registerPlatformTools(server);
|
|
117
121
|
registerUsageTools(server);
|
|
118
122
|
registerBillingTools(server);
|
|
123
|
+
// À-la-carte billing surfaces — prepaid credits + capacity add-ons.
|
|
124
|
+
registerCreditTools(server);
|
|
125
|
+
registerAddonTools(server);
|
|
119
126
|
|
|
120
127
|
// Projects + deploys
|
|
121
128
|
registerProjectTools(server);
|
|
@@ -142,8 +149,10 @@ registerDbTools(server);
|
|
|
142
149
|
registerMigrateTools(server);
|
|
143
150
|
registerStorageTools(server);
|
|
144
151
|
registerAiTools(server);
|
|
152
|
+
registerEmailTools(server);
|
|
145
153
|
registerBackupTools(server);
|
|
146
154
|
registerWordPressMigrateTools(server);
|
|
155
|
+
registerWordPressSnapshotTools(server);
|
|
147
156
|
|
|
148
157
|
// Runtime operations — exec into a pod, run one-off jobs
|
|
149
158
|
registerExecRunTools(server);
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { apiRequest, formatError, textResult } from '../api.js';
|
|
4
|
+
|
|
5
|
+
// À-la-carte capacity add-ons (pay-at-purchase Stripe subscriptions):
|
|
6
|
+
// extra_vcpu, extra_ram, extra_db_storage, extra_object_storage,
|
|
7
|
+
// db_replica, app_ha, email_pro (+ managed_ops / extra_core_users_*).
|
|
8
|
+
// GET /billing/addons = active add-ons; GET /billing/addons/catalog = available
|
|
9
|
+
// types + pricing. POST /billing/addons returns { checkout_url } (pay first) or,
|
|
10
|
+
// when no Stripe price is configured, provisions immediately ({ addon, message }).
|
|
11
|
+
interface ActiveAddon {
|
|
12
|
+
id: string;
|
|
13
|
+
addon_type: string;
|
|
14
|
+
quantity: number;
|
|
15
|
+
status: string;
|
|
16
|
+
created_at?: string;
|
|
17
|
+
unit_price?: number;
|
|
18
|
+
unit_label?: string;
|
|
19
|
+
monthly_cost?: number;
|
|
20
|
+
}
|
|
21
|
+
interface AddonsListResponse {
|
|
22
|
+
addons: ActiveAddon[];
|
|
23
|
+
total_monthly: number;
|
|
24
|
+
}
|
|
25
|
+
interface CatalogItem {
|
|
26
|
+
type: string;
|
|
27
|
+
name: string;
|
|
28
|
+
unit_price: number;
|
|
29
|
+
unit_label: string;
|
|
30
|
+
description: string;
|
|
31
|
+
}
|
|
32
|
+
interface CatalogResponse {
|
|
33
|
+
addons: CatalogItem[];
|
|
34
|
+
}
|
|
35
|
+
interface AddonPurchaseResponse {
|
|
36
|
+
checkout_url?: string | null;
|
|
37
|
+
session_id?: string;
|
|
38
|
+
addon?: { id: string; addon_type: string; quantity: number; unit_price: number; monthly_cost: number };
|
|
39
|
+
message?: string;
|
|
40
|
+
note?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function registerAddonTools(server: McpServer) {
|
|
44
|
+
server.tool(
|
|
45
|
+
'dailey_addons',
|
|
46
|
+
'List à-la-carte capacity add-ons: the account\'s ACTIVE add-ons (with monthly cost) plus the AVAILABLE catalog (extra_vcpu, extra_ram, extra_db_storage, extra_object_storage, db_replica, app_ha, email_pro, ...) and per-unit pricing. Purchase with dailey_addon_purchase; cancel with dailey_addon_cancel.',
|
|
47
|
+
{},
|
|
48
|
+
async () => {
|
|
49
|
+
const [activeRes, catalogRes] = await Promise.all([
|
|
50
|
+
apiRequest<AddonsListResponse>('GET', '/billing/addons'),
|
|
51
|
+
apiRequest<CatalogResponse>('GET', '/billing/addons/catalog'),
|
|
52
|
+
]);
|
|
53
|
+
if (!activeRes.ok) return textResult(formatError(activeRes));
|
|
54
|
+
|
|
55
|
+
const lines: string[] = ['Active add-ons:'];
|
|
56
|
+
const active = activeRes.data.addons || [];
|
|
57
|
+
if (active.length === 0) {
|
|
58
|
+
lines.push(' (none)');
|
|
59
|
+
} else {
|
|
60
|
+
for (const a of active) {
|
|
61
|
+
lines.push(
|
|
62
|
+
` ${a.id} ${a.addon_type} x${a.quantity} $${a.monthly_cost ?? 0}/mo [${a.status}]`,
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
lines.push(` Total: $${activeRes.data.total_monthly ?? 0}/mo`);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (catalogRes.ok) {
|
|
69
|
+
lines.push('');
|
|
70
|
+
lines.push('Available add-ons (catalog):');
|
|
71
|
+
for (const c of catalogRes.data.addons || []) {
|
|
72
|
+
lines.push(` ${c.type} $${c.unit_price}/${c.unit_label} — ${c.description || c.name}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
lines.push('');
|
|
76
|
+
lines.push('Purchase: dailey_addon_purchase (type[, quantity]) → returns a Stripe Checkout URL to pay.');
|
|
77
|
+
return textResult(lines.join('\n'));
|
|
78
|
+
},
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
server.tool(
|
|
82
|
+
'dailey_addon_purchase',
|
|
83
|
+
'Purchase an à-la-carte capacity add-on (extra_vcpu, extra_ram, extra_db_storage, extra_object_storage, db_replica, app_ha, email_pro, ...). PAY-AT-PURCHASE and billing-owner-only: the normal response is a Stripe Checkout URL the user MUST open to pay the monthly subscription before the capacity is granted — do NOT treat the add-on as active until payment completes. (Some early-stage types with no Stripe price provision immediately.) See dailey_addons for valid types + pricing.',
|
|
84
|
+
{
|
|
85
|
+
addon_type: z.string().describe('Add-on type, e.g. extra_vcpu, extra_ram, extra_db_storage, extra_object_storage, db_replica, app_ha, email_pro'),
|
|
86
|
+
quantity: z.number().int().min(1).optional().describe('Number of units (default 1)'),
|
|
87
|
+
},
|
|
88
|
+
async ({ addon_type, quantity }) => {
|
|
89
|
+
const body: Record<string, unknown> = { addon_type };
|
|
90
|
+
if (typeof quantity === 'number') body.quantity = quantity;
|
|
91
|
+
const res = await apiRequest<AddonPurchaseResponse>('POST', '/billing/addons', body);
|
|
92
|
+
if (!res.ok) return textResult(formatError(res));
|
|
93
|
+
const d = res.data;
|
|
94
|
+
if (d.checkout_url) {
|
|
95
|
+
return textResult(
|
|
96
|
+
[
|
|
97
|
+
`Add-on "${addon_type}" x${quantity ?? 1} — pay-at-purchase.`,
|
|
98
|
+
'',
|
|
99
|
+
'➜ Open this URL to complete the subscription payment:',
|
|
100
|
+
d.checkout_url,
|
|
101
|
+
'',
|
|
102
|
+
'The capacity is granted automatically once the Stripe Checkout is paid. It is NOT active yet.',
|
|
103
|
+
].join('\n'),
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
// No Stripe price configured — provisioned immediately.
|
|
107
|
+
const lines = [d.message || `Add-on "${addon_type}" added.`];
|
|
108
|
+
if (d.addon) lines.push(`id: ${d.addon.id} $${d.addon.monthly_cost}/mo`);
|
|
109
|
+
if (d.note) lines.push(d.note);
|
|
110
|
+
return textResult(lines.join('\n'));
|
|
111
|
+
},
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
server.tool(
|
|
115
|
+
'dailey_addon_cancel',
|
|
116
|
+
'Cancel an active à-la-carte add-on by its add-on id (from dailey_addons). Cancels the Stripe subscription item and removes the capacity from the account quota. Billing-owner-only.',
|
|
117
|
+
{ addon_id: z.string().describe('The add-on id to cancel (from dailey_addons)') },
|
|
118
|
+
async ({ addon_id }) => {
|
|
119
|
+
const res = await apiRequest<{ message: string; addon_id: string }>('DELETE', `/billing/addons/${addon_id}`);
|
|
120
|
+
if (!res.ok) return textResult(formatError(res));
|
|
121
|
+
return textResult(`${res.data.message || 'Add-on cancelled'} (${res.data.addon_id || addon_id}).`);
|
|
122
|
+
},
|
|
123
|
+
);
|
|
124
|
+
}
|