@daileyos/mcp-server 1.0.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.
Files changed (68) hide show
  1. package/claude-config.json +13 -0
  2. package/dist/api.d.ts +21 -0
  3. package/dist/api.d.ts.map +1 -0
  4. package/dist/api.js +78 -0
  5. package/dist/api.js.map +1 -0
  6. package/dist/index.d.ts +3 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +34 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/tools/auth.d.ts +3 -0
  11. package/dist/tools/auth.d.ts.map +1 -0
  12. package/dist/tools/auth.js +22 -0
  13. package/dist/tools/auth.js.map +1 -0
  14. package/dist/tools/billing.d.ts +3 -0
  15. package/dist/tools/billing.d.ts.map +1 -0
  16. package/dist/tools/billing.js +20 -0
  17. package/dist/tools/billing.js.map +1 -0
  18. package/dist/tools/db.d.ts +3 -0
  19. package/dist/tools/db.d.ts.map +1 -0
  20. package/dist/tools/db.js +99 -0
  21. package/dist/tools/db.js.map +1 -0
  22. package/dist/tools/deploy.d.ts +3 -0
  23. package/dist/tools/deploy.d.ts.map +1 -0
  24. package/dist/tools/deploy.js +46 -0
  25. package/dist/tools/deploy.js.map +1 -0
  26. package/dist/tools/domains.d.ts +3 -0
  27. package/dist/tools/domains.d.ts.map +1 -0
  28. package/dist/tools/domains.js +47 -0
  29. package/dist/tools/domains.js.map +1 -0
  30. package/dist/tools/env.d.ts +3 -0
  31. package/dist/tools/env.d.ts.map +1 -0
  32. package/dist/tools/env.js +56 -0
  33. package/dist/tools/env.js.map +1 -0
  34. package/dist/tools/platform.d.ts +3 -0
  35. package/dist/tools/platform.d.ts.map +1 -0
  36. package/dist/tools/platform.js +51 -0
  37. package/dist/tools/platform.js.map +1 -0
  38. package/dist/tools/projects.d.ts +3 -0
  39. package/dist/tools/projects.d.ts.map +1 -0
  40. package/dist/tools/projects.js +74 -0
  41. package/dist/tools/projects.js.map +1 -0
  42. package/dist/tools/scale.d.ts +3 -0
  43. package/dist/tools/scale.d.ts.map +1 -0
  44. package/dist/tools/scale.js +14 -0
  45. package/dist/tools/scale.js.map +1 -0
  46. package/dist/tools/storage.d.ts +3 -0
  47. package/dist/tools/storage.d.ts.map +1 -0
  48. package/dist/tools/storage.js +133 -0
  49. package/dist/tools/storage.js.map +1 -0
  50. package/dist/tools/usage.d.ts +3 -0
  51. package/dist/tools/usage.d.ts.map +1 -0
  52. package/dist/tools/usage.js +15 -0
  53. package/dist/tools/usage.js.map +1 -0
  54. package/package.json +25 -0
  55. package/src/api.ts +96 -0
  56. package/src/index.ts +38 -0
  57. package/src/tools/auth.ts +34 -0
  58. package/src/tools/billing.ts +33 -0
  59. package/src/tools/db.ts +169 -0
  60. package/src/tools/deploy.ts +81 -0
  61. package/src/tools/domains.ts +61 -0
  62. package/src/tools/env.ts +69 -0
  63. package/src/tools/platform.ts +86 -0
  64. package/src/tools/projects.ts +116 -0
  65. package/src/tools/scale.ts +19 -0
  66. package/src/tools/storage.ts +216 -0
  67. package/src/tools/usage.ts +20 -0
  68. package/tsconfig.json +19 -0
@@ -0,0 +1,169 @@
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 DatabaseInfo {
6
+ host?: string;
7
+ port?: number;
8
+ database?: string;
9
+ username?: string;
10
+ password?: string;
11
+ status?: string;
12
+ size_mb?: number;
13
+ type?: string;
14
+ }
15
+
16
+ interface DatabaseSchemaResponse {
17
+ database: string;
18
+ tables: Array<{
19
+ name: string;
20
+ rows: number;
21
+ size_kb: number;
22
+ columns: Array<{
23
+ name: string;
24
+ type: string;
25
+ nullable: boolean;
26
+ key: string;
27
+ extra: string;
28
+ }>;
29
+ }>;
30
+ total_rows: number;
31
+ total_size_kb: number;
32
+ }
33
+
34
+ interface DatabaseQueryResponse {
35
+ rows?: Array<Record<string, unknown>>;
36
+ row_count?: number;
37
+ duration_ms?: number;
38
+ read_only?: boolean;
39
+ auto_limited?: boolean;
40
+ error?: string;
41
+ }
42
+
43
+ interface DatabaseMigrationsResponse {
44
+ has_migration_table: boolean;
45
+ total_applied: number;
46
+ applied: Array<{ name: string; applied_at?: string }>;
47
+ }
48
+
49
+ export function registerDbTools(server: McpServer) {
50
+ server.tool(
51
+ 'dailey_db_info',
52
+ 'Get database connection info for a project',
53
+ { project_id: z.string().describe('The project ID') },
54
+ async ({ project_id }) => {
55
+ const res = await apiRequest<DatabaseInfo>('GET', `/projects/${project_id}/database`);
56
+ if (!res.ok) return textResult(formatError(res));
57
+
58
+ const db = res.data;
59
+ const lines = [
60
+ `Database Info`,
61
+ '─────────────────────────────',
62
+ `Type: ${db.type || 'unknown'}`,
63
+ `Status: ${db.status || 'unknown'}`,
64
+ `Host: ${db.host || '-'}`,
65
+ `Port: ${db.port || '-'}`,
66
+ `Database: ${db.database || '-'}`,
67
+ `Username: ${db.username || '-'}`,
68
+ `Password: ${db.password || '-'}`,
69
+ ];
70
+ if (db.size_mb !== undefined) {
71
+ lines.push(`Size: ${db.size_mb} MB`);
72
+ }
73
+ return textResult(lines.join('\n'));
74
+ },
75
+ );
76
+
77
+ server.tool(
78
+ 'dailey_db_schema',
79
+ 'Inspect the schema of a project database',
80
+ { project_id: z.string().describe('The project ID') },
81
+ async ({ project_id }) => {
82
+ const res = await apiRequest<DatabaseSchemaResponse>('GET', `/projects/${project_id}/database/schema`);
83
+ if (!res.ok) return textResult(formatError(res));
84
+
85
+ const schema = res.data;
86
+ const lines = [
87
+ `Schema: ${schema.database}`,
88
+ `Tables: ${schema.tables?.length || 0}`,
89
+ `Rows: ${schema.total_rows || 0}`,
90
+ `Size: ${schema.total_size_kb || 0} KB`,
91
+ '',
92
+ ];
93
+
94
+ for (const table of schema.tables || []) {
95
+ lines.push(`${table.name} (${table.rows} rows, ${table.size_kb} KB)`);
96
+ for (const column of table.columns || []) {
97
+ const flags = [
98
+ column.key ? `key=${column.key}` : null,
99
+ column.nullable ? 'nullable' : 'required',
100
+ column.extra || null,
101
+ ].filter(Boolean);
102
+ lines.push(` - ${column.name}: ${column.type}${flags.length ? ` [${flags.join(', ')}]` : ''}`);
103
+ }
104
+ lines.push('');
105
+ }
106
+
107
+ return textResult(lines.join('\n').trimEnd());
108
+ },
109
+ );
110
+
111
+ server.tool(
112
+ 'dailey_db_recall',
113
+ 'Recall records with a safe read-only SQL query',
114
+ {
115
+ project_id: z.string().describe('The project ID'),
116
+ sql: z.string().describe('A read-only SQL query such as SELECT, SHOW, or DESCRIBE'),
117
+ limit: z.number().int().min(1).max(1000).optional().describe('Auto-limit for SELECT/WITH queries without LIMIT'),
118
+ },
119
+ async ({ project_id, sql, limit }) => {
120
+ const body: Record<string, unknown> = { sql };
121
+ if (limit !== undefined) body.limit = limit;
122
+ const res = await apiRequest<DatabaseQueryResponse>('POST', `/projects/${project_id}/database/recall`, body);
123
+ if (!res.ok) return textResult(formatError(res));
124
+ if (res.data.error) return textResult(`Error: ${res.data.error}`);
125
+
126
+ const rows = res.data.rows || [];
127
+ const lines = [
128
+ `Read-only recall`,
129
+ `Rows: ${res.data.row_count || 0}`,
130
+ `Duration: ${res.data.duration_ms || 0}ms`,
131
+ `Mode: ${res.data.read_only ? 'read-only' : 'unknown'}`,
132
+ `AutoLimit: ${res.data.auto_limited ? 'yes' : 'no'}`,
133
+ '',
134
+ ];
135
+
136
+ if (rows.length === 0) {
137
+ lines.push('No rows returned.');
138
+ } else {
139
+ lines.push(JSON.stringify(rows, null, 2));
140
+ }
141
+
142
+ return textResult(lines.join('\n'));
143
+ },
144
+ );
145
+
146
+ server.tool(
147
+ 'dailey_db_migrations',
148
+ 'Show migration status for a project database',
149
+ { project_id: z.string().describe('The project ID') },
150
+ async ({ project_id }) => {
151
+ const res = await apiRequest<DatabaseMigrationsResponse>('GET', `/projects/${project_id}/database/migrations`);
152
+ if (!res.ok) return textResult(formatError(res));
153
+
154
+ if (!res.data.has_migration_table) {
155
+ return textResult('No _migrations table found for this project.');
156
+ }
157
+
158
+ const lines = [
159
+ `Migrations`,
160
+ `Applied: ${res.data.total_applied}`,
161
+ '',
162
+ ];
163
+ for (const migration of res.data.applied || []) {
164
+ lines.push(`- ${migration.name}${migration.applied_at ? ` (${migration.applied_at})` : ''}`);
165
+ }
166
+ return textResult(lines.join('\n'));
167
+ },
168
+ );
169
+ }
@@ -0,0 +1,81 @@
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 LogsResponse {
6
+ logs: string[];
7
+ }
8
+
9
+ interface Build {
10
+ id: string;
11
+ status?: string;
12
+ commit?: string;
13
+ created_at?: string;
14
+ finished_at?: string;
15
+ }
16
+
17
+ export function registerDeployTools(server: McpServer) {
18
+ server.tool(
19
+ 'dailey_app_logs',
20
+ 'Get application pod logs',
21
+ {
22
+ project_id: z.string().describe('The project ID'),
23
+ tail: z.number().optional().describe('Number of log lines to fetch (default: 100)'),
24
+ },
25
+ async ({ project_id, tail }) => {
26
+ const query = tail ? `?tail=${tail}` : '?tail=100';
27
+ const res = await apiRequest<LogsResponse>('GET', `/projects/${project_id}/logs${query}`);
28
+ if (!res.ok) return textResult(formatError(res));
29
+
30
+ const logs = res.data.logs;
31
+ if (!logs || logs.length === 0) {
32
+ return textResult('No logs available.');
33
+ }
34
+
35
+ return textResult([`Logs (last ${tail || 100} lines):`, '', ...logs].join('\n'));
36
+ },
37
+ );
38
+
39
+ server.tool(
40
+ 'dailey_deploy_history',
41
+ 'List recent deploys/builds for a project',
42
+ { project_id: z.string().describe('The project ID') },
43
+ async ({ project_id }) => {
44
+ const res = await apiRequest<{ builds: Build[] }>('GET', `/projects/${project_id}/deploys`);
45
+ if (!res.ok) return textResult(formatError(res));
46
+
47
+ const builds = res.data.builds;
48
+ if (!builds || builds.length === 0) {
49
+ return textResult('No deploys found.');
50
+ }
51
+
52
+ const lines = [
53
+ `Deploy History`,
54
+ `${'Build ID'.padEnd(38)} ${'Status'.padEnd(12)} ${'Commit'.padEnd(12)} Created`,
55
+ '─'.repeat(90),
56
+ ];
57
+
58
+ for (const b of builds) {
59
+ lines.push(
60
+ `${(b.id || '').padEnd(38)} ${(b.status || 'unknown').padEnd(12)} ${(b.commit || '-').substring(0, 10).padEnd(12)} ${b.created_at || '-'}`,
61
+ );
62
+ }
63
+
64
+ return textResult(lines.join('\n'));
65
+ },
66
+ );
67
+
68
+ server.tool(
69
+ 'dailey_rollback',
70
+ 'Rollback a project to a previous build',
71
+ {
72
+ project_id: z.string().describe('The project ID'),
73
+ build_id: z.string().describe('The build ID to rollback to'),
74
+ },
75
+ async ({ project_id, build_id }) => {
76
+ const res = await apiRequest('POST', `/projects/${project_id}/rollback`, { build_id });
77
+ if (!res.ok) return textResult(formatError(res));
78
+ return textResult(`Rollback initiated for project ${project_id} to build ${build_id}.`);
79
+ },
80
+ );
81
+ }
@@ -0,0 +1,61 @@
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 Domain {
6
+ domain: string;
7
+ status?: string;
8
+ created_at?: string;
9
+ }
10
+
11
+ export function registerDomainTools(server: McpServer) {
12
+ server.tool(
13
+ 'dailey_domains',
14
+ 'List, add, or remove custom domains for a project',
15
+ {
16
+ project_id: z.string().describe('The project ID'),
17
+ action: z.enum(['list', 'add', 'remove']).describe('Action: list, add, or remove'),
18
+ domain: z.string().optional().describe('Domain name (required for add/remove)'),
19
+ },
20
+ async ({ project_id, action, domain }) => {
21
+ if (action === 'list') {
22
+ const res = await apiRequest<{ domains: Domain[] }>('GET', `/projects/${project_id}/domains`);
23
+ if (!res.ok) return textResult(formatError(res));
24
+
25
+ const domains = res.data.domains;
26
+ if (!domains || domains.length === 0) {
27
+ return textResult('No custom domains configured.');
28
+ }
29
+
30
+ const lines = [
31
+ `Custom Domains (${domains.length})`,
32
+ '─'.repeat(50),
33
+ ];
34
+ for (const d of domains) {
35
+ lines.push(`${d.domain}${d.status ? ` (${d.status})` : ''}`);
36
+ }
37
+ return textResult(lines.join('\n'));
38
+ }
39
+
40
+ if (action === 'add') {
41
+ if (!domain) {
42
+ return textResult('Error: domain is required for add action.');
43
+ }
44
+ const res = await apiRequest('POST', `/projects/${project_id}/domains`, { domain });
45
+ if (!res.ok) return textResult(formatError(res));
46
+ return textResult(`Domain ${domain} added to project.`);
47
+ }
48
+
49
+ if (action === 'remove') {
50
+ if (!domain) {
51
+ return textResult('Error: domain is required for remove action.');
52
+ }
53
+ const res = await apiRequest('DELETE', `/projects/${project_id}/domains`, { domain });
54
+ if (!res.ok) return textResult(formatError(res));
55
+ return textResult(`Domain ${domain} removed from project.`);
56
+ }
57
+
58
+ return textResult('Error: Invalid action. Use list, add, or remove.');
59
+ },
60
+ );
61
+ }
@@ -0,0 +1,69 @@
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 EnvVar {
6
+ key: string;
7
+ updated_at?: string;
8
+ }
9
+
10
+ export function registerEnvTools(server: McpServer) {
11
+ server.tool(
12
+ 'dailey_env_vars',
13
+ 'List, set, or delete environment variables for a project',
14
+ {
15
+ project_id: z.string().describe('The project ID'),
16
+ action: z.enum(['list', 'set', 'delete']).describe('Action: list, set, or delete'),
17
+ key: z.string().optional().describe('Environment variable key (required for set/delete)'),
18
+ value: z.string().optional().describe('Environment variable value (required for set)'),
19
+ },
20
+ async ({ project_id, action, key, value }) => {
21
+ if (action === 'list') {
22
+ const res = await apiRequest<{ env_vars: EnvVar[] }>('GET', `/projects/${project_id}/env`);
23
+ if (!res.ok) return textResult(formatError(res));
24
+
25
+ const vars = res.data.env_vars;
26
+ if (!vars || vars.length === 0) {
27
+ return textResult('No environment variables set.');
28
+ }
29
+
30
+ const lines = [
31
+ `Environment Variables (${vars.length})`,
32
+ '─'.repeat(60),
33
+ ];
34
+ for (const v of vars) {
35
+ lines.push(`${v.key}${v.updated_at ? ` updated=${v.updated_at}` : ''}`);
36
+ }
37
+ lines.push('');
38
+ lines.push('Values stay hidden here by design. Use the env set/delete actions to manage them safely.');
39
+ return textResult(lines.join('\n'));
40
+ }
41
+
42
+ if (action === 'set') {
43
+ if (!key || value === undefined) {
44
+ return textResult('Error: key and value are required for set action.');
45
+ }
46
+ // Try PUT first (update), fall back to POST (create)
47
+ const putRes = await apiRequest('PUT', `/projects/${project_id}/env/${encodeURIComponent(key)}`, { value });
48
+ if (putRes.ok) {
49
+ return textResult(`Environment variable ${key} updated.`);
50
+ }
51
+ // If PUT fails (var doesn't exist yet), try POST
52
+ const postRes = await apiRequest('POST', `/projects/${project_id}/env`, { key, value });
53
+ if (!postRes.ok) return textResult(formatError(postRes));
54
+ return textResult(`Environment variable ${key} set.`);
55
+ }
56
+
57
+ if (action === 'delete') {
58
+ if (!key) {
59
+ return textResult('Error: key is required for delete action.');
60
+ }
61
+ const res = await apiRequest('DELETE', `/projects/${project_id}/env/${encodeURIComponent(key)}`);
62
+ if (!res.ok) return textResult(formatError(res));
63
+ return textResult(`Environment variable ${key} deleted.`);
64
+ }
65
+
66
+ return textResult('Error: Invalid action. Use list, set, or delete.');
67
+ },
68
+ );
69
+ }
@@ -0,0 +1,86 @@
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 PlatformCapability {
6
+ id: string;
7
+ label: string;
8
+ status: string;
9
+ summary: string;
10
+ interfaces?: string[];
11
+ details?: Record<string, unknown>;
12
+ }
13
+
14
+ interface PlatformOverview {
15
+ project: {
16
+ id: string;
17
+ name: string;
18
+ slug: string;
19
+ status: string;
20
+ url: string;
21
+ };
22
+ safety: {
23
+ model: string;
24
+ guarantees: string[];
25
+ restrictions: string[];
26
+ };
27
+ capabilities: PlatformCapability[];
28
+ next_step?: string;
29
+ }
30
+
31
+ export function registerPlatformTools(server: McpServer) {
32
+ server.tool(
33
+ 'dailey_platform_info',
34
+ 'Show the safe platform capabilities available to a project',
35
+ { project_id: z.string().describe('The project ID') },
36
+ async ({ project_id }) => {
37
+ const res = await apiRequest<PlatformOverview>('GET', `/projects/${project_id}/platform`);
38
+ if (!res.ok) return textResult(formatError(res));
39
+
40
+ const data = res.data;
41
+ const lines = [
42
+ `Platform: ${data.project.name}`,
43
+ `Slug: ${data.project.slug}`,
44
+ `Status: ${data.project.status}`,
45
+ `URL: ${data.project.url}`,
46
+ '',
47
+ `Safety Model`,
48
+ `Mode: ${data.safety.model}`,
49
+ ];
50
+
51
+ for (const line of data.safety.guarantees || []) {
52
+ lines.push(`- ${line}`);
53
+ }
54
+
55
+ if ((data.safety.restrictions || []).length > 0) {
56
+ lines.push('');
57
+ lines.push('Restrictions');
58
+ for (const line of data.safety.restrictions || []) {
59
+ lines.push(`- ${line}`);
60
+ }
61
+ }
62
+
63
+ lines.push('');
64
+ lines.push('Capabilities');
65
+ for (const capability of data.capabilities || []) {
66
+ lines.push(`- ${capability.label} [${capability.status}]`);
67
+ lines.push(` ${capability.summary}`);
68
+ if (capability.interfaces && capability.interfaces.length > 0) {
69
+ lines.push(` Interfaces: ${capability.interfaces.join(', ')}`);
70
+ }
71
+ for (const [key, value] of Object.entries(capability.details || {})) {
72
+ if (value === null || value === undefined || value === '') continue;
73
+ if (Array.isArray(value) && value.length === 0) continue;
74
+ lines.push(` ${key}: ${Array.isArray(value) ? value.join(', ') : String(value)}`);
75
+ }
76
+ }
77
+
78
+ if (data.next_step) {
79
+ lines.push('');
80
+ lines.push(`Next Step: ${data.next_step}`);
81
+ }
82
+
83
+ return textResult(lines.join('\n'));
84
+ },
85
+ );
86
+ }
@@ -0,0 +1,116 @@
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 Project {
6
+ id: string;
7
+ name: string;
8
+ status?: string;
9
+ repo_url?: string;
10
+ branch?: string;
11
+ replicas?: number;
12
+ created_at?: string;
13
+ url?: string;
14
+ needs_database?: boolean;
15
+ }
16
+
17
+ export function registerProjectTools(server: McpServer) {
18
+ server.tool(
19
+ 'dailey_list_projects',
20
+ 'List all projects with status',
21
+ {},
22
+ async () => {
23
+ const res = await apiRequest<{ projects: Project[] }>('GET', '/projects');
24
+ if (!res.ok) return textResult(formatError(res));
25
+
26
+ const projects = res.data.projects;
27
+ if (!projects || projects.length === 0) {
28
+ return textResult('No projects found.');
29
+ }
30
+
31
+ const lines = [
32
+ `Projects (${projects.length})`,
33
+ `${'ID'.padEnd(38)} ${'Name'.padEnd(24)} ${'Status'.padEnd(12)} Replicas`,
34
+ '─'.repeat(90),
35
+ ];
36
+
37
+ for (const p of projects) {
38
+ lines.push(
39
+ `${(p.id || '').padEnd(38)} ${(p.name || '').padEnd(24)} ${(p.status || 'unknown').padEnd(12)} ${p.replicas ?? '-'}`,
40
+ );
41
+ }
42
+
43
+ return textResult(lines.join('\n'));
44
+ },
45
+ );
46
+
47
+ server.tool(
48
+ 'dailey_project_info',
49
+ 'Get detailed info about a project',
50
+ { project_id: z.string().describe('The project ID') },
51
+ async ({ project_id }) => {
52
+ const res = await apiRequest<Project>('GET', `/projects/${project_id}`);
53
+ if (!res.ok) return textResult(formatError(res));
54
+
55
+ const p = res.data;
56
+ const lines = [
57
+ `Project: ${p.name}`,
58
+ `─────────────────────────────`,
59
+ `ID: ${p.id}`,
60
+ `Status: ${p.status || 'unknown'}`,
61
+ `Repo: ${p.repo_url || 'none'}`,
62
+ `Branch: ${p.branch || 'main'}`,
63
+ `Replicas: ${p.replicas ?? '-'}`,
64
+ `Database: ${p.needs_database ? 'yes' : 'no'}`,
65
+ `URL: ${p.url || 'none'}`,
66
+ `Created: ${p.created_at || 'unknown'}`,
67
+ ];
68
+
69
+ return textResult(lines.join('\n'));
70
+ },
71
+ );
72
+
73
+ server.tool(
74
+ 'dailey_create_project',
75
+ 'Create a new project',
76
+ {
77
+ name: z.string().describe('Project name'),
78
+ repo_url: z.string().describe('Git repository URL'),
79
+ branch: z.string().optional().describe('Branch to deploy (default: main)'),
80
+ needs_database: z.boolean().optional().describe('Whether the project needs a database'),
81
+ },
82
+ async ({ name, repo_url, branch, needs_database }) => {
83
+ const body: Record<string, unknown> = { name, repo_url };
84
+ if (branch) body.branch = branch;
85
+ if (needs_database !== undefined) body.needs_database = needs_database;
86
+
87
+ const res = await apiRequest<Project>('POST', '/projects', body);
88
+ if (!res.ok) return textResult(formatError(res));
89
+
90
+ const p = res.data;
91
+ return textResult(
92
+ [
93
+ `Project created successfully!`,
94
+ ``,
95
+ `ID: ${p.id}`,
96
+ `Name: ${p.name}`,
97
+ `Status: ${p.status || 'pending'}`,
98
+ `Repo: ${p.repo_url}`,
99
+ `Branch: ${p.branch || 'main'}`,
100
+ `Database: ${p.needs_database ? 'yes' : 'no'}`,
101
+ ].join('\n'),
102
+ );
103
+ },
104
+ );
105
+
106
+ server.tool(
107
+ 'dailey_delete_project',
108
+ 'Delete a project (irreversible)',
109
+ { project_id: z.string().describe('The project ID to delete') },
110
+ async ({ project_id }) => {
111
+ const res = await apiRequest('DELETE', `/projects/${project_id}`);
112
+ if (!res.ok) return textResult(formatError(res));
113
+ return textResult(`Project ${project_id} deleted successfully.`);
114
+ },
115
+ );
116
+ }
@@ -0,0 +1,19 @@
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 registerScaleTools(server: McpServer) {
6
+ server.tool(
7
+ 'dailey_scale',
8
+ 'Scale project replicas up or down',
9
+ {
10
+ project_id: z.string().describe('The project ID'),
11
+ replicas: z.number().describe('Number of replicas to scale to'),
12
+ },
13
+ async ({ project_id, replicas }) => {
14
+ const res = await apiRequest('POST', `/projects/${project_id}/scale`, { replicas });
15
+ if (!res.ok) return textResult(formatError(res));
16
+ return textResult(`Project ${project_id} scaled to ${replicas} replica(s).`);
17
+ },
18
+ );
19
+ }