@daileyos/mcp-server 1.21.2 → 1.21.4

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.
Files changed (163) hide show
  1. package/dist/api.d.ts +7 -0
  2. package/dist/api.d.ts.map +1 -1
  3. package/dist/api.js +23 -2
  4. package/dist/api.js.map +1 -1
  5. package/dist/index.js +24 -17
  6. package/dist/index.js.map +1 -1
  7. package/dist/tools/accounts.js +1 -1
  8. package/dist/tools/accounts.js.map +1 -1
  9. package/dist/tools/ai.d.ts.map +1 -1
  10. package/dist/tools/ai.js +7 -1
  11. package/dist/tools/ai.js.map +1 -1
  12. package/dist/tools/auth.d.ts.map +1 -1
  13. package/dist/tools/auth.js +25 -6
  14. package/dist/tools/auth.js.map +1 -1
  15. package/dist/tools/backups.d.ts.map +1 -1
  16. package/dist/tools/backups.js +3 -1
  17. package/dist/tools/backups.js.map +1 -1
  18. package/dist/tools/build-logs.d.ts.map +1 -1
  19. package/dist/tools/build-logs.js +3 -1
  20. package/dist/tools/build-logs.js.map +1 -1
  21. package/dist/tools/credentials-reveal.d.ts.map +1 -1
  22. package/dist/tools/credentials-reveal.js +3 -1
  23. package/dist/tools/credentials-reveal.js.map +1 -1
  24. package/dist/tools/dailey-images.js +3 -3
  25. package/dist/tools/dailey-images.js.map +1 -1
  26. package/dist/tools/db-migrate.js +5 -5
  27. package/dist/tools/db-migrate.js.map +1 -1
  28. package/dist/tools/db.d.ts.map +1 -1
  29. package/dist/tools/db.js +17 -1
  30. package/dist/tools/db.js.map +1 -1
  31. package/dist/tools/deploy-status.d.ts.map +1 -1
  32. package/dist/tools/deploy-status.js +3 -1
  33. package/dist/tools/deploy-status.js.map +1 -1
  34. package/dist/tools/deploy.d.ts.map +1 -1
  35. package/dist/tools/deploy.js +9 -1
  36. package/dist/tools/deploy.js.map +1 -1
  37. package/dist/tools/domains.d.ts.map +1 -1
  38. package/dist/tools/domains.js +3 -1
  39. package/dist/tools/domains.js.map +1 -1
  40. package/dist/tools/email.d.ts.map +1 -1
  41. package/dist/tools/email.js +7 -1
  42. package/dist/tools/email.js.map +1 -1
  43. package/dist/tools/env.d.ts.map +1 -1
  44. package/dist/tools/env.js +5 -1
  45. package/dist/tools/env.js.map +1 -1
  46. package/dist/tools/environments.js +3 -3
  47. package/dist/tools/environments.js.map +1 -1
  48. package/dist/tools/exec-run.d.ts.map +1 -1
  49. package/dist/tools/exec-run.js +7 -1
  50. package/dist/tools/exec-run.js.map +1 -1
  51. package/dist/tools/images.d.ts.map +1 -1
  52. package/dist/tools/images.js +5 -1
  53. package/dist/tools/images.js.map +1 -1
  54. package/dist/tools/lifecycle.d.ts.map +1 -1
  55. package/dist/tools/lifecycle.js +5 -1
  56. package/dist/tools/lifecycle.js.map +1 -1
  57. package/dist/tools/links.d.ts.map +1 -1
  58. package/dist/tools/links.js +3 -1
  59. package/dist/tools/links.js.map +1 -1
  60. package/dist/tools/platform.d.ts.map +1 -1
  61. package/dist/tools/platform.js +3 -1
  62. package/dist/tools/platform.js.map +1 -1
  63. package/dist/tools/processes.d.ts.map +1 -1
  64. package/dist/tools/processes.js +11 -1
  65. package/dist/tools/processes.js.map +1 -1
  66. package/dist/tools/projects.d.ts.map +1 -1
  67. package/dist/tools/projects.js +36 -12
  68. package/dist/tools/projects.js.map +1 -1
  69. package/dist/tools/resource-config.d.ts.map +1 -1
  70. package/dist/tools/resource-config.js +3 -1
  71. package/dist/tools/resource-config.js.map +1 -1
  72. package/dist/tools/scale.d.ts.map +1 -1
  73. package/dist/tools/scale.js +3 -1
  74. package/dist/tools/scale.js.map +1 -1
  75. package/dist/tools/storage.d.ts.map +1 -1
  76. package/dist/tools/storage.js +11 -1
  77. package/dist/tools/storage.js.map +1 -1
  78. package/dist/tools/support.d.ts.map +1 -1
  79. package/dist/tools/support.js +3 -1
  80. package/dist/tools/support.js.map +1 -1
  81. package/dist/tools/usage.d.ts.map +1 -1
  82. package/dist/tools/usage.js +3 -1
  83. package/dist/tools/usage.js.map +1 -1
  84. package/dist/tools/wordpress-import.d.ts.map +1 -1
  85. package/dist/tools/wordpress-import.js +3 -1
  86. package/dist/tools/wordpress-import.js.map +1 -1
  87. package/dist/tools/wordpress-migrate.d.ts.map +1 -1
  88. package/dist/tools/wordpress-migrate.js +3 -1
  89. package/dist/tools/wordpress-migrate.js.map +1 -1
  90. package/dist/tools/wordpress-snapshot.d.ts.map +1 -1
  91. package/dist/tools/wordpress-snapshot.js +9 -1
  92. package/dist/tools/wordpress-snapshot.js.map +1 -1
  93. package/package.json +4 -1
  94. package/.dockerignore +0 -6
  95. package/.github/workflows/publish.yml +0 -120
  96. package/Dockerfile +0 -19
  97. package/claude-config.json +0 -13
  98. package/docs/superpowers/plans/2026-08-09-remote-mcp-endpoint.md +0 -663
  99. package/docs/superpowers/specs/2026-08-09-remote-mcp-endpoint-design.md +0 -66
  100. package/src/api.ts +0 -263
  101. package/src/context.ts +0 -12
  102. package/src/http.ts +0 -160
  103. package/src/index.ts +0 -94
  104. package/src/server.ts +0 -188
  105. package/src/tools/accounts.ts +0 -119
  106. package/src/tools/addons.ts +0 -124
  107. package/src/tools/admin.ts +0 -42
  108. package/src/tools/ai.ts +0 -83
  109. package/src/tools/analyze.ts +0 -108
  110. package/src/tools/auth.ts +0 -177
  111. package/src/tools/backups.ts +0 -84
  112. package/src/tools/billing.ts +0 -34
  113. package/src/tools/build-logs.ts +0 -65
  114. package/src/tools/bundle.ts +0 -129
  115. package/src/tools/cli.ts +0 -76
  116. package/src/tools/credentials-reveal.ts +0 -64
  117. package/src/tools/credits.ts +0 -97
  118. package/src/tools/dailey-images.ts +0 -151
  119. package/src/tools/db-migrate.ts +0 -211
  120. package/src/tools/db.ts +0 -391
  121. package/src/tools/deploy-status.ts +0 -247
  122. package/src/tools/deploy.ts +0 -101
  123. package/src/tools/diagnose.ts +0 -567
  124. package/src/tools/domains.ts +0 -156
  125. package/src/tools/email.ts +0 -101
  126. package/src/tools/env.ts +0 -205
  127. package/src/tools/environments.ts +0 -138
  128. package/src/tools/exec-run.ts +0 -91
  129. package/src/tools/images.ts +0 -221
  130. package/src/tools/lifecycle.ts +0 -75
  131. package/src/tools/links.ts +0 -69
  132. package/src/tools/platform.ts +0 -209
  133. package/src/tools/processes.ts +0 -182
  134. package/src/tools/project-transfer.ts +0 -129
  135. package/src/tools/projects.ts +0 -287
  136. package/src/tools/resource-config.ts +0 -84
  137. package/src/tools/scale.ts +0 -33
  138. package/src/tools/storage.ts +0 -281
  139. package/src/tools/support.ts +0 -42
  140. package/src/tools/usage.ts +0 -128
  141. package/src/tools/wordpress-import.ts +0 -174
  142. package/src/tools/wordpress-live-edit.ts +0 -250
  143. package/src/tools/wordpress-migrate.ts +0 -104
  144. package/src/tools/wordpress-snapshot.ts +0 -225
  145. package/src/tools/wordpress-targeting.ts +0 -188
  146. package/src/upload.ts +0 -35
  147. package/src/version.ts +0 -70
  148. package/test/context.test.ts +0 -36
  149. package/test/http.test.ts +0 -103
  150. package/test/server-surface.test.ts +0 -36
  151. package/test/use-account-sticky.test.ts +0 -28
  152. package/test/wordpress-import.test.ts +0 -223
  153. package/test/wordpress-live-edit.test.ts +0 -159
  154. package/test/wordpress-targeting.test.ts +0 -162
  155. package/tests/dailey-images.test.mjs +0 -156
  156. package/tests/environments.test.mjs +0 -230
  157. package/tests/mcp-protocol-smoke.mjs +0 -149
  158. package/tests/new-tools-smoke.mjs +0 -217
  159. package/tests/pack1-mcp-preflight.test.mjs +0 -184
  160. package/tests/pack6-smoke.mjs +0 -222
  161. package/tests/wp-snapshot-labels.test.mjs +0 -21
  162. package/tests/wp-snapshot.test.mjs +0 -261
  163. package/tsconfig.json +0 -19
package/src/tools/auth.ts DELETED
@@ -1,177 +0,0 @@
1
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- import { z } from 'zod';
3
- import { apiRequest, formatError, textResult, jsonResult, getActiveAccount } from '../api.js';
4
-
5
- interface ManagedAccount {
6
- managed_customer_id: string;
7
- slug: string;
8
- name: string;
9
- }
10
-
11
- interface AuthEnableResponse {
12
- ok: boolean;
13
- project_id: string;
14
- auth_enabled: boolean;
15
- created: boolean;
16
- app_slug: string;
17
- client_id: string;
18
- client_secret?: string;
19
- enrolled: boolean;
20
- x_client_id: string;
21
- origin: string;
22
- extra_origins: string[];
23
- core_base_url: string;
24
- note?: string;
25
- docs_url: string;
26
- }
27
-
28
- interface UserInfo {
29
- id: string;
30
- name: string;
31
- email: string;
32
- plan?: string;
33
- created_at?: string;
34
- }
35
-
36
- const AUTH_REQUIRED_ERROR = {
37
- error_code: 'DAILEY_AUTH_REQUIRED',
38
- message: 'Not authenticated',
39
- remediation: 'Run `dailey auth setup` in your terminal',
40
- help_url: 'https://docs.dailey.cloud/auth',
41
- };
42
-
43
- export function registerAuthTools(server: McpServer) {
44
- server.tool(
45
- 'dailey_whoami',
46
- 'Show current user info (name, email, plan)',
47
- {},
48
- async () => {
49
- const res = await apiRequest<UserInfo>('GET', '/customers/me');
50
- if (!res.ok) {
51
- if (res.status === 401 || res.status === 403) {
52
- return jsonResult(AUTH_REQUIRED_ERROR);
53
- }
54
- return textResult(formatError(res));
55
- }
56
-
57
- const u = res.data;
58
- const lines = [
59
- `User Info`,
60
- `─────────────────────`,
61
- `ID: ${u.id}`,
62
- `Name: ${u.name}`,
63
- `Email: ${u.email}`,
64
- ];
65
- if (u.plan) lines.push(`Plan: ${u.plan}`);
66
- if (u.created_at) lines.push(`Created: ${u.created_at}`);
67
- return textResult(lines.join('\n'));
68
- },
69
- );
70
-
71
- server.tool(
72
- 'dailey_auth_status',
73
- 'Check authentication status — returns whether the MCP server is authenticated and the account details if so',
74
- {},
75
- async () => {
76
- const res = await apiRequest<UserInfo>('GET', '/customers/me');
77
-
78
- if (!res.ok) {
79
- if (res.status === 401 || res.status === 403) {
80
- return jsonResult({
81
- authenticated: false,
82
- source: null,
83
- recommended_action: 'Run `dailey auth setup` in your terminal',
84
- });
85
- }
86
- // Non-auth error — surface it but don't claim unauthenticated
87
- return jsonResult({
88
- authenticated: false,
89
- source: null,
90
- recommended_action: `API error (${res.status}) — run \`dailey auth setup\` if your token is missing or expired`,
91
- });
92
- }
93
-
94
- const u = res.data;
95
-
96
- // Infer the token source from the environment the MCP server was started with.
97
- // DAILEY_API_TOKEN wins; email+password means a refreshed session JWT; otherwise
98
- // it must be a dk_ API key set some other way.
99
- let source: 'api_key' | 'env_token' | 'session' = 'session';
100
- const envToken = process.env.DAILEY_API_TOKEN || '';
101
- if (envToken.startsWith('dk_')) {
102
- source = 'api_key';
103
- } else if (envToken) {
104
- source = 'env_token';
105
- } else if (process.env.DAILEY_EMAIL) {
106
- source = 'session';
107
- }
108
-
109
- // Manager / managed-accounts: report whether this user manages any other
110
- // accounts (the fleet) and which one — if any — is the active context for
111
- // this session. A non-empty fleet means they can `dailey_use_account` to
112
- // operate inside one of these accounts. Best-effort: a failure here must
113
- // not break auth-status, so we swallow errors and report manager: null.
114
- let fleet: ManagedAccount[] = [];
115
- try {
116
- const mres = await apiRequest<ManagedAccount[]>('GET', '/customers/me/managed-accounts');
117
- if (mres.ok && Array.isArray(mres.data)) fleet = mres.data;
118
- } catch {
119
- // ignore — leave fleet empty
120
- }
121
- const active = getActiveAccount() ?? null;
122
-
123
- return jsonResult({
124
- authenticated: true,
125
- source,
126
- account: u.name,
127
- email: u.email,
128
- recommended_action: null,
129
- manager: {
130
- is_manager: fleet.length > 0,
131
- managed_accounts: fleet,
132
- active_account: active,
133
- operating_as: active ? 'managed_account' : 'self',
134
- },
135
- });
136
- },
137
- );
138
-
139
- server.tool(
140
- 'dailey_auth_enable',
141
- 'Enable Dailey Core authentication for a project in one call. Registers the app in Core, installs it in your Core tenant, and enrolls you — wrapping Core self-serve provisioning. The origin is derived from the project (https://<slug>.dailey.cloud, plus any *.dailey.cloud custom domains). After enabling, the app calls Core /auth/* with header X-Client-Id: <app_slug>; the JWT tenant claim is `tenant`. client_secret is returned ONLY the first time. enforce_enrolled_factors defaults to false so password login still works alongside passkeys.',
142
- {
143
- project_id: z.string().describe('The project ID'),
144
- enforce_enrolled_factors: z
145
- .boolean()
146
- .optional()
147
- .describe('Require enrolled factors (e.g. passkey) at login. Defaults to false so password login still works.'),
148
- },
149
- async ({ project_id, enforce_enrolled_factors }) => {
150
- const res = await apiRequest<AuthEnableResponse>('POST', `/projects/${project_id}/auth/enable`, {
151
- enforce_enrolled_factors: enforce_enrolled_factors === true,
152
- });
153
- if (!res.ok) return textResult(formatError(res));
154
- const d = res.data;
155
- const lines = [
156
- `Dailey Core authentication enabled for project ${d.project_id}.`,
157
- '',
158
- `App / X-Client-Id: ${d.app_slug}`,
159
- `Origin: ${d.origin}`,
160
- ...(d.extra_origins && d.extra_origins.length ? [`Also allowed: ${d.extra_origins.join(', ')}`] : []),
161
- `Core base URL: ${d.core_base_url}`,
162
- `Enrolled: ${d.enrolled ? 'yes' : 'no'}`,
163
- ];
164
- if (d.client_secret) {
165
- lines.push('', `⚠ Save this client_secret — it is shown only once:`, ` ${d.client_secret}`);
166
- } else if (d.note) {
167
- lines.push('', d.note);
168
- }
169
- lines.push(
170
- '',
171
- `Call Core /auth/* with header X-Client-Id: ${d.x_client_id}. The token tenant claim is \`tenant\`.`,
172
- `Docs: ${d.docs_url}`,
173
- );
174
- return textResult(lines.join('\n'));
175
- },
176
- );
177
- }
@@ -1,84 +0,0 @@
1
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- import { z } from 'zod';
3
- import { apiRequest, formatError, textResult } from '../api.js';
4
-
5
- interface Backup {
6
- key: string;
7
- timestamp?: string;
8
- size_mb?: number;
9
- last_modified?: string;
10
- }
11
-
12
- interface BackupsResponse {
13
- backups?: Backup[];
14
- total?: number;
15
- error?: string;
16
- }
17
-
18
- export function registerBackupTools(server: McpServer) {
19
- server.tool(
20
- 'dailey_backups',
21
- 'List, create, or restore backups for a project. Use before risky changes (schema migrations, major redeploys).',
22
- {
23
- project_id: z.string().describe('The project ID'),
24
- action: z.enum(['list', 'create', 'restore', 'download']).describe('list | create | restore | download'),
25
- backup_key: z.string().optional().describe('Backup key (required for restore/download)'),
26
- },
27
- async ({ project_id, action, backup_key }) => {
28
- if (action === 'list') {
29
- const res = await apiRequest<BackupsResponse>('GET', `/projects/${project_id}/backups`);
30
- if (!res.ok) return textResult(formatError(res));
31
-
32
- const backups = res.data.backups || [];
33
- if (backups.length === 0) {
34
- const err = res.data.error ? `\n\nNote: ${res.data.error}` : '';
35
- return textResult(`No backups found for this project.${err}`);
36
- }
37
-
38
- const lines = [
39
- `Backups (${backups.length})`,
40
- `${'Timestamp'.padEnd(24)} ${'Size'.padEnd(10)} Key`,
41
- '─'.repeat(90),
42
- ];
43
- for (const b of backups) {
44
- lines.push(`${(b.timestamp || '-').padEnd(24)} ${String((b.size_mb ?? 0) + ' MB').padEnd(10)} ${b.key}`);
45
- }
46
- lines.push('');
47
- lines.push('Restore with: dailey_backups action=restore backup_key=<key>');
48
- return textResult(lines.join('\n'));
49
- }
50
-
51
- if (action === 'create') {
52
- const res = await apiRequest<{ triggered?: boolean; message?: string }>(
53
- 'POST',
54
- `/projects/${project_id}/backups`,
55
- );
56
- if (!res.ok) return textResult(formatError(res));
57
- return textResult(res.data.message || 'Backup triggered.');
58
- }
59
-
60
- if (action === 'restore') {
61
- if (!backup_key) return textResult('Error: backup_key is required for restore.');
62
- const res = await apiRequest<{ restored?: boolean; message?: string }>(
63
- 'POST',
64
- `/projects/${project_id}/backups/restore`,
65
- { backup_key },
66
- );
67
- if (!res.ok) return textResult(formatError(res));
68
- return textResult(res.data.message || `Restored from ${backup_key}.`);
69
- }
70
-
71
- if (action === 'download') {
72
- if (!backup_key) return textResult('Error: backup_key is required for download.');
73
- const res = await apiRequest<{ url?: string; expires_in?: number }>(
74
- 'GET',
75
- `/projects/${project_id}/backups/download?key=${encodeURIComponent(backup_key)}`,
76
- );
77
- if (!res.ok) return textResult(formatError(res));
78
- return textResult(`Download URL (expires in ${res.data.expires_in || 3600}s):\n${res.data.url}`);
79
- }
80
-
81
- return textResult('Invalid action. Use list, create, restore, or download.');
82
- },
83
- );
84
- }
@@ -1,34 +0,0 @@
1
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- import { z } from 'zod';
3
- import { apiRequest, formatError, textResult, jsonResult } from '../api.js';
4
-
5
- export function registerBillingTools(server: McpServer) {
6
- server.tool(
7
- 'dailey_billing',
8
- 'Get current billing info and resource usage',
9
- {},
10
- async () => {
11
- const res = await apiRequest<Record<string, unknown>>('GET', '/billing');
12
- if (!res.ok) return textResult(formatError(res));
13
- return jsonResult(res.data);
14
- },
15
- );
16
-
17
- server.tool(
18
- 'dailey_billing_estimate',
19
- 'Estimate cost impact of scaling a project to N additional replicas. Only the "scale" action is supported today — the action argument is reserved for future cost estimators (e.g., adding storage, adding a DB) and will be removed when we have one canonical estimator.',
20
- {
21
- replicas: z.number().describe('Total additional replicas to add across all projects when estimating the scale delta.'),
22
- action: z.enum(['scale']).optional().describe('Action to estimate. Only "scale" is implemented; omit for the default.'),
23
- },
24
- async ({ replicas, action }) => {
25
- const effectiveAction = action || 'scale';
26
- const res = await apiRequest<Record<string, unknown>>(
27
- 'GET',
28
- `/billing/estimate?action=${encodeURIComponent(effectiveAction)}&replicas=${replicas}`,
29
- );
30
- if (!res.ok) return textResult(formatError(res));
31
- return jsonResult(res.data);
32
- },
33
- );
34
- }
@@ -1,65 +0,0 @@
1
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- import { z } from 'zod';
3
- import { apiRequest, formatError, textResult } from '../api.js';
4
-
5
- interface Build {
6
- id: string;
7
- status?: string;
8
- started_at?: string;
9
- finished_at?: string;
10
- commit_sha?: string;
11
- }
12
-
13
- interface BuildRow {
14
- id: string;
15
- status: string;
16
- log?: string;
17
- started_at?: string;
18
- finished_at?: string;
19
- commit_sha?: string;
20
- }
21
-
22
- export function registerBuildLogsTools(server: McpServer) {
23
- server.tool(
24
- 'dailey_build_logs',
25
- 'Fetch the full build log for a specific build (or the most recent build if build_id is omitted). Use this after a deploy fails to see the actual compiler/Docker output.',
26
- {
27
- project_id: z.string().describe('The project ID'),
28
- build_id: z.string().optional().describe('Specific build ID (defaults to the most recent build for the project)'),
29
- tail: z.number().int().min(1).max(5000).optional().describe('Return only the last N lines (default: full log)'),
30
- },
31
- async ({ project_id, build_id, tail }) => {
32
- let targetBuildId = build_id;
33
-
34
- if (!targetBuildId) {
35
- const historyRes = await apiRequest<{ builds: Build[] }>('GET', `/projects/${project_id}/deploys`);
36
- if (!historyRes.ok) return textResult(formatError(historyRes));
37
- const builds = historyRes.data.builds || [];
38
- if (builds.length === 0) {
39
- return textResult('No builds found for this project.');
40
- }
41
- targetBuildId = builds[0].id;
42
- }
43
-
44
- const buildRes = await apiRequest<BuildRow>('GET', `/builds/${targetBuildId}`);
45
- if (!buildRes.ok) return textResult(formatError(buildRes));
46
-
47
- const build = buildRes.data;
48
- const log = build.log || '';
49
- const allLines = log.split('\n');
50
- const shown = tail ? allLines.slice(-tail) : allLines;
51
-
52
- const header = [
53
- `Build ${build.id}`,
54
- `Status: ${build.status || 'unknown'}`,
55
- `Commit: ${build.commit_sha || '-'}`,
56
- `Started: ${build.started_at || '-'}`,
57
- `Finished: ${build.finished_at || '-'}`,
58
- `Lines: ${allLines.length}${tail ? ` (showing last ${Math.min(tail, allLines.length)})` : ''}`,
59
- '─'.repeat(60),
60
- ];
61
-
62
- return textResult([...header, ...shown].join('\n'));
63
- },
64
- );
65
- }
@@ -1,129 +0,0 @@
1
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- import { z } from 'zod';
3
- import { apiRequest, formatError, textResult } from '../api.js';
4
-
5
- /**
6
- * dailey_deploy_bundle — atomic create + configure + deploy in one call.
7
- *
8
- * Replaces what used to be 4–30 separate MCP calls (create_project +
9
- * set_env_var × N + service_links × M + deploy + ...). Each of those
10
- * required its own Claude Code permission prompt, which was Scott's
11
- * friction #8. One call, one prompt, whole-bundle rollback on failure.
12
- *
13
- * EOS #53.
14
- */
15
-
16
- export function registerBundleTools(server: McpServer) {
17
- server.tool(
18
- 'dailey_deploy_bundle',
19
- [
20
- 'Create a project, inject env vars, link to other projects, bind a domain, and trigger the deploy — all in one atomic call.',
21
- 'If any step fails, the project is rolled back (deleted) so you do not end up with a partial "failed" project.',
22
- 'Prefer this over dailey_create_project + dailey_env_vars + dailey_service_links + dailey_deploy for any fresh deploy — it burns one permission prompt instead of many, and guarantees all-or-nothing.',
23
- ].join(' '),
24
- {
25
- name: z.string().describe('Project name (also used as the requested slug).'),
26
- repo_url: z.string().describe('GitHub repo URL (https://github.com/owner/repo) or Docker image (e.g., nginx:alpine).'),
27
- branch: z.string().optional().describe('Git branch to deploy. Defaults to main. Ignored for Docker images.'),
28
- env_vars: z
29
- .record(z.string())
30
- .optional()
31
- .describe('Environment variables as a flat object, e.g. { DATABASE_URL: "postgresql://...", REDIS_URL: "..." }.'),
32
- database: z
33
- .union([z.enum(['mysql', 'postgres']), z.boolean()])
34
- .optional()
35
- .describe('Provision a managed DB: "mysql" | "postgres" | true (= mysql) | false. For Prisma/pg apps, use "postgres".'),
36
- needs_auth: z.boolean().optional().describe('Provision Dailey Auth (SSO) for this project.'),
37
- needs_storage: z.boolean().optional().describe('Provision object storage (R2) for this project.'),
38
- links: z
39
- .array(
40
- z.object({
41
- target_project_id: z.string().describe('ID of the project to link to (e.g., a Postgres project).'),
42
- env_key: z.string().optional().describe('Env key to inject on the source project. Defaults to an uppercased version of the target name.'),
43
- }),
44
- )
45
- .optional()
46
- .describe('Service links to inject into the new project. For DB targets, the injected env var is a real connection string (postgresql://, mysql://, etc.).'),
47
- domain: z.string().optional().describe('Optional custom domain to bind (e.g., my-app.example.com). Must pass DNS-check after deploy.'),
48
- deploy: z.boolean().optional().describe('Trigger a deploy after configuration. Defaults to true.'),
49
- },
50
- async (input) => {
51
- // Translate to server shape: the bundle endpoint takes needs_database
52
- // + database_type separately, same shape as POST /projects.
53
- let needs_database = false;
54
- let database_type: 'mysql' | 'postgres' | undefined;
55
- if (input.database === true) { needs_database = true; database_type = 'mysql'; }
56
- else if (input.database === 'mysql' || input.database === 'postgres') {
57
- needs_database = true;
58
- database_type = input.database;
59
- }
60
-
61
- const res = await apiRequest<any>('POST', '/projects/bundle', {
62
- name: input.name,
63
- repo_url: input.repo_url,
64
- branch: input.branch,
65
- env_vars: input.env_vars,
66
- needs_database,
67
- database_type,
68
- needs_auth: input.needs_auth,
69
- needs_storage: input.needs_storage,
70
- links: input.links,
71
- domain: input.domain,
72
- deploy: input.deploy,
73
- });
74
-
75
- if (!res.ok) {
76
- // Bundle endpoint returns structured failure with a rolled_back flag
77
- // and a steps array showing which stage died.
78
- const body: any = res.data;
79
- const lines: string[] = [];
80
- lines.push(`Bundle failed: ${body?.error || formatError(res)}`);
81
- if (body?.rolled_back) {
82
- lines.push('Rolled back cleanly — no partial project left behind.');
83
- } else {
84
- lines.push('⚠ NOT rolled back — a partial project may exist. Inspect dailey_list_projects.');
85
- }
86
- if (Array.isArray(body?.steps)) {
87
- lines.push('');
88
- lines.push('Steps:');
89
- for (const s of body.steps) {
90
- const mark = s.status === 'ok' ? '✓' : '✗';
91
- lines.push(` ${mark} ${s.step} (${s.ms}ms)${s.status === 'failed' && s.detail ? ` — ${JSON.stringify(s.detail)}` : ''}`);
92
- }
93
- }
94
- return textResult(lines.join('\n'));
95
- }
96
-
97
- const data: any = res.data;
98
- const project = data.project || {};
99
- const lines: string[] = [];
100
- lines.push(`✓ Bundled deploy for ${project.name || input.name}`);
101
- lines.push('');
102
- lines.push(`Project ID: ${project.id}`);
103
- lines.push(`Slug: ${project.slug}`);
104
- lines.push(`URL: ${project.url || `https://${project.slug}.dailey.cloud`}`);
105
- if (project.database) lines.push(`Database: ${project.database.database} (${project.database.type || database_type || 'mysql'})`);
106
- if (Array.isArray(data.links) && data.links.length > 0) {
107
- lines.push('');
108
- lines.push('Service links:');
109
- for (const l of data.links) {
110
- lines.push(` ${l.env_key} → ${l.target_slug} (${l.kind})`);
111
- }
112
- }
113
- if (data.domain) lines.push(`Domain: ${data.domain.hostname || input.domain}`);
114
- if (data.build_id) {
115
- lines.push('');
116
- lines.push(`Build ID: ${data.build_id}`);
117
- lines.push(`Track progress: dailey_deploy_status with project_id=${project.id}`);
118
- }
119
- if (Array.isArray(data.steps)) {
120
- const ok = data.steps.filter((s: any) => s.status === 'ok').length;
121
- const total = data.steps.length;
122
- const totalMs = data.steps.reduce((sum: number, s: any) => sum + (s.ms || 0), 0);
123
- lines.push('');
124
- lines.push(`(${ok}/${total} steps succeeded in ${totalMs}ms)`);
125
- }
126
- return textResult(lines.join('\n'));
127
- },
128
- );
129
- }
package/src/tools/cli.ts DELETED
@@ -1,76 +0,0 @@
1
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- import { z } from 'zod';
3
- import { textResult } from '../api.js';
4
-
5
- function shellQuote(s: string): string {
6
- if (/^[A-Za-z0-9_.\-\/]+$/.test(s)) return s;
7
- return `'${s.replace(/'/g, `'\\''`)}'`;
8
- }
9
-
10
- export function registerCliTools(server: McpServer): void {
11
- server.tool(
12
- 'dailey_cli_suggest_import',
13
- "DEPRECATED — prefer `dailey_db_import` which executes end-to-end without dropping to the host shell. This tool remains for environments where the MCP client can't upload inline data (payload > ~256 KB) and the agent would rather suggest a local `dailey db import` command the user runs themselves. Pure string construction, no I/O. Defaults to --dry-run.",
14
- {
15
- project: z.string().describe('Project slug or id (e.g. "wordgym")'),
16
- table: z.string().describe('Target table name'),
17
- file: z
18
- .string()
19
- .describe(
20
- 'Local file path to JSON array or CSV file (must exist on the user machine when the command runs)',
21
- ),
22
- mode: z.enum(['insert', 'upsert']).describe('Write mode'),
23
- conflict_keys: z
24
- .array(z.string())
25
- .optional()
26
- .describe('Conflict keys; required if mode=upsert'),
27
- dry_run: z
28
- .boolean()
29
- .optional()
30
- .default(true)
31
- .describe(
32
- 'Default true — constructs a command with --dry-run. Set false to construct a --confirm variant (the caller supplies the token from a prior dry-run output).',
33
- ),
34
- },
35
- async ({ project, table, file, mode, conflict_keys, dry_run }) => {
36
- if (mode === 'upsert' && (!conflict_keys || conflict_keys.length === 0)) {
37
- return textResult('error: mode=upsert requires conflict_keys');
38
- }
39
-
40
- const parts = [
41
- 'dailey db import',
42
- shellQuote(project),
43
- shellQuote(file),
44
- `--table ${shellQuote(table)}`,
45
- `--mode ${mode}`,
46
- ];
47
- if (mode === 'upsert' && conflict_keys) {
48
- for (const k of conflict_keys) parts.push(`--key ${shellQuote(k)}`);
49
- }
50
- if (dry_run) parts.push('--dry-run');
51
- parts.push('--json');
52
-
53
- const command = parts.join(' ');
54
- const explanation =
55
- mode === 'upsert'
56
- ? `Upserts rows from ${file} into ${table}; conflicts resolve on ${(conflict_keys ?? []).join(', ')}. ${dry_run ? 'Dry-run only — server returns a confirmation token for a follow-up commit.' : 'Commit phase — expects --confirm <token> from a prior dry-run.'}`
57
- : `Inserts rows from ${file} into ${table}. ${dry_run ? 'Dry-run only — server returns a confirmation token for a follow-up commit.' : 'Commit phase — expects --confirm <token> from a prior dry-run.'}`;
58
-
59
- const preflight = [
60
- { check: 'file_exists', path: file },
61
- { check: 'schema_compatible', table },
62
- ];
63
-
64
- const output = {
65
- command,
66
- explanation,
67
- preflight,
68
- expected_output: 'json',
69
- on_dry_run_success:
70
- 're-run with --confirm <token_from_dry_run_output> (remove --dry-run)',
71
- };
72
-
73
- return textResult(JSON.stringify(output, null, 2));
74
- },
75
- );
76
- }
@@ -1,64 +0,0 @@
1
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- import { z } from 'zod';
3
- import { apiRequest, formatError, textResult } from '../api.js';
4
-
5
- /**
6
- * Mask a credential value for display. Keeps the last 3 characters so the
7
- * caller can sanity-check which credential they're looking at, hides the
8
- * rest. Returns just the length indicator for very short values.
9
- */
10
- function maskValue(v: string): string {
11
- if (!v) return '(empty)';
12
- if (v.length <= 4) return '•'.repeat(v.length) + ` (${v.length} chars)`;
13
- const tail = v.slice(-3);
14
- return '•'.repeat(Math.min(v.length - 3, 12)) + tail + ` (${v.length} chars)`;
15
- }
16
-
17
- export function registerCredentialRevealTools(server: McpServer) {
18
- server.tool(
19
- 'dailey_reveal_credential',
20
- 'Reveal a project credential after re-auth. Supports DB credentials (DB_PASSWORD, DB_USER, DB_HOST, DB_PORT, DB_NAME) and storage credentials (S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEY, S3_SESSION_TOKEN, S3_ENDPOINT, S3_REGION, S3_BUCKET_NAME, S3_KEY_PREFIX). Every reveal is audited. BY DEFAULT returns a masked preview (last 3 chars + length) so the value never enters chat transcripts. Pass emit_plaintext=true to see the full value — only do this when you understand the chat-log exposure. Better workflow for S3 vars: use dailey_storage_enable to fix missing injection; use dailey_db_tunnel for DB creds.',
21
- {
22
- project_id: z.string().describe('The project ID'),
23
- key: z.string().describe('Credential key (e.g., DB_PASSWORD, WORDPRESS_ADMIN_PASSWORD)'),
24
- password: z.string().optional().describe('Account password for re-auth (falls back to DAILEY_PASSWORD env var)'),
25
- emit_plaintext: z.boolean().optional().describe('If true, emits the cleartext credential into the response. Default false. Only set true when you understand the chat-log exposure. Rotate immediately afterward if the transcript will be shared.'),
26
- },
27
- async ({ project_id, key, password, emit_plaintext }) => {
28
- const pw = password || process.env.DAILEY_PASSWORD;
29
- if (!pw) {
30
- return textResult(
31
- 'Error: re-auth password required. Set DAILEY_PASSWORD env var or pass password argument. Every reveal is audited.',
32
- );
33
- }
34
-
35
- const res = await apiRequest<{ key: string; value: string }>(
36
- 'POST',
37
- `/projects/${project_id}/credentials/reveal`,
38
- { key, password: pw },
39
- );
40
- if (!res.ok) return textResult(formatError(res));
41
-
42
- const { key: k, value } = res.data;
43
- const lines: string[] = [];
44
-
45
- if (emit_plaintext) {
46
- lines.push(`${k}: ${value}`);
47
- lines.push('');
48
- lines.push('⚠ EMITTED CLEARTEXT — this response is now in the chat log. Rotate');
49
- lines.push(' this credential now via dailey_env_vars set if the transcript is shared,');
50
- lines.push(' synced to cloud AI history, or anywhere outside a private terminal.');
51
- } else {
52
- lines.push(`${k}: ${maskValue(value)} [masked — pass emit_plaintext=true to see]`);
53
- lines.push('');
54
- lines.push('The full credential was NOT emitted. Reveal is audited server-side either way.');
55
- lines.push('If you need the cleartext:');
56
- lines.push(' • dailey_db_tunnel (for DB creds — opens a local port, no value in chat)');
57
- lines.push(' • dashboard "reveal" (browser-only modal — does not hit chat)');
58
- lines.push(' • dailey_reveal_credential(..., emit_plaintext=true) as last resort');
59
- }
60
-
61
- return textResult(lines.join('\n'));
62
- },
63
- );
64
- }