@daileyos/mcp-server 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/tools/images.d.ts +3 -0
- package/dist/tools/images.d.ts.map +1 -0
- package/dist/tools/images.js +137 -0
- package/dist/tools/images.js.map +1 -0
- package/dist/tools/projects.d.ts.map +1 -1
- package/dist/tools/projects.js +70 -1
- package/dist/tools/projects.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/tools/images.ts +186 -0
- package/src/tools/projects.ts +89 -2
package/dist/index.js
CHANGED
|
@@ -12,6 +12,7 @@ import { registerUsageTools } from './tools/usage.js';
|
|
|
12
12
|
import { registerBillingTools } from './tools/billing.js';
|
|
13
13
|
import { registerPlatformTools } from './tools/platform.js';
|
|
14
14
|
import { registerStorageTools } from './tools/storage.js';
|
|
15
|
+
import { registerImageTools } from './tools/images.js';
|
|
15
16
|
const server = new McpServer({
|
|
16
17
|
name: 'dailey-os',
|
|
17
18
|
version: '1.0.0',
|
|
@@ -28,6 +29,7 @@ registerUsageTools(server);
|
|
|
28
29
|
registerBillingTools(server);
|
|
29
30
|
registerPlatformTools(server);
|
|
30
31
|
registerStorageTools(server);
|
|
32
|
+
registerImageTools(server);
|
|
31
33
|
// Start stdio transport
|
|
32
34
|
const transport = new StdioServerTransport();
|
|
33
35
|
await server.connect(transport);
|
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,2CAA2C,CAAC;AAEjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC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AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;IAC3B,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC;AAEH,qBAAqB;AACrB,iBAAiB,CAAC,MAAM,CAAC,CAAC;AAC1B,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAC7B,mBAAmB,CAAC,MAAM,CAAC,CAAC;AAC5B,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAC3B,gBAAgB,CAAC,MAAM,CAAC,CAAC;AACzB,mBAAmB,CAAC,MAAM,CAAC,CAAC;AAC5B,eAAe,CAAC,MAAM,CAAC,CAAC;AACxB,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAC3B,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAC7B,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAC9B,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAC7B,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAE3B,wBAAwB;AACxB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"images.d.ts","sourceRoot":"","sources":["../../src/tools/images.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIpE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,QAqLnD"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { apiRequest, formatError, textResult } from '../api.js';
|
|
3
|
+
export function registerImageTools(server) {
|
|
4
|
+
// Deploy a Docker image
|
|
5
|
+
server.tool('dailey_run_image', 'Deploy a Docker image to Dailey OS. Creates a project and deploys the image in one step. Examples: wordpress:6-apache, ghost:5-alpine, nginx:alpine, grafana/grafana:latest', {
|
|
6
|
+
image: z.string().describe('Docker image to deploy (e.g., wordpress:6-apache, nginx:alpine)'),
|
|
7
|
+
name: z.string().optional().describe('Project name (auto-generated if not provided)'),
|
|
8
|
+
database: z.boolean().optional().describe('Provision a managed MySQL database (default: false)'),
|
|
9
|
+
}, async ({ image, name, database }) => {
|
|
10
|
+
const projectName = name || image.split('/').pop()?.split(':')[0] || 'app';
|
|
11
|
+
// Create project
|
|
12
|
+
const createRes = await apiRequest('POST', '/projects', {
|
|
13
|
+
name: projectName,
|
|
14
|
+
repo_url: image,
|
|
15
|
+
branch: 'main',
|
|
16
|
+
needs_database: database || false,
|
|
17
|
+
});
|
|
18
|
+
if (!createRes.ok)
|
|
19
|
+
return textResult(formatError(createRes));
|
|
20
|
+
const project = createRes.data;
|
|
21
|
+
// Trigger deploy
|
|
22
|
+
const deployRes = await apiRequest('POST', `/projects/${project.id}/deploy`);
|
|
23
|
+
let result = `Deployed ${image} → https://${project.slug}.dailey.cloud\n\n`;
|
|
24
|
+
result += `Project: ${project.name}\n`;
|
|
25
|
+
result += `Slug: ${project.slug}\n`;
|
|
26
|
+
result += `URL: https://${project.slug}.dailey.cloud\n`;
|
|
27
|
+
if (project.slug_auto_generated) {
|
|
28
|
+
result += `Note: ${project.slug_note}\n`;
|
|
29
|
+
}
|
|
30
|
+
if (project.database) {
|
|
31
|
+
result += `Database: ${project.database.database}\n`;
|
|
32
|
+
}
|
|
33
|
+
if (deployRes.ok && deployRes.data?.credentials) {
|
|
34
|
+
result += `\nCredentials:\n`;
|
|
35
|
+
for (const [key, val] of Object.entries(deployRes.data.credentials)) {
|
|
36
|
+
if (key !== 'note' && key !== 'label') {
|
|
37
|
+
result += ` ${key}: ${val}\n`;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
result += `\nBuild ID: ${deployRes.data?.build_id || 'pending'}\n`;
|
|
42
|
+
result += `View logs: dailey logs ${project.slug}`;
|
|
43
|
+
return textResult(result);
|
|
44
|
+
});
|
|
45
|
+
// Analyze a Docker image
|
|
46
|
+
server.tool('dailey_inspect_image', 'Analyze a Docker image before deploying. Shows size, port, database needs, and compatibility.', {
|
|
47
|
+
image: z.string().describe('Docker image to analyze (e.g., wordpress:6-apache)'),
|
|
48
|
+
}, async ({ image }) => {
|
|
49
|
+
const res = await apiRequest('POST', '/deploy/analyze', { repo_url: image });
|
|
50
|
+
if (!res.ok)
|
|
51
|
+
return textResult(formatError(res));
|
|
52
|
+
const data = res.data;
|
|
53
|
+
if (!data._isDockerImage) {
|
|
54
|
+
return textResult(`"${image}" was detected as a Git repository, not a Docker image.`);
|
|
55
|
+
}
|
|
56
|
+
let result = `Image Analysis: ${image}\n\n`;
|
|
57
|
+
result += `Registry: ${data.image?.registry || 'Docker Hub'}\n`;
|
|
58
|
+
result += `Size: ${data.image?.size_mb || '?'} MB\n`;
|
|
59
|
+
result += `Port: ${data.image?.port || 3000}\n`;
|
|
60
|
+
result += `Database needed: ${data.database?.needed ? 'Yes' : 'No'}\n`;
|
|
61
|
+
if (data.image?.catalog_match) {
|
|
62
|
+
result += `Catalog: ✓ ${data.image.catalog_match} (pre-configured)\n`;
|
|
63
|
+
}
|
|
64
|
+
if (data.image?.description) {
|
|
65
|
+
result += `Description: ${data.image.description}\n`;
|
|
66
|
+
}
|
|
67
|
+
if (data.estimates) {
|
|
68
|
+
result += `\nEstimated pull time: ~${data.estimates.pull_time_seconds}s\n`;
|
|
69
|
+
result += `Estimated deploy time: ~${data.estimates.deploy_time_seconds}s\n`;
|
|
70
|
+
}
|
|
71
|
+
if (data.issues?.length) {
|
|
72
|
+
result += `\nBlocking issues:\n`;
|
|
73
|
+
for (const issue of data.issues) {
|
|
74
|
+
result += ` ✗ ${issue}\n`;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
result += `\n✓ Ready to deploy: use dailey_run_image with image="${image}"`;
|
|
79
|
+
}
|
|
80
|
+
return textResult(result);
|
|
81
|
+
});
|
|
82
|
+
// List marketplace catalog
|
|
83
|
+
server.tool('dailey_marketplace_catalog', 'List all available pre-configured marketplace apps that can be deployed with one command.', {}, async () => {
|
|
84
|
+
const res = await apiRequest('GET', '/deploy/catalog');
|
|
85
|
+
if (!res.ok)
|
|
86
|
+
return textResult(formatError(res));
|
|
87
|
+
let result = 'Marketplace Catalog\n\n';
|
|
88
|
+
for (const app of res.data.apps) {
|
|
89
|
+
result += `${app.name} (${app.image})\n`;
|
|
90
|
+
result += ` ${app.description}\n`;
|
|
91
|
+
result += ` Database: ${app.needs_database ? 'Yes' : 'No'} | Memory: ${app.memory_mb}MB\n\n`;
|
|
92
|
+
}
|
|
93
|
+
result += `Deploy any of these with: dailey_run_image image="<image>"`;
|
|
94
|
+
return textResult(result);
|
|
95
|
+
});
|
|
96
|
+
// Get project credentials
|
|
97
|
+
server.tool('dailey_project_credentials', 'Get auto-generated credentials (passwords) for a project. Useful for logging into deployed apps like code-server, Grafana, WordPress.', {
|
|
98
|
+
project_id: z.string().describe('The project ID'),
|
|
99
|
+
}, async ({ project_id }) => {
|
|
100
|
+
const res = await apiRequest('GET', `/projects/${project_id}/credentials`);
|
|
101
|
+
if (!res.ok)
|
|
102
|
+
return textResult(formatError(res));
|
|
103
|
+
if (!res.data.credentials?.length) {
|
|
104
|
+
return textResult('No auto-generated credentials for this project.');
|
|
105
|
+
}
|
|
106
|
+
let result = 'Project Credentials\n\n';
|
|
107
|
+
for (const cred of res.data.credentials) {
|
|
108
|
+
result += `${cred.label}: ${cred.value}\n`;
|
|
109
|
+
}
|
|
110
|
+
return textResult(result);
|
|
111
|
+
});
|
|
112
|
+
// Get project resources
|
|
113
|
+
server.tool('dailey_project_resources', 'Get resource usage for a project — CPU, memory, storage, pod status.', {
|
|
114
|
+
project_id: z.string().describe('The project ID'),
|
|
115
|
+
}, async ({ project_id }) => {
|
|
116
|
+
const res = await apiRequest('GET', `/projects/${project_id}/resources`);
|
|
117
|
+
if (!res.ok)
|
|
118
|
+
return textResult(formatError(res));
|
|
119
|
+
const data = res.data;
|
|
120
|
+
let result = `Resources for ${data.project}\n\n`;
|
|
121
|
+
result += `Replicas: ${data.replicas}\n`;
|
|
122
|
+
result += `CPU limit: ${data.resources?.cpu_limit}\n`;
|
|
123
|
+
result += `Memory limit: ${data.resources?.memory_limit_mb} MB\n`;
|
|
124
|
+
result += `Storage: ${data.resources?.storage?.capacity || 'None (ephemeral)'}\n`;
|
|
125
|
+
if (data.storage_warning) {
|
|
126
|
+
result += `\n⚠ ${data.storage_warning}\n`;
|
|
127
|
+
}
|
|
128
|
+
if (data.pods?.length) {
|
|
129
|
+
result += `\nPods:\n`;
|
|
130
|
+
for (const pod of data.pods) {
|
|
131
|
+
result += ` ${pod.name} — ${pod.status} — ${pod.restarts} restarts — node: ${pod.node}\n`;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return textResult(result);
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=images.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"images.js","sourceRoot":"","sources":["../../src/tools/images.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEhE,MAAM,UAAU,kBAAkB,CAAC,MAAiB;IAClD,wBAAwB;IACxB,MAAM,CAAC,IAAI,CACT,kBAAkB,EAClB,6KAA6K,EAC7K;QACE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iEAAiE,CAAC;QAC7F,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,+CAA+C,CAAC;QACrF,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qDAAqD,CAAC;KACjG,EACD,KAA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AAC,IAAI,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,CAAC,QAAQ,qBAAqB,GAAG,CAAC,IAAI,IAAI,CAAC;YAC7F,CAAC;QACH,CAAC;QAED,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../src/tools/projects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAgBpE,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../src/tools/projects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAgBpE,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,QA0LrD"}
|
package/dist/tools/projects.js
CHANGED
|
@@ -19,7 +19,7 @@ export function registerProjectTools(server) {
|
|
|
19
19
|
}
|
|
20
20
|
return textResult(lines.join('\n'));
|
|
21
21
|
});
|
|
22
|
-
server.tool('dailey_project_info', 'Get detailed info about a project', { project_id: z.string().describe('The project ID') }, async ({ project_id }) => {
|
|
22
|
+
server.tool('dailey_project_info', 'Get detailed info about a project including linked services', { project_id: z.string().describe('The project ID') }, async ({ project_id }) => {
|
|
23
23
|
const res = await apiRequest('GET', `/projects/${project_id}`);
|
|
24
24
|
if (!res.ok)
|
|
25
25
|
return textResult(formatError(res));
|
|
@@ -36,8 +36,77 @@ export function registerProjectTools(server) {
|
|
|
36
36
|
`URL: ${p.url || 'none'}`,
|
|
37
37
|
`Created: ${p.created_at || 'unknown'}`,
|
|
38
38
|
];
|
|
39
|
+
const services = p.services;
|
|
40
|
+
if (services?.length > 0) {
|
|
41
|
+
lines.push('');
|
|
42
|
+
lines.push(`Services (${services.length + 1}):`);
|
|
43
|
+
lines.push(` ● ${p.slug} [primary] ${p.status}`);
|
|
44
|
+
for (const svc of services) {
|
|
45
|
+
lines.push(` ● ${svc.slug || svc.name} [${svc.service_role || 'secondary'}] ${svc.status}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return textResult(lines.join('\n'));
|
|
49
|
+
});
|
|
50
|
+
server.tool('dailey_project_services', 'List all services in a multi-container project', { project_id: z.string().describe('The project ID') }, async ({ project_id }) => {
|
|
51
|
+
const res = await apiRequest('GET', `/projects/${project_id}`);
|
|
52
|
+
if (!res.ok)
|
|
53
|
+
return textResult(formatError(res));
|
|
54
|
+
const p = res.data;
|
|
55
|
+
const services = p.services || [];
|
|
56
|
+
if (services.length === 0) {
|
|
57
|
+
return textResult(`${p.name} is a single-container project with no linked services.`);
|
|
58
|
+
}
|
|
59
|
+
const lines = [
|
|
60
|
+
`Services for ${p.name} (${services.length + 1} total)`,
|
|
61
|
+
'─'.repeat(60),
|
|
62
|
+
`● ${(p.slug || '').padEnd(30)} primary ${p.status}`,
|
|
63
|
+
];
|
|
64
|
+
for (const svc of services) {
|
|
65
|
+
lines.push(`● ${(svc.slug || svc.name || '').padEnd(30)} ${(svc.service_role || 'secondary').padEnd(12)} ${svc.status}`);
|
|
66
|
+
}
|
|
39
67
|
return textResult(lines.join('\n'));
|
|
40
68
|
});
|
|
69
|
+
server.tool('dailey_deploy_multi', 'Trigger a multi-container deploy for a project with multiple services', {
|
|
70
|
+
project_id: z.string().describe('The project ID'),
|
|
71
|
+
selected_services: z.array(z.object({
|
|
72
|
+
name: z.string(),
|
|
73
|
+
type: z.enum(['managed', 'app_service']),
|
|
74
|
+
provider: z.string().optional(),
|
|
75
|
+
dockerfile: z.string().optional(),
|
|
76
|
+
buildContext: z.string().optional(),
|
|
77
|
+
})).optional().describe('Services to deploy (if omitted, deploys all detected services)'),
|
|
78
|
+
}, async ({ project_id, selected_services }) => {
|
|
79
|
+
// If no services provided, analyze first to discover them
|
|
80
|
+
let services = selected_services;
|
|
81
|
+
if (!services) {
|
|
82
|
+
const projRes = await apiRequest('GET', `/projects/${project_id}`);
|
|
83
|
+
if (!projRes.ok)
|
|
84
|
+
return textResult(formatError(projRes));
|
|
85
|
+
const analyzeRes = await apiRequest('POST', '/projects/analyze', {
|
|
86
|
+
repo_url: projRes.data.repo_url,
|
|
87
|
+
branch: projRes.data.branch,
|
|
88
|
+
});
|
|
89
|
+
if (!analyzeRes.ok)
|
|
90
|
+
return textResult(formatError(analyzeRes));
|
|
91
|
+
const manifest = analyzeRes.data.services_manifest;
|
|
92
|
+
if (!manifest?.entries?.length) {
|
|
93
|
+
return textResult('No multi-service manifest found. Use dailey_deploy instead for single-container projects.');
|
|
94
|
+
}
|
|
95
|
+
services = manifest.entries.filter((e) => e.type === 'managed' || e.type === 'app_service');
|
|
96
|
+
}
|
|
97
|
+
const res = await apiRequest('POST', `/projects/${project_id}/deploy-multi`, {
|
|
98
|
+
selected_services: services,
|
|
99
|
+
});
|
|
100
|
+
if (!res.ok)
|
|
101
|
+
return textResult(formatError(res));
|
|
102
|
+
return textResult([
|
|
103
|
+
`Multi-container deploy triggered!`,
|
|
104
|
+
``,
|
|
105
|
+
`Build ID: ${res.data.build_id}`,
|
|
106
|
+
`Deploy Group: ${res.data.deploy_group_id}`,
|
|
107
|
+
`Services: ${services?.length || 0}`,
|
|
108
|
+
].join('\n'));
|
|
109
|
+
});
|
|
41
110
|
server.tool('dailey_create_project', 'Create a new project', {
|
|
42
111
|
name: z.string().describe('Project name'),
|
|
43
112
|
repo_url: z.string().describe('Git repository URL'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projects.js","sourceRoot":"","sources":["../../src/tools/projects.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAchE,MAAM,UAAU,oBAAoB,CAAC,MAAiB;IACpD,MAAM,CAAC,I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,MAAM,IAAI,SAAS,EAAE;YACpC,aAAa,CAAC,CAAC,QAAQ,EAAE;YACzB,aAAa,CAAC,CAAC,MAAM,IAAI,MAAM,EAAE;YACjC,aAAa,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE;SAC/C,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;IACJ,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,uBAAuB,EACvB,iCAAiC,EACjC,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC,EAAE,EAC/D,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;QACvB,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,QAAQ,EAAE,aAAa,UAAU,EAAE,CAAC,CAAC;QAClE,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,OAAO,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;QACjD,OAAO,UAAU,CAAC,WAAW,UAAU,wBAAwB,CAAC,CAAC;IACnE,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { registerUsageTools } from './tools/usage.js';
|
|
|
14
14
|
import { registerBillingTools } from './tools/billing.js';
|
|
15
15
|
import { registerPlatformTools } from './tools/platform.js';
|
|
16
16
|
import { registerStorageTools } from './tools/storage.js';
|
|
17
|
+
import { registerImageTools } from './tools/images.js';
|
|
17
18
|
|
|
18
19
|
const server = new McpServer({
|
|
19
20
|
name: 'dailey-os',
|
|
@@ -32,6 +33,7 @@ registerUsageTools(server);
|
|
|
32
33
|
registerBillingTools(server);
|
|
33
34
|
registerPlatformTools(server);
|
|
34
35
|
registerStorageTools(server);
|
|
36
|
+
registerImageTools(server);
|
|
35
37
|
|
|
36
38
|
// Start stdio transport
|
|
37
39
|
const transport = new StdioServerTransport();
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { apiRequest, formatError, textResult } from '../api.js';
|
|
4
|
+
|
|
5
|
+
export function registerImageTools(server: McpServer) {
|
|
6
|
+
// Deploy a Docker image
|
|
7
|
+
server.tool(
|
|
8
|
+
'dailey_run_image',
|
|
9
|
+
'Deploy a Docker image to Dailey OS. Creates a project and deploys the image in one step. Examples: wordpress:6-apache, ghost:5-alpine, nginx:alpine, grafana/grafana:latest',
|
|
10
|
+
{
|
|
11
|
+
image: z.string().describe('Docker image to deploy (e.g., wordpress:6-apache, nginx:alpine)'),
|
|
12
|
+
name: z.string().optional().describe('Project name (auto-generated if not provided)'),
|
|
13
|
+
database: z.boolean().optional().describe('Provision a managed MySQL database (default: false)'),
|
|
14
|
+
},
|
|
15
|
+
async ({ image, name, database }) => {
|
|
16
|
+
const projectName = name || image.split('/').pop()?.split(':')[0] || 'app';
|
|
17
|
+
|
|
18
|
+
// Create project
|
|
19
|
+
const createRes = await apiRequest<any>('POST', '/projects', {
|
|
20
|
+
name: projectName,
|
|
21
|
+
repo_url: image,
|
|
22
|
+
branch: 'main',
|
|
23
|
+
needs_database: database || false,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
if (!createRes.ok) return textResult(formatError(createRes));
|
|
27
|
+
|
|
28
|
+
const project = createRes.data;
|
|
29
|
+
|
|
30
|
+
// Trigger deploy
|
|
31
|
+
const deployRes = await apiRequest<any>('POST', `/projects/${project.id}/deploy`);
|
|
32
|
+
|
|
33
|
+
let result = `Deployed ${image} → https://${project.slug}.dailey.cloud\n\n`;
|
|
34
|
+
result += `Project: ${project.name}\n`;
|
|
35
|
+
result += `Slug: ${project.slug}\n`;
|
|
36
|
+
result += `URL: https://${project.slug}.dailey.cloud\n`;
|
|
37
|
+
|
|
38
|
+
if (project.slug_auto_generated) {
|
|
39
|
+
result += `Note: ${project.slug_note}\n`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (project.database) {
|
|
43
|
+
result += `Database: ${project.database.database}\n`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (deployRes.ok && deployRes.data?.credentials) {
|
|
47
|
+
result += `\nCredentials:\n`;
|
|
48
|
+
for (const [key, val] of Object.entries(deployRes.data.credentials)) {
|
|
49
|
+
if (key !== 'note' && key !== 'label') {
|
|
50
|
+
result += ` ${key}: ${val}\n`;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
result += `\nBuild ID: ${deployRes.data?.build_id || 'pending'}\n`;
|
|
56
|
+
result += `View logs: dailey logs ${project.slug}`;
|
|
57
|
+
|
|
58
|
+
return textResult(result);
|
|
59
|
+
},
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
// Analyze a Docker image
|
|
63
|
+
server.tool(
|
|
64
|
+
'dailey_inspect_image',
|
|
65
|
+
'Analyze a Docker image before deploying. Shows size, port, database needs, and compatibility.',
|
|
66
|
+
{
|
|
67
|
+
image: z.string().describe('Docker image to analyze (e.g., wordpress:6-apache)'),
|
|
68
|
+
},
|
|
69
|
+
async ({ image }) => {
|
|
70
|
+
const res = await apiRequest<any>('POST', '/deploy/analyze', { repo_url: image });
|
|
71
|
+
if (!res.ok) return textResult(formatError(res));
|
|
72
|
+
|
|
73
|
+
const data = res.data;
|
|
74
|
+
|
|
75
|
+
if (!data._isDockerImage) {
|
|
76
|
+
return textResult(`"${image}" was detected as a Git repository, not a Docker image.`);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let result = `Image Analysis: ${image}\n\n`;
|
|
80
|
+
result += `Registry: ${data.image?.registry || 'Docker Hub'}\n`;
|
|
81
|
+
result += `Size: ${data.image?.size_mb || '?'} MB\n`;
|
|
82
|
+
result += `Port: ${data.image?.port || 3000}\n`;
|
|
83
|
+
result += `Database needed: ${data.database?.needed ? 'Yes' : 'No'}\n`;
|
|
84
|
+
|
|
85
|
+
if (data.image?.catalog_match) {
|
|
86
|
+
result += `Catalog: ✓ ${data.image.catalog_match} (pre-configured)\n`;
|
|
87
|
+
}
|
|
88
|
+
if (data.image?.description) {
|
|
89
|
+
result += `Description: ${data.image.description}\n`;
|
|
90
|
+
}
|
|
91
|
+
if (data.estimates) {
|
|
92
|
+
result += `\nEstimated pull time: ~${data.estimates.pull_time_seconds}s\n`;
|
|
93
|
+
result += `Estimated deploy time: ~${data.estimates.deploy_time_seconds}s\n`;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (data.issues?.length) {
|
|
97
|
+
result += `\nBlocking issues:\n`;
|
|
98
|
+
for (const issue of data.issues) {
|
|
99
|
+
result += ` ✗ ${issue}\n`;
|
|
100
|
+
}
|
|
101
|
+
} else {
|
|
102
|
+
result += `\n✓ Ready to deploy: use dailey_run_image with image="${image}"`;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return textResult(result);
|
|
106
|
+
},
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
// List marketplace catalog
|
|
110
|
+
server.tool(
|
|
111
|
+
'dailey_marketplace_catalog',
|
|
112
|
+
'List all available pre-configured marketplace apps that can be deployed with one command.',
|
|
113
|
+
{},
|
|
114
|
+
async () => {
|
|
115
|
+
const res = await apiRequest<{ apps: any[] }>('GET', '/deploy/catalog');
|
|
116
|
+
if (!res.ok) return textResult(formatError(res));
|
|
117
|
+
|
|
118
|
+
let result = 'Marketplace Catalog\n\n';
|
|
119
|
+
for (const app of res.data.apps) {
|
|
120
|
+
result += `${app.name} (${app.image})\n`;
|
|
121
|
+
result += ` ${app.description}\n`;
|
|
122
|
+
result += ` Database: ${app.needs_database ? 'Yes' : 'No'} | Memory: ${app.memory_mb}MB\n\n`;
|
|
123
|
+
}
|
|
124
|
+
result += `Deploy any of these with: dailey_run_image image="<image>"`;
|
|
125
|
+
|
|
126
|
+
return textResult(result);
|
|
127
|
+
},
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
// Get project credentials
|
|
131
|
+
server.tool(
|
|
132
|
+
'dailey_project_credentials',
|
|
133
|
+
'Get auto-generated credentials (passwords) for a project. Useful for logging into deployed apps like code-server, Grafana, WordPress.',
|
|
134
|
+
{
|
|
135
|
+
project_id: z.string().describe('The project ID'),
|
|
136
|
+
},
|
|
137
|
+
async ({ project_id }) => {
|
|
138
|
+
const res = await apiRequest<{ credentials: any[] }>('GET', `/projects/${project_id}/credentials`);
|
|
139
|
+
if (!res.ok) return textResult(formatError(res));
|
|
140
|
+
|
|
141
|
+
if (!res.data.credentials?.length) {
|
|
142
|
+
return textResult('No auto-generated credentials for this project.');
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
let result = 'Project Credentials\n\n';
|
|
146
|
+
for (const cred of res.data.credentials) {
|
|
147
|
+
result += `${cred.label}: ${cred.value}\n`;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return textResult(result);
|
|
151
|
+
},
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
// Get project resources
|
|
155
|
+
server.tool(
|
|
156
|
+
'dailey_project_resources',
|
|
157
|
+
'Get resource usage for a project — CPU, memory, storage, pod status.',
|
|
158
|
+
{
|
|
159
|
+
project_id: z.string().describe('The project ID'),
|
|
160
|
+
},
|
|
161
|
+
async ({ project_id }) => {
|
|
162
|
+
const res = await apiRequest<any>('GET', `/projects/${project_id}/resources`);
|
|
163
|
+
if (!res.ok) return textResult(formatError(res));
|
|
164
|
+
|
|
165
|
+
const data = res.data;
|
|
166
|
+
let result = `Resources for ${data.project}\n\n`;
|
|
167
|
+
result += `Replicas: ${data.replicas}\n`;
|
|
168
|
+
result += `CPU limit: ${data.resources?.cpu_limit}\n`;
|
|
169
|
+
result += `Memory limit: ${data.resources?.memory_limit_mb} MB\n`;
|
|
170
|
+
result += `Storage: ${data.resources?.storage?.capacity || 'None (ephemeral)'}\n`;
|
|
171
|
+
|
|
172
|
+
if (data.storage_warning) {
|
|
173
|
+
result += `\n⚠ ${data.storage_warning}\n`;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (data.pods?.length) {
|
|
177
|
+
result += `\nPods:\n`;
|
|
178
|
+
for (const pod of data.pods) {
|
|
179
|
+
result += ` ${pod.name} — ${pod.status} — ${pod.restarts} restarts — node: ${pod.node}\n`;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return textResult(result);
|
|
184
|
+
},
|
|
185
|
+
);
|
|
186
|
+
}
|
package/src/tools/projects.ts
CHANGED
|
@@ -46,10 +46,10 @@ export function registerProjectTools(server: McpServer) {
|
|
|
46
46
|
|
|
47
47
|
server.tool(
|
|
48
48
|
'dailey_project_info',
|
|
49
|
-
'Get detailed info about a project',
|
|
49
|
+
'Get detailed info about a project including linked services',
|
|
50
50
|
{ project_id: z.string().describe('The project ID') },
|
|
51
51
|
async ({ project_id }) => {
|
|
52
|
-
const res = await apiRequest<
|
|
52
|
+
const res = await apiRequest<any>('GET', `/projects/${project_id}`);
|
|
53
53
|
if (!res.ok) return textResult(formatError(res));
|
|
54
54
|
|
|
55
55
|
const p = res.data;
|
|
@@ -66,10 +66,97 @@ export function registerProjectTools(server: McpServer) {
|
|
|
66
66
|
`Created: ${p.created_at || 'unknown'}`,
|
|
67
67
|
];
|
|
68
68
|
|
|
69
|
+
const services = p.services;
|
|
70
|
+
if (services?.length > 0) {
|
|
71
|
+
lines.push('');
|
|
72
|
+
lines.push(`Services (${services.length + 1}):`);
|
|
73
|
+
lines.push(` ● ${p.slug} [primary] ${p.status}`);
|
|
74
|
+
for (const svc of services) {
|
|
75
|
+
lines.push(` ● ${svc.slug || svc.name} [${svc.service_role || 'secondary'}] ${svc.status}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return textResult(lines.join('\n'));
|
|
80
|
+
},
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
server.tool(
|
|
84
|
+
'dailey_project_services',
|
|
85
|
+
'List all services in a multi-container project',
|
|
86
|
+
{ project_id: z.string().describe('The project ID') },
|
|
87
|
+
async ({ project_id }) => {
|
|
88
|
+
const res = await apiRequest<any>('GET', `/projects/${project_id}`);
|
|
89
|
+
if (!res.ok) return textResult(formatError(res));
|
|
90
|
+
|
|
91
|
+
const p = res.data;
|
|
92
|
+
const services = p.services || [];
|
|
93
|
+
|
|
94
|
+
if (services.length === 0) {
|
|
95
|
+
return textResult(`${p.name} is a single-container project with no linked services.`);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const lines = [
|
|
99
|
+
`Services for ${p.name} (${services.length + 1} total)`,
|
|
100
|
+
'─'.repeat(60),
|
|
101
|
+
`● ${(p.slug || '').padEnd(30)} primary ${p.status}`,
|
|
102
|
+
];
|
|
103
|
+
|
|
104
|
+
for (const svc of services) {
|
|
105
|
+
lines.push(`● ${(svc.slug || svc.name || '').padEnd(30)} ${(svc.service_role || 'secondary').padEnd(12)} ${svc.status}`);
|
|
106
|
+
}
|
|
107
|
+
|
|
69
108
|
return textResult(lines.join('\n'));
|
|
70
109
|
},
|
|
71
110
|
);
|
|
72
111
|
|
|
112
|
+
server.tool(
|
|
113
|
+
'dailey_deploy_multi',
|
|
114
|
+
'Trigger a multi-container deploy for a project with multiple services',
|
|
115
|
+
{
|
|
116
|
+
project_id: z.string().describe('The project ID'),
|
|
117
|
+
selected_services: z.array(z.object({
|
|
118
|
+
name: z.string(),
|
|
119
|
+
type: z.enum(['managed', 'app_service']),
|
|
120
|
+
provider: z.string().optional(),
|
|
121
|
+
dockerfile: z.string().optional(),
|
|
122
|
+
buildContext: z.string().optional(),
|
|
123
|
+
})).optional().describe('Services to deploy (if omitted, deploys all detected services)'),
|
|
124
|
+
},
|
|
125
|
+
async ({ project_id, selected_services }) => {
|
|
126
|
+
// If no services provided, analyze first to discover them
|
|
127
|
+
let services = selected_services;
|
|
128
|
+
if (!services) {
|
|
129
|
+
const projRes = await apiRequest<any>('GET', `/projects/${project_id}`);
|
|
130
|
+
if (!projRes.ok) return textResult(formatError(projRes));
|
|
131
|
+
|
|
132
|
+
const analyzeRes = await apiRequest<any>('POST', '/projects/analyze', {
|
|
133
|
+
repo_url: projRes.data.repo_url,
|
|
134
|
+
branch: projRes.data.branch,
|
|
135
|
+
});
|
|
136
|
+
if (!analyzeRes.ok) return textResult(formatError(analyzeRes));
|
|
137
|
+
|
|
138
|
+
const manifest = analyzeRes.data.services_manifest;
|
|
139
|
+
if (!manifest?.entries?.length) {
|
|
140
|
+
return textResult('No multi-service manifest found. Use dailey_deploy instead for single-container projects.');
|
|
141
|
+
}
|
|
142
|
+
services = manifest.entries.filter((e: any) => e.type === 'managed' || e.type === 'app_service');
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const res = await apiRequest<any>('POST', `/projects/${project_id}/deploy-multi`, {
|
|
146
|
+
selected_services: services,
|
|
147
|
+
});
|
|
148
|
+
if (!res.ok) return textResult(formatError(res));
|
|
149
|
+
|
|
150
|
+
return textResult([
|
|
151
|
+
`Multi-container deploy triggered!`,
|
|
152
|
+
``,
|
|
153
|
+
`Build ID: ${res.data.build_id}`,
|
|
154
|
+
`Deploy Group: ${res.data.deploy_group_id}`,
|
|
155
|
+
`Services: ${services?.length || 0}`,
|
|
156
|
+
].join('\n'));
|
|
157
|
+
},
|
|
158
|
+
);
|
|
159
|
+
|
|
73
160
|
server.tool(
|
|
74
161
|
'dailey_create_project',
|
|
75
162
|
'Create a new project',
|