@daileyos/mcp-server 1.0.2 → 1.2.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/.github/workflows/publish.yml +93 -0
- package/LICENSE +21 -0
- package/README.md +130 -0
- package/dist/index.js +31 -7
- package/dist/index.js.map +1 -1
- package/dist/tools/analyze.d.ts +3 -0
- package/dist/tools/analyze.d.ts.map +1 -0
- package/dist/tools/analyze.js +67 -0
- package/dist/tools/analyze.js.map +1 -0
- package/dist/tools/backups.d.ts +3 -0
- package/dist/tools/backups.d.ts.map +1 -0
- package/dist/tools/backups.js +55 -0
- package/dist/tools/backups.js.map +1 -0
- package/dist/tools/build-logs.d.ts +3 -0
- package/dist/tools/build-logs.d.ts.map +1 -0
- package/dist/tools/build-logs.js +39 -0
- package/dist/tools/build-logs.js.map +1 -0
- package/dist/tools/cli.d.ts +3 -0
- package/dist/tools/cli.d.ts.map +1 -0
- package/dist/tools/cli.js +61 -0
- package/dist/tools/cli.js.map +1 -0
- package/dist/tools/credentials-reveal.d.ts +3 -0
- package/dist/tools/credentials-reveal.d.ts.map +1 -0
- package/dist/tools/credentials-reveal.js +19 -0
- package/dist/tools/credentials-reveal.js.map +1 -0
- package/dist/tools/db.d.ts.map +1 -1
- package/dist/tools/db.js +93 -1
- package/dist/tools/db.js.map +1 -1
- package/dist/tools/deploy-status.d.ts +3 -0
- package/dist/tools/deploy-status.d.ts.map +1 -0
- package/dist/tools/deploy-status.js +109 -0
- package/dist/tools/deploy-status.js.map +1 -0
- package/dist/tools/domains.d.ts.map +1 -1
- package/dist/tools/domains.js +81 -17
- package/dist/tools/domains.js.map +1 -1
- package/dist/tools/images.d.ts.map +1 -1
- package/dist/tools/images.js +2 -1
- package/dist/tools/images.js.map +1 -1
- package/dist/tools/lifecycle.d.ts +3 -0
- package/dist/tools/lifecycle.d.ts.map +1 -0
- package/dist/tools/lifecycle.js +53 -0
- package/dist/tools/lifecycle.js.map +1 -0
- package/dist/tools/links.d.ts +3 -0
- package/dist/tools/links.d.ts.map +1 -0
- package/dist/tools/links.js +55 -0
- package/dist/tools/links.js.map +1 -0
- package/dist/tools/processes.d.ts +3 -0
- package/dist/tools/processes.d.ts.map +1 -0
- package/dist/tools/processes.js +98 -0
- package/dist/tools/processes.js.map +1 -0
- package/dist/tools/projects.d.ts.map +1 -1
- package/dist/tools/projects.js +13 -0
- package/dist/tools/projects.js.map +1 -1
- package/dist/tools/resource-config.d.ts +3 -0
- package/dist/tools/resource-config.d.ts.map +1 -0
- package/dist/tools/resource-config.js +56 -0
- package/dist/tools/resource-config.js.map +1 -0
- package/dist/tools/scale.d.ts.map +1 -1
- package/dist/tools/scale.js +9 -2
- package/dist/tools/scale.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +36 -7
- package/src/tools/analyze.ts +98 -0
- package/src/tools/backups.ts +84 -0
- package/src/tools/build-logs.ts +65 -0
- package/src/tools/cli.ts +76 -0
- package/src/tools/credentials-reveal.ts +31 -0
- package/src/tools/db.ts +105 -1
- package/src/tools/deploy-status.ts +149 -0
- package/src/tools/domains.ts +116 -21
- package/src/tools/images.ts +2 -1
- package/src/tools/lifecycle.ts +75 -0
- package/src/tools/links.ts +69 -0
- package/src/tools/processes.ts +172 -0
- package/src/tools/projects.ts +14 -0
- package/src/tools/resource-config.ts +84 -0
- package/src/tools/scale.ts +17 -3
- package/tests/mcp-protocol-smoke.mjs +149 -0
- package/tests/new-tools-smoke.mjs +211 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Smoke test for the v1.1.0 MCP tools.
|
|
4
|
+
*
|
|
5
|
+
* Exercises every new tool against a real Dailey OS account, reports
|
|
6
|
+
* pass/fail per tool. Does NOT mutate (no deploys, no deletes, no creates).
|
|
7
|
+
* Looks for a project to test against — if none exists, skips project-
|
|
8
|
+
* scoped tests.
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* DAILEY_EMAIL=... DAILEY_PASSWORD=... node tests/new-tools-smoke.mjs
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const API_URL = process.env.DAILEY_API_URL || 'https://os.dailey.cloud/api';
|
|
15
|
+
const EMAIL = process.env.DAILEY_EMAIL;
|
|
16
|
+
const PASSWORD = process.env.DAILEY_PASSWORD;
|
|
17
|
+
|
|
18
|
+
if (!EMAIL || !PASSWORD) {
|
|
19
|
+
console.error('DAILEY_EMAIL and DAILEY_PASSWORD must be set');
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let token = '';
|
|
24
|
+
|
|
25
|
+
async function login() {
|
|
26
|
+
const res = await fetch(`${API_URL}/customers/login`, {
|
|
27
|
+
method: 'POST',
|
|
28
|
+
headers: { 'Content-Type': 'application/json' },
|
|
29
|
+
body: JSON.stringify({ email: EMAIL, password: PASSWORD }),
|
|
30
|
+
});
|
|
31
|
+
if (!res.ok) throw new Error(`login failed: ${res.status}`);
|
|
32
|
+
const data = await res.json();
|
|
33
|
+
token = data.access_token;
|
|
34
|
+
return data;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async function call(method, path, body) {
|
|
38
|
+
const opts = {
|
|
39
|
+
method,
|
|
40
|
+
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
|
|
41
|
+
};
|
|
42
|
+
if (body) opts.body = JSON.stringify(body);
|
|
43
|
+
const res = await fetch(`${API_URL}${path}`, opts);
|
|
44
|
+
const text = await res.text();
|
|
45
|
+
let data;
|
|
46
|
+
try { data = JSON.parse(text); } catch { data = text; }
|
|
47
|
+
return { status: res.status, ok: res.ok, data };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const results = [];
|
|
51
|
+
function report(name, passed, detail) {
|
|
52
|
+
const icon = passed ? '✓' : '✗';
|
|
53
|
+
const line = `${icon} ${name}${detail ? ` — ${detail}` : ''}`;
|
|
54
|
+
console.log(line);
|
|
55
|
+
results.push({ name, passed, detail });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function test(name, fn) {
|
|
59
|
+
try {
|
|
60
|
+
const detail = await fn();
|
|
61
|
+
report(name, true, detail);
|
|
62
|
+
} catch (err) {
|
|
63
|
+
report(name, false, err.message);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async function main() {
|
|
68
|
+
console.log(`Dailey MCP smoke test against ${API_URL}`);
|
|
69
|
+
console.log('─'.repeat(60));
|
|
70
|
+
|
|
71
|
+
const login_data = await login();
|
|
72
|
+
console.log(`Authed as ${login_data.customer?.email || EMAIL}`);
|
|
73
|
+
console.log('');
|
|
74
|
+
|
|
75
|
+
// Find a project to test against
|
|
76
|
+
const projects = await call('GET', '/projects');
|
|
77
|
+
if (!projects.ok || !projects.data.projects?.length) {
|
|
78
|
+
console.log('No projects found — skipping project-scoped tests');
|
|
79
|
+
process.exit(0);
|
|
80
|
+
}
|
|
81
|
+
const project = projects.data.projects[0];
|
|
82
|
+
console.log(`Testing against project: ${project.name} (${project.id})`);
|
|
83
|
+
console.log('');
|
|
84
|
+
|
|
85
|
+
// Endpoints backing the new MCP tools
|
|
86
|
+
await test('dailey_deploy_status', async () => {
|
|
87
|
+
const r = await call('GET', `/projects/${project.id}/deploy-status`);
|
|
88
|
+
if (!r.ok) throw new Error(`HTTP ${r.status}: ${JSON.stringify(r.data)}`);
|
|
89
|
+
return `mode=${r.data.mode}, can_deploy=${r.data.can_deploy}`;
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
await test('dailey_build_logs (builds list)', async () => {
|
|
93
|
+
const r = await call('GET', `/projects/${project.id}/deploys`);
|
|
94
|
+
if (!r.ok) throw new Error(`HTTP ${r.status}`);
|
|
95
|
+
return `${r.data.builds?.length ?? 0} builds`;
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
await test('dailey_build_logs (fetch log)', async () => {
|
|
99
|
+
const list = await call('GET', `/projects/${project.id}/deploys`);
|
|
100
|
+
if (!list.ok) throw new Error(`list HTTP ${list.status}`);
|
|
101
|
+
const latest = list.data.builds?.[0];
|
|
102
|
+
if (!latest) return 'no builds — skipped';
|
|
103
|
+
const r = await call('GET', `/builds/${latest.id}`);
|
|
104
|
+
if (!r.ok) throw new Error(`HTTP ${r.status}`);
|
|
105
|
+
const logLen = (r.data.log || '').length;
|
|
106
|
+
return `build ${latest.id} status=${r.data.status} log=${logLen} bytes`;
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
await test('dailey_processes', async () => {
|
|
110
|
+
const r = await call('GET', `/projects/${project.id}/processes`);
|
|
111
|
+
if (!r.ok) throw new Error(`HTTP ${r.status}: ${JSON.stringify(r.data)}`);
|
|
112
|
+
return `${r.data.processes?.length ?? 0} processes`;
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
await test('dailey_pause/resume (dry — read state)', async () => {
|
|
116
|
+
// Don't actually pause a prod project. Just verify route exists and
|
|
117
|
+
// project is valid by hitting deploy-status (which we already did).
|
|
118
|
+
return `skipped mutation — route /pause,/resume exist per code audit`;
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
await test('dailey_backups (list)', async () => {
|
|
122
|
+
const r = await call('GET', `/projects/${project.id}/backups`);
|
|
123
|
+
if (!r.ok) throw new Error(`HTTP ${r.status}: ${JSON.stringify(r.data)}`);
|
|
124
|
+
return `${r.data.backups?.length ?? 0} backups`;
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
await test('dailey_resource_config (get)', async () => {
|
|
128
|
+
const r = await call('GET', `/projects/${project.id}/resource-config`);
|
|
129
|
+
if (!r.ok) throw new Error(`HTTP ${r.status}: ${JSON.stringify(r.data)}`);
|
|
130
|
+
return `cpu=${r.data.cpu}, mem=${r.data.memory_mb}MB`;
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
await test('dailey_service_links (list)', async () => {
|
|
134
|
+
const r = await call('GET', `/projects/${project.id}/links`);
|
|
135
|
+
if (!r.ok) throw new Error(`HTTP ${r.status}: ${JSON.stringify(r.data)}`);
|
|
136
|
+
return `${r.data.links?.length ?? 0} links`;
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
await test('dailey_domains (list)', async () => {
|
|
140
|
+
const r = await call('GET', `/projects/${project.id}/domains`);
|
|
141
|
+
if (!r.ok) throw new Error(`HTTP ${r.status}: ${JSON.stringify(r.data)}`);
|
|
142
|
+
return `${r.data.domains?.length ?? 0} domains`;
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
// DNS check requires a real domain — try one if any exists
|
|
146
|
+
const domainList = await call('GET', `/projects/${project.id}/domains`);
|
|
147
|
+
// Skip the default *.dailey.cloud domain — dns_check rejects those.
|
|
148
|
+
const customDomain = domainList.ok
|
|
149
|
+
? domainList.data.domains?.find((x) => !x.is_default)
|
|
150
|
+
: null;
|
|
151
|
+
if (customDomain) {
|
|
152
|
+
const d = customDomain.hostname;
|
|
153
|
+
await test(`dailey_domains dns_check (${d})`, async () => {
|
|
154
|
+
const r = await call('GET', `/projects/${project.id}/domains/dns-check?domain=${encodeURIComponent(d)}`);
|
|
155
|
+
if (!r.ok) throw new Error(`HTTP ${r.status}: ${JSON.stringify(r.data)}`);
|
|
156
|
+
return `matched=${r.data.matched}, type=${r.data.match_type}`;
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
await test(`dailey_domains cert_status (${d})`, async () => {
|
|
160
|
+
const r = await call('GET', `/projects/${project.id}/domains/cert-status?domain=${encodeURIComponent(d)}`);
|
|
161
|
+
if (!r.ok) throw new Error(`HTTP ${r.status}: ${JSON.stringify(r.data)}`);
|
|
162
|
+
return `status=${r.data.status}`;
|
|
163
|
+
});
|
|
164
|
+
} else {
|
|
165
|
+
console.log('⊘ dailey_domains dns_check / cert_status — no custom domains on test project (default only)');
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
await test('dailey_analyze_repo (docker image)', async () => {
|
|
169
|
+
const r = await call('POST', '/projects/analyze', { repo_url: 'nginx:alpine' });
|
|
170
|
+
if (!r.ok) throw new Error(`HTTP ${r.status}: ${JSON.stringify(r.data)}`);
|
|
171
|
+
return `_isDockerImage=${r.data._isDockerImage}, issues=${r.data.issues?.length || 0}`;
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
await test('dailey_db_validate (dry)', async () => {
|
|
175
|
+
// Does project have a DB? check db info first.
|
|
176
|
+
const info = await call('GET', `/projects/${project.id}/database`);
|
|
177
|
+
if (!info.ok) return `no DB provisioned — skipped`;
|
|
178
|
+
const r = await call('POST', `/projects/${project.id}/database/validate`, {
|
|
179
|
+
sql: 'CREATE TABLE IF NOT EXISTS _mcp_smoke_test (id INT);',
|
|
180
|
+
});
|
|
181
|
+
if (!r.ok) throw new Error(`HTTP ${r.status}: ${JSON.stringify(r.data)}`);
|
|
182
|
+
return `valid=${r.data.valid}, warnings=${r.data.has_warnings}`;
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
await test('dailey_db_tunnel (list)', async () => {
|
|
186
|
+
const r = await call('GET', `/projects/${project.id}/database/tunnel`);
|
|
187
|
+
if (!r.ok) throw new Error(`HTTP ${r.status}: ${JSON.stringify(r.data)}`);
|
|
188
|
+
return `${r.data.sessions?.length ?? 0} active sessions`;
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
// Summary
|
|
192
|
+
console.log('');
|
|
193
|
+
console.log('─'.repeat(60));
|
|
194
|
+
const passed = results.filter((r) => r.passed).length;
|
|
195
|
+
const failed = results.filter((r) => !r.passed).length;
|
|
196
|
+
console.log(`Passed: ${passed} Failed: ${failed} Total: ${results.length}`);
|
|
197
|
+
if (failed > 0) {
|
|
198
|
+
console.log('');
|
|
199
|
+
console.log('Failures:');
|
|
200
|
+
for (const r of results.filter((x) => !x.passed)) {
|
|
201
|
+
console.log(` ✗ ${r.name}: ${r.detail}`);
|
|
202
|
+
}
|
|
203
|
+
process.exit(1);
|
|
204
|
+
}
|
|
205
|
+
process.exit(0);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
main().catch((err) => {
|
|
209
|
+
console.error('TEST CRASH:', err);
|
|
210
|
+
process.exit(2);
|
|
211
|
+
});
|