@daileyos/mcp-server 1.13.2 → 1.13.3
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/api.d.ts.map +1 -1
- package/dist/api.js +4 -1
- package/dist/api.js.map +1 -1
- package/dist/index.js +12 -7
- package/dist/index.js.map +1 -1
- package/dist/tools/credentials-reveal.js +1 -1
- package/dist/tools/credentials-reveal.js.map +1 -1
- package/dist/tools/deploy-status.d.ts.map +1 -1
- package/dist/tools/deploy-status.js +70 -0
- package/dist/tools/deploy-status.js.map +1 -1
- package/dist/tools/diagnose.d.ts.map +1 -1
- package/dist/tools/diagnose.js +152 -0
- package/dist/tools/diagnose.js.map +1 -1
- package/dist/tools/platform.d.ts.map +1 -1
- package/dist/tools/platform.js +82 -0
- package/dist/tools/platform.js.map +1 -1
- package/dist/tools/projects.d.ts.map +1 -1
- package/dist/tools/projects.js +1 -1
- package/dist/tools/projects.js.map +1 -1
- package/dist/tools/storage.d.ts.map +1 -1
- package/dist/tools/storage.js +30 -0
- package/dist/tools/storage.js.map +1 -1
- package/package.json +1 -1
- package/src/api.ts +4 -1
- package/src/index.ts +15 -7
- package/src/tools/credentials-reveal.ts +1 -1
- package/src/tools/deploy-status.ts +71 -0
- package/src/tools/diagnose.ts +183 -0
- package/src/tools/platform.ts +88 -0
- package/src/tools/projects.ts +3 -1
- package/src/tools/storage.ts +42 -0
- package/tests/pack1-mcp-preflight.test.mjs +11 -4
package/src/tools/platform.ts
CHANGED
|
@@ -83,4 +83,92 @@ export function registerPlatformTools(server: McpServer) {
|
|
|
83
83
|
return textResult(lines.join('\n'));
|
|
84
84
|
},
|
|
85
85
|
);
|
|
86
|
+
|
|
87
|
+
server.tool(
|
|
88
|
+
'dailey_os_guide',
|
|
89
|
+
'Return a guide on how Dailey OS works and the right approach for common tasks. Call this when you need context on platform architecture, database access patterns, deployment flow, or when a user asks how to do something in DOS and you are unsure of the right path.',
|
|
90
|
+
{},
|
|
91
|
+
async () => {
|
|
92
|
+
return textResult(`
|
|
93
|
+
Dailey OS — Platform Guide for AI Assistants
|
|
94
|
+
═════════════════════════════════════════════
|
|
95
|
+
|
|
96
|
+
## Architecture overview
|
|
97
|
+
|
|
98
|
+
Dailey OS is a managed app platform (like Heroku/Render) running on a private Kubernetes cluster.
|
|
99
|
+
Each customer has a namespace (customer-<slug>). Projects map to K8s Deployments.
|
|
100
|
+
Databases (MySQL or PostgreSQL) run on dedicated nodes, reachable only via Tailscale CGNAT IPs (100.x.x.x).
|
|
101
|
+
|
|
102
|
+
## Database access — choose the right path
|
|
103
|
+
|
|
104
|
+
### Reading data (no write access needed)
|
|
105
|
+
→ Use dailey_db_recall — runs a SELECT through the API, no Tailscale, no shell.
|
|
106
|
+
|
|
107
|
+
### Schema inspection
|
|
108
|
+
→ Use dailey_db_schema — returns all tables, columns, row counts.
|
|
109
|
+
|
|
110
|
+
### Applying a migration (DDL/DML)
|
|
111
|
+
→ Use dailey_db_exec — runs SQL in a transaction under a scoped user. Works for CREATE TABLE, ALTER, INSERT, UPDATE, etc.
|
|
112
|
+
|
|
113
|
+
### Importing a full database dump (pg_dump .sql or .pgdump, mysqldump .sql)
|
|
114
|
+
→ Tell the user to run: dailey db connect <project>
|
|
115
|
+
This opens a LOCAL port on 127.0.0.1 via WebSocket proxy (NO Tailscale required on their machine).
|
|
116
|
+
Then in a second terminal:
|
|
117
|
+
PostgreSQL SQL file: PGPASSWORD='...' psql -h 127.0.0.1 -p 15432 -U <user> -d <db> < dump.sql
|
|
118
|
+
PostgreSQL custom: pg_restore -h 127.0.0.1 -p 15432 -U <user> -d <db> dump.pgdump
|
|
119
|
+
MySQL: mysql -h 127.0.0.1 -P 13306 -u <user> -p<pass> <db> < dump.sql
|
|
120
|
+
The CLI prints ready-to-paste commands when the tunnel opens.
|
|
121
|
+
Session lasts 1 hour.
|
|
122
|
+
|
|
123
|
+
### Connecting a GUI tool (TablePlus, DBeaver, pgAdmin)
|
|
124
|
+
→ Same path: dailey db connect <project> — no Tailscale needed.
|
|
125
|
+
The CLI prints the local connection string. Point any GUI at 127.0.0.1 on the printed port.
|
|
126
|
+
|
|
127
|
+
### Bulk row insert/upsert (structured data, not a full dump)
|
|
128
|
+
→ Use dailey_db_import — accepts JSON array or CSV inline, two-phase commit (dry_run then confirm).
|
|
129
|
+
|
|
130
|
+
## Deployment flow
|
|
131
|
+
|
|
132
|
+
1. Customer pushes code to GitHub
|
|
133
|
+
2. Dailey detects the push via webhook → triggers a build
|
|
134
|
+
3. Build runs on a build-worker node (Docker/buildpack)
|
|
135
|
+
4. Image is pushed to registry.dailey.cloud/dailey/<slug>:<tag>
|
|
136
|
+
5. deploy-service rolls out new image to the K8s Deployment
|
|
137
|
+
6. Canary probe runs (HTTP health check) — rollback on failure
|
|
138
|
+
|
|
139
|
+
To redeploy manually: use dailey_deploy.
|
|
140
|
+
To check build status: use dailey_deploy_status or dailey_build_logs.
|
|
141
|
+
|
|
142
|
+
## Environment variables
|
|
143
|
+
|
|
144
|
+
- Set via dailey_env_set (single) or dailey_env_set_many (bulk)
|
|
145
|
+
- Changes take effect on next deploy (not live-patched)
|
|
146
|
+
- Never auto-generate or overwrite variables that look customer-set
|
|
147
|
+
- Sensitive vars (API keys, passwords) are encrypted at rest
|
|
148
|
+
|
|
149
|
+
## Storage (object storage)
|
|
150
|
+
|
|
151
|
+
- Each project has an R2 bucket prefix scoped to its project ID
|
|
152
|
+
- Credentials are auto-injected as S3_* env vars (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_ENDPOINT_URL, AWS_REGION, S3_BUCKET)
|
|
153
|
+
- Use any S3-compatible SDK — no Dailey-specific client needed
|
|
154
|
+
- For presigned URLs: use dailey_storage_presign_upload / dailey_storage_presign_download
|
|
155
|
+
|
|
156
|
+
## Common mistakes to avoid
|
|
157
|
+
|
|
158
|
+
- DO NOT suggest using third-party file hosts (transfer.sh, S3 public links) for database dumps — use dailey db connect instead
|
|
159
|
+
- DO NOT assume the customer needs Tailscale to connect a GUI tool or run psql — the CLI WebSocket proxy handles it
|
|
160
|
+
- DO NOT suggest mysqldump/pg_dump --host with the CGNAT IP (100.x.x.x) directly — that requires Tailscale
|
|
161
|
+
- DO NOT run dailey_db_import for full schema dumps — it's for structured row data only, not DDL
|
|
162
|
+
- DO NOT suggest redeploying to apply env var changes without confirming the user wants a redeploy
|
|
163
|
+
|
|
164
|
+
## Useful diagnostic sequence
|
|
165
|
+
|
|
166
|
+
User reports app is down / crashing:
|
|
167
|
+
1. dailey_deploy_status — check last deploy result
|
|
168
|
+
2. dailey_build_logs — check if latest build succeeded
|
|
169
|
+
3. dailey_diagnose — AI-powered diagnosis of pod/build state
|
|
170
|
+
4. dailey_processes — see running containers and recent restart counts
|
|
171
|
+
`.trim());
|
|
172
|
+
},
|
|
173
|
+
);
|
|
86
174
|
}
|
package/src/tools/projects.ts
CHANGED
|
@@ -26,7 +26,9 @@ export function registerProjectTools(server: McpServer) {
|
|
|
26
26
|
|
|
27
27
|
const projects = res.data.projects;
|
|
28
28
|
if (!projects || projects.length === 0) {
|
|
29
|
-
return textResult(
|
|
29
|
+
return textResult(
|
|
30
|
+
`No projects found.\n\nNew to Dailey OS? Call dailey_buddy to get started — it can deploy the blog template (covers every DOS feature in ~30 min) or help you get your own app running.`,
|
|
31
|
+
);
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
// Include slug — when multiple projects share a name (common with
|
package/src/tools/storage.ts
CHANGED
|
@@ -88,6 +88,13 @@ export function registerStorageTools(server: McpServer) {
|
|
|
88
88
|
`URL TTL: ${data.binding.limits.signed_url_ttl_seconds}s`,
|
|
89
89
|
];
|
|
90
90
|
|
|
91
|
+
// Surface credential-missing warning before anything else so the LLM
|
|
92
|
+
// sees it immediately and can call dailey_storage_enable to fix it.
|
|
93
|
+
if ((data as any).secret_warning) {
|
|
94
|
+
lines.push('');
|
|
95
|
+
lines.push(`⚠ WARNING: ${(data as any).secret_warning}`);
|
|
96
|
+
}
|
|
97
|
+
|
|
91
98
|
// Render the new integration_paths block when the API surfaces it.
|
|
92
99
|
// Older customer-api responses still set next_step; fall back to that
|
|
93
100
|
// verbatim so this tool keeps working during the rolling deploy.
|
|
@@ -205,6 +212,41 @@ export function registerStorageTools(server: McpServer) {
|
|
|
205
212
|
},
|
|
206
213
|
);
|
|
207
214
|
|
|
215
|
+
server.tool(
|
|
216
|
+
'dailey_storage_enable',
|
|
217
|
+
'Enable object storage on an existing project that was created without it, OR fix a project where storage was enabled but S3_* env vars are missing from the pod (secret_injected=false from dailey_storage_info). Provisions R2 credentials, creates the k8s secret, and patches the running deployment so pods pick up S3_* vars immediately. A redeploy is not required after calling this.',
|
|
218
|
+
{ project_id: z.string().describe('The project ID') },
|
|
219
|
+
async ({ project_id }) => {
|
|
220
|
+
const res = await apiRequest<{ ok: boolean; message: string; prefix: string }>(
|
|
221
|
+
'POST',
|
|
222
|
+
`/projects/${project_id}/storage/enable`,
|
|
223
|
+
);
|
|
224
|
+
if (!res.ok) {
|
|
225
|
+
// 409 means already enabled — check if the secret is actually present
|
|
226
|
+
if (res.status === 409) {
|
|
227
|
+
return textResult(
|
|
228
|
+
`Storage is already enabled for this project.\n\nIf S3_* vars are still missing from your pod, the credentials secret may not have been created correctly.\nCheck: dailey_storage_info to see secret_injected status.\nFix: redeploy the project (dailey_deploy) to re-mount the secret.`,
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
return textResult(formatError(res));
|
|
232
|
+
}
|
|
233
|
+
return textResult([
|
|
234
|
+
`Storage enabled.`,
|
|
235
|
+
``,
|
|
236
|
+
`Prefix: ${res.data.prefix}`,
|
|
237
|
+
``,
|
|
238
|
+
res.data.message,
|
|
239
|
+
``,
|
|
240
|
+
`S3_* env vars now available in your pod:`,
|
|
241
|
+
` S3_ENDPOINT, S3_REGION, S3_BUCKET_NAME`,
|
|
242
|
+
` S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEY, S3_SESSION_TOKEN, S3_KEY_PREFIX`,
|
|
243
|
+
``,
|
|
244
|
+
`Pods are restarting to pick up the new secret (~30s). No rebuild needed.`,
|
|
245
|
+
`If vars are still missing after 60s, call dailey_deploy to trigger a fresh rollout.`,
|
|
246
|
+
].join('\n'));
|
|
247
|
+
},
|
|
248
|
+
);
|
|
249
|
+
|
|
208
250
|
server.tool(
|
|
209
251
|
'dailey_storage_presign_download',
|
|
210
252
|
'For BROWSER-side flows. Server-side apps deployed on Dailey should instead use the S3 SDK with the auto-injected S3_* env vars (see dailey_storage_info). Creates a presigned download URL for an object in a project bucket.',
|
|
@@ -25,7 +25,8 @@ import assert from 'node:assert/strict';
|
|
|
25
25
|
import { spawn, spawnSync } from 'node:child_process';
|
|
26
26
|
import { join, dirname } from 'node:path';
|
|
27
27
|
import { fileURLToPath } from 'node:url';
|
|
28
|
-
import { existsSync } from 'node:fs';
|
|
28
|
+
import { existsSync, mkdtempSync } from 'node:fs';
|
|
29
|
+
import { tmpdir } from 'node:os';
|
|
29
30
|
|
|
30
31
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
31
32
|
const BINARY = join(__dirname, '..', 'dist', 'index.js');
|
|
@@ -42,10 +43,16 @@ function unbufferAvailable() {
|
|
|
42
43
|
*/
|
|
43
44
|
function runMcp({ env = {}, tty = false, waitMs = 4000, closeStdin = true }) {
|
|
44
45
|
return new Promise((resolve) => {
|
|
46
|
+
// Isolate HOME + XDG_CONFIG_HOME to an empty temp dir so the server's
|
|
47
|
+
// readCliStoredToken() (added in 1.13.2) can't pick up the CLI token of
|
|
48
|
+
// whoever runs the test — otherwise the "no creds" cases aren't actually
|
|
49
|
+
// cred-less on a machine with a logged-in Dailey CLI.
|
|
50
|
+
const isolatedHome = mkdtempSync(join(tmpdir(), 'dailey-mcp-test-'));
|
|
45
51
|
const cleanEnv = {
|
|
46
52
|
// Drop the parent's credentials unless explicitly restored below.
|
|
47
53
|
PATH: process.env.PATH,
|
|
48
|
-
HOME:
|
|
54
|
+
HOME: isolatedHome,
|
|
55
|
+
XDG_CONFIG_HOME: join(isolatedHome, '.config'),
|
|
49
56
|
NODE_PATH: process.env.NODE_PATH,
|
|
50
57
|
...env,
|
|
51
58
|
};
|
|
@@ -79,9 +86,9 @@ function runMcp({ env = {}, tty = false, waitMs = 4000, closeStdin = true }) {
|
|
|
79
86
|
try { child.kill('SIGTERM'); } catch {}
|
|
80
87
|
}, waitMs);
|
|
81
88
|
|
|
82
|
-
child.on('
|
|
89
|
+
child.on('close', (code) => {
|
|
83
90
|
clearTimeout(timer);
|
|
84
|
-
resolve({ code, stdout, stderr, killed: false });
|
|
91
|
+
setImmediate(() => resolve({ code, stdout, stderr, killed: false }));
|
|
85
92
|
});
|
|
86
93
|
child.on('error', (err) => {
|
|
87
94
|
clearTimeout(timer);
|