@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,216 @@
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 StorageInfoResponse {
6
+ project: {
7
+ id: string;
8
+ name: string;
9
+ slug: string;
10
+ };
11
+ binding: {
12
+ bucket: string;
13
+ provider: string;
14
+ endpoint: string;
15
+ region: string;
16
+ cdn_base_url: string;
17
+ binding_model: string;
18
+ upload_strategy: string;
19
+ download_strategy: string;
20
+ usage: {
21
+ total_objects: number;
22
+ total_size_mb: number;
23
+ storage_limit_mb: number;
24
+ };
25
+ limits: {
26
+ max_single_upload_mb: number;
27
+ signed_url_ttl_seconds: number;
28
+ };
29
+ };
30
+ next_step?: string;
31
+ }
32
+
33
+ interface StorageListResponse {
34
+ bucket: string;
35
+ prefix: string;
36
+ continuation_token: string | null;
37
+ objects: Array<{
38
+ key: string;
39
+ size_bytes: number;
40
+ size_mb: number;
41
+ last_modified: string | null;
42
+ etag: string | null;
43
+ }>;
44
+ }
45
+
46
+ interface PresignedUploadResponse {
47
+ bucket: string;
48
+ key: string;
49
+ method: string;
50
+ upload_url: string;
51
+ expires_at: string;
52
+ headers: Record<string, string>;
53
+ }
54
+
55
+ interface PresignedDownloadResponse {
56
+ bucket: string;
57
+ key: string;
58
+ download_url: string;
59
+ expires_at: string;
60
+ content_type: string | null;
61
+ size_bytes: number | null;
62
+ }
63
+
64
+ export function registerStorageTools(server: McpServer) {
65
+ server.tool(
66
+ 'dailey_storage_info',
67
+ 'Show the project-scoped storage binding, usage, and presign model',
68
+ { project_id: z.string().describe('The project ID') },
69
+ async ({ project_id }) => {
70
+ const res = await apiRequest<StorageInfoResponse>('GET', `/projects/${project_id}/storage`);
71
+ if (!res.ok) return textResult(formatError(res));
72
+
73
+ const data = res.data;
74
+ const lines = [
75
+ `Storage: ${data.project.name}`,
76
+ `Slug: ${data.project.slug}`,
77
+ `Bucket: ${data.binding.bucket}`,
78
+ `Provider: ${data.binding.provider}`,
79
+ `Endpoint: ${data.binding.endpoint}`,
80
+ `Region: ${data.binding.region}`,
81
+ `CDN Base: ${data.binding.cdn_base_url}`,
82
+ `Mode: ${data.binding.binding_model}`,
83
+ `Upload: ${data.binding.upload_strategy}`,
84
+ `Download: ${data.binding.download_strategy}`,
85
+ `Objects: ${data.binding.usage.total_objects}`,
86
+ `Usage: ${data.binding.usage.total_size_mb} MB / ${data.binding.usage.storage_limit_mb} MB`,
87
+ `Max Upload: ${data.binding.limits.max_single_upload_mb} MB`,
88
+ `URL TTL: ${data.binding.limits.signed_url_ttl_seconds}s`,
89
+ ];
90
+
91
+ if (data.next_step) {
92
+ lines.push('');
93
+ lines.push(`Next Step: ${data.next_step}`);
94
+ }
95
+
96
+ return textResult(lines.join('\n'));
97
+ },
98
+ );
99
+
100
+ server.tool(
101
+ 'dailey_storage_list_objects',
102
+ 'List objects in a project bucket',
103
+ {
104
+ project_id: z.string().describe('The project ID'),
105
+ prefix: z.string().optional().describe('Optional object key prefix'),
106
+ limit: z.number().int().min(1).max(500).optional().describe('Maximum objects to return'),
107
+ continuation_token: z.string().optional().describe('Token for the next page of objects'),
108
+ },
109
+ async ({ project_id, prefix, limit, continuation_token }) => {
110
+ const params = new URLSearchParams();
111
+ if (prefix) params.set('prefix', prefix);
112
+ if (typeof limit === 'number') params.set('limit', String(limit));
113
+ if (continuation_token) params.set('continuation_token', continuation_token);
114
+ const query = params.toString();
115
+
116
+ const res = await apiRequest<StorageListResponse>(
117
+ 'GET',
118
+ `/projects/${project_id}/storage/objects${query ? `?${query}` : ''}`,
119
+ );
120
+ if (!res.ok) return textResult(formatError(res));
121
+
122
+ const data = res.data;
123
+ const lines = [
124
+ `Bucket: ${data.bucket}`,
125
+ `Prefix: ${data.prefix || '(root)'}`,
126
+ '',
127
+ ];
128
+
129
+ if ((data.objects || []).length === 0) {
130
+ lines.push('No objects found.');
131
+ } else {
132
+ for (const object of data.objects) {
133
+ lines.push(`- ${object.key}`);
134
+ lines.push(` size_mb: ${object.size_mb}`);
135
+ lines.push(` size_bytes: ${object.size_bytes}`);
136
+ lines.push(` last_modified: ${object.last_modified || '-'}`);
137
+ }
138
+ }
139
+
140
+ if (data.continuation_token) {
141
+ lines.push('');
142
+ lines.push(`continuation_token: ${data.continuation_token}`);
143
+ }
144
+
145
+ return textResult(lines.join('\n'));
146
+ },
147
+ );
148
+
149
+ server.tool(
150
+ 'dailey_storage_presign_upload',
151
+ 'Create a presigned upload URL for an object in a project bucket',
152
+ {
153
+ project_id: z.string().describe('The project ID'),
154
+ key: z.string().describe('The object key to upload'),
155
+ content_type: z.string().optional().describe('Optional content type to bind into the signed request'),
156
+ content_length_bytes: z.number().int().positive().optional().describe('Optional content length for plan-limit checks'),
157
+ expires_in_seconds: z.number().int().min(60).max(3600).optional().describe('Optional URL TTL'),
158
+ },
159
+ async ({ project_id, key, content_type, content_length_bytes, expires_in_seconds }) => {
160
+ const body: Record<string, unknown> = { key };
161
+ if (content_type) body.content_type = content_type;
162
+ if (typeof content_length_bytes === 'number') body.content_length_bytes = content_length_bytes;
163
+ if (typeof expires_in_seconds === 'number') body.expires_in_seconds = expires_in_seconds;
164
+
165
+ const res = await apiRequest<PresignedUploadResponse>('POST', `/projects/${project_id}/storage/presign-upload`, body);
166
+ if (!res.ok) return textResult(formatError(res));
167
+
168
+ const data = res.data;
169
+ const lines = [
170
+ `Presigned Upload`,
171
+ `Bucket: ${data.bucket}`,
172
+ `Key: ${data.key}`,
173
+ `Method: ${data.method}`,
174
+ `Expires: ${data.expires_at}`,
175
+ ];
176
+ for (const [header, value] of Object.entries(data.headers || {})) {
177
+ lines.push(`${header}: ${value}`);
178
+ }
179
+ lines.push('');
180
+ lines.push(data.upload_url);
181
+ return textResult(lines.join('\n'));
182
+ },
183
+ );
184
+
185
+ server.tool(
186
+ 'dailey_storage_presign_download',
187
+ 'Create a presigned download URL for an object in a project bucket',
188
+ {
189
+ project_id: z.string().describe('The project ID'),
190
+ key: z.string().describe('The object key to download'),
191
+ download_name: z.string().optional().describe('Optional filename suggestion for the download'),
192
+ expires_in_seconds: z.number().int().min(60).max(3600).optional().describe('Optional URL TTL'),
193
+ },
194
+ async ({ project_id, key, download_name, expires_in_seconds }) => {
195
+ const body: Record<string, unknown> = { key };
196
+ if (download_name) body.download_name = download_name;
197
+ if (typeof expires_in_seconds === 'number') body.expires_in_seconds = expires_in_seconds;
198
+
199
+ const res = await apiRequest<PresignedDownloadResponse>('POST', `/projects/${project_id}/storage/presign-download`, body);
200
+ if (!res.ok) return textResult(formatError(res));
201
+
202
+ const data = res.data;
203
+ const lines = [
204
+ `Presigned Download`,
205
+ `Bucket: ${data.bucket}`,
206
+ `Key: ${data.key}`,
207
+ `Expires: ${data.expires_at}`,
208
+ ];
209
+ if (data.content_type) lines.push(`Type: ${data.content_type}`);
210
+ if (data.size_bytes !== null) lines.push(`Size: ${data.size_bytes} bytes`);
211
+ lines.push('');
212
+ lines.push(data.download_url);
213
+ return textResult(lines.join('\n'));
214
+ },
215
+ );
216
+ }
@@ -0,0 +1,20 @@
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 registerUsageTools(server: McpServer) {
6
+ server.tool(
7
+ 'dailey_usage',
8
+ 'Get resource usage stats for a project',
9
+ {
10
+ project_id: z.string().describe('The project ID'),
11
+ period: z.string().optional().describe('Time period (e.g., 7d, 30d). Default: 7d'),
12
+ },
13
+ async ({ project_id, period }) => {
14
+ const query = `?period=${period || '7d'}`;
15
+ const res = await apiRequest<Record<string, unknown>>('GET', `/projects/${project_id}/usage${query}`);
16
+ if (!res.ok) return textResult(formatError(res));
17
+ return jsonResult(res.data);
18
+ },
19
+ );
20
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "outDir": "dist",
7
+ "rootDir": "src",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "skipLibCheck": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "resolveJsonModule": true,
13
+ "declaration": true,
14
+ "declarationMap": true,
15
+ "sourceMap": true
16
+ },
17
+ "include": ["src/**/*"],
18
+ "exclude": ["node_modules", "dist"]
19
+ }