@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.
- package/claude-config.json +13 -0
- package/dist/api.d.ts +21 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +78 -0
- package/dist/api.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/auth.d.ts +3 -0
- package/dist/tools/auth.d.ts.map +1 -0
- package/dist/tools/auth.js +22 -0
- package/dist/tools/auth.js.map +1 -0
- package/dist/tools/billing.d.ts +3 -0
- package/dist/tools/billing.d.ts.map +1 -0
- package/dist/tools/billing.js +20 -0
- package/dist/tools/billing.js.map +1 -0
- package/dist/tools/db.d.ts +3 -0
- package/dist/tools/db.d.ts.map +1 -0
- package/dist/tools/db.js +99 -0
- package/dist/tools/db.js.map +1 -0
- package/dist/tools/deploy.d.ts +3 -0
- package/dist/tools/deploy.d.ts.map +1 -0
- package/dist/tools/deploy.js +46 -0
- package/dist/tools/deploy.js.map +1 -0
- package/dist/tools/domains.d.ts +3 -0
- package/dist/tools/domains.d.ts.map +1 -0
- package/dist/tools/domains.js +47 -0
- package/dist/tools/domains.js.map +1 -0
- package/dist/tools/env.d.ts +3 -0
- package/dist/tools/env.d.ts.map +1 -0
- package/dist/tools/env.js +56 -0
- package/dist/tools/env.js.map +1 -0
- package/dist/tools/platform.d.ts +3 -0
- package/dist/tools/platform.d.ts.map +1 -0
- package/dist/tools/platform.js +51 -0
- package/dist/tools/platform.js.map +1 -0
- package/dist/tools/projects.d.ts +3 -0
- package/dist/tools/projects.d.ts.map +1 -0
- package/dist/tools/projects.js +74 -0
- package/dist/tools/projects.js.map +1 -0
- package/dist/tools/scale.d.ts +3 -0
- package/dist/tools/scale.d.ts.map +1 -0
- package/dist/tools/scale.js +14 -0
- package/dist/tools/scale.js.map +1 -0
- package/dist/tools/storage.d.ts +3 -0
- package/dist/tools/storage.d.ts.map +1 -0
- package/dist/tools/storage.js +133 -0
- package/dist/tools/storage.js.map +1 -0
- package/dist/tools/usage.d.ts +3 -0
- package/dist/tools/usage.d.ts.map +1 -0
- package/dist/tools/usage.js +15 -0
- package/dist/tools/usage.js.map +1 -0
- package/package.json +25 -0
- package/src/api.ts +96 -0
- package/src/index.ts +38 -0
- package/src/tools/auth.ts +34 -0
- package/src/tools/billing.ts +33 -0
- package/src/tools/db.ts +169 -0
- package/src/tools/deploy.ts +81 -0
- package/src/tools/domains.ts +61 -0
- package/src/tools/env.ts +69 -0
- package/src/tools/platform.ts +86 -0
- package/src/tools/projects.ts +116 -0
- package/src/tools/scale.ts +19 -0
- package/src/tools/storage.ts +216 -0
- package/src/tools/usage.ts +20 -0
- package/tsconfig.json +19 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mcpServers": {
|
|
3
|
+
"dailey-os": {
|
|
4
|
+
"command": "node",
|
|
5
|
+
"args": ["/home/jonny/apps/dailey-mcp/dist/index.js"],
|
|
6
|
+
"env": {
|
|
7
|
+
"DAILEY_EMAIL": "<your-email>",
|
|
8
|
+
"DAILEY_PASSWORD": "<your-password>",
|
|
9
|
+
"DAILEY_API_URL": "https://os.dailey.cloud/api"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
interface ApiResponse<T = unknown> {
|
|
2
|
+
ok: boolean;
|
|
3
|
+
status: number;
|
|
4
|
+
data: T;
|
|
5
|
+
}
|
|
6
|
+
export declare function apiRequest<T = unknown>(method: string, path: string, body?: Record<string, unknown>): Promise<ApiResponse<T>>;
|
|
7
|
+
export declare function formatError(res: ApiResponse): string;
|
|
8
|
+
export declare function textResult(text: string): {
|
|
9
|
+
content: {
|
|
10
|
+
type: "text";
|
|
11
|
+
text: string;
|
|
12
|
+
}[];
|
|
13
|
+
};
|
|
14
|
+
export declare function jsonResult(data: unknown): {
|
|
15
|
+
content: {
|
|
16
|
+
type: "text";
|
|
17
|
+
text: string;
|
|
18
|
+
}[];
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AA+BA,UAAU,WAAW,CAAC,CAAC,GAAG,OAAO;IAC/B,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,CAAC,CAAC;CACT;AAED,wBAAsB,UAAU,CAAC,CAAC,GAAG,OAAO,EAC1C,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAmCzB;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,WAAW,GAAG,MAAM,CASpD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM;;;;;EAEtC;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO;;;;;EAEvC"}
|
package/dist/api.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
const API_URL = process.env.DAILEY_API_URL || 'https://os.dailey.cloud/api';
|
|
2
|
+
const DAILEY_EMAIL = process.env.DAILEY_EMAIL;
|
|
3
|
+
const DAILEY_PASSWORD = process.env.DAILEY_PASSWORD;
|
|
4
|
+
let currentToken = process.env.DAILEY_API_TOKEN || '';
|
|
5
|
+
if (!currentToken && !DAILEY_EMAIL) {
|
|
6
|
+
console.error('Either DAILEY_API_TOKEN or DAILEY_EMAIL + DAILEY_PASSWORD are required');
|
|
7
|
+
process.exit(1);
|
|
8
|
+
}
|
|
9
|
+
async function refreshToken() {
|
|
10
|
+
if (!DAILEY_EMAIL || !DAILEY_PASSWORD) {
|
|
11
|
+
throw new Error('Cannot refresh token: DAILEY_EMAIL and DAILEY_PASSWORD not set');
|
|
12
|
+
}
|
|
13
|
+
const res = await fetch(`${API_URL}/customers/login`, {
|
|
14
|
+
method: 'POST',
|
|
15
|
+
headers: { 'Content-Type': 'application/json' },
|
|
16
|
+
body: JSON.stringify({ email: DAILEY_EMAIL, password: DAILEY_PASSWORD }),
|
|
17
|
+
});
|
|
18
|
+
if (!res.ok) {
|
|
19
|
+
throw new Error(`Token refresh failed (${res.status}): ${await res.text()}`);
|
|
20
|
+
}
|
|
21
|
+
const data = await res.json();
|
|
22
|
+
if (!data.access_token) {
|
|
23
|
+
throw new Error('Token refresh: no access_token in response');
|
|
24
|
+
}
|
|
25
|
+
currentToken = data.access_token;
|
|
26
|
+
return currentToken;
|
|
27
|
+
}
|
|
28
|
+
export async function apiRequest(method, path, body) {
|
|
29
|
+
const makeRequest = async (token) => {
|
|
30
|
+
const url = `${API_URL}${path}`;
|
|
31
|
+
const headers = {
|
|
32
|
+
'Authorization': `Bearer ${token}`,
|
|
33
|
+
'Content-Type': 'application/json',
|
|
34
|
+
};
|
|
35
|
+
const options = { method, headers };
|
|
36
|
+
if (body && (method === 'POST' || method === 'PUT' || method === 'PATCH')) {
|
|
37
|
+
options.body = JSON.stringify(body);
|
|
38
|
+
}
|
|
39
|
+
return fetch(url, options);
|
|
40
|
+
};
|
|
41
|
+
let res = await makeRequest(currentToken);
|
|
42
|
+
// Auto-refresh on 401 if credentials are configured
|
|
43
|
+
if (res.status === 401 && DAILEY_EMAIL) {
|
|
44
|
+
try {
|
|
45
|
+
await refreshToken();
|
|
46
|
+
res = await makeRequest(currentToken);
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
// refresh failed, return the original 401
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const text = await res.text();
|
|
53
|
+
let data;
|
|
54
|
+
try {
|
|
55
|
+
data = JSON.parse(text);
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
data = text;
|
|
59
|
+
}
|
|
60
|
+
return { ok: res.ok, status: res.status, data };
|
|
61
|
+
}
|
|
62
|
+
export function formatError(res) {
|
|
63
|
+
const data = res.data;
|
|
64
|
+
if (typeof data === 'object' && data !== null && 'error' in data) {
|
|
65
|
+
return `Error (${res.status}): ${data.error}`;
|
|
66
|
+
}
|
|
67
|
+
if (typeof data === 'object' && data !== null && 'message' in data) {
|
|
68
|
+
return `Error (${res.status}): ${data.message}`;
|
|
69
|
+
}
|
|
70
|
+
return `Error (${res.status}): ${JSON.stringify(data)}`;
|
|
71
|
+
}
|
|
72
|
+
export function textResult(text) {
|
|
73
|
+
return { content: [{ type: 'text', text }] };
|
|
74
|
+
}
|
|
75
|
+
export function jsonResult(data) {
|
|
76
|
+
return textResult(JSON.stringify(data, null, 2));
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=api.js.map
|
package/dist/api.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,6BAA6B,CAAC;AAC5E,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;AAC9C,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;AAEpD,IAAI,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,EAAE,CAAC;AAEtD,IAAI,CAAC,YAAY,IAAI,CAAC,YAAY,EAAE,CAAC;IACnC,OAAO,CAAC,KAAK,CAAC,wEAAwE,CAAC,CAAC;IACxF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,KAAK,UAAU,YAAY;IACzB,IAAI,CAAC,YAAY,IAAI,CAAC,eAAe,EAAE,CAAC;QACtC,MAAM,IAAI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AAC;IACD,OAAO,UAAU,GAAG,CAAC,MAAM,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAa;IACtC,OAAO,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AACnD,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
+
import { registerAuthTools } from './tools/auth.js';
|
|
5
|
+
import { registerProjectTools } from './tools/projects.js';
|
|
6
|
+
import { registerDeployTools } from './tools/deploy.js';
|
|
7
|
+
import { registerScaleTools } from './tools/scale.js';
|
|
8
|
+
import { registerEnvTools } from './tools/env.js';
|
|
9
|
+
import { registerDomainTools } from './tools/domains.js';
|
|
10
|
+
import { registerDbTools } from './tools/db.js';
|
|
11
|
+
import { registerUsageTools } from './tools/usage.js';
|
|
12
|
+
import { registerBillingTools } from './tools/billing.js';
|
|
13
|
+
import { registerPlatformTools } from './tools/platform.js';
|
|
14
|
+
import { registerStorageTools } from './tools/storage.js';
|
|
15
|
+
const server = new McpServer({
|
|
16
|
+
name: 'dailey-os',
|
|
17
|
+
version: '1.0.0',
|
|
18
|
+
});
|
|
19
|
+
// Register all tools
|
|
20
|
+
registerAuthTools(server);
|
|
21
|
+
registerProjectTools(server);
|
|
22
|
+
registerDeployTools(server);
|
|
23
|
+
registerScaleTools(server);
|
|
24
|
+
registerEnvTools(server);
|
|
25
|
+
registerDomainTools(server);
|
|
26
|
+
registerDbTools(server);
|
|
27
|
+
registerUsageTools(server);
|
|
28
|
+
registerBillingTools(server);
|
|
29
|
+
registerPlatformTools(server);
|
|
30
|
+
registerStorageTools(server);
|
|
31
|
+
// Start stdio transport
|
|
32
|
+
const transport = new StdioServerTransport();
|
|
33
|
+
await server.connect(transport);
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1D,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;AAE7B,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":"auth.d.ts","sourceRoot":"","sources":["../../src/tools/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAWpE,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,QAsBlD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { apiRequest, formatError, textResult } from '../api.js';
|
|
2
|
+
export function registerAuthTools(server) {
|
|
3
|
+
server.tool('dailey_whoami', 'Show current user info (name, email, plan)', {}, async () => {
|
|
4
|
+
const res = await apiRequest('GET', '/customers/me');
|
|
5
|
+
if (!res.ok)
|
|
6
|
+
return textResult(formatError(res));
|
|
7
|
+
const u = res.data;
|
|
8
|
+
const lines = [
|
|
9
|
+
`User Info`,
|
|
10
|
+
`─────────────────────`,
|
|
11
|
+
`ID: ${u.id}`,
|
|
12
|
+
`Name: ${u.name}`,
|
|
13
|
+
`Email: ${u.email}`,
|
|
14
|
+
];
|
|
15
|
+
if (u.plan)
|
|
16
|
+
lines.push(`Plan: ${u.plan}`);
|
|
17
|
+
if (u.created_at)
|
|
18
|
+
lines.push(`Created: ${u.created_at}`);
|
|
19
|
+
return textResult(lines.join('\n'));
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/tools/auth.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAUhE,MAAM,UAAU,iBAAiB,CAAC,MAAiB;IACjD,MAAM,CAAC,IAAI,CACT,eAAe,EACf,4CAA4C,EAC5C,EAAE,EACF,KAAK,IAAI,EAAE;QACT,MAAM,GAAG,GAAG,MAAM,UAAU,CAAW,KAAK,EAAE,eAAe,CAAC,CAAC;QAC/D,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,OAAO,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;QAEjD,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC;QACnB,MAAM,KAAK,GAAG;YACZ,WAAW;YACX,uBAAuB;YACvB,YAAY,CAAC,CAAC,EAAE,EAAE;YAClB,YAAY,CAAC,CAAC,IAAI,EAAE;YACpB,YAAY,CAAC,CAAC,KAAK,EAAE;SACtB,CAAC;QACF,IAAI,CAAC,CAAC,IAAI;YAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAC7C,IAAI,CAAC,CAAC,UAAU;YAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC;QACzD,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACtC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../src/tools/billing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIpE,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,QA4BrD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { apiRequest, formatError, textResult, jsonResult } from '../api.js';
|
|
3
|
+
export function registerBillingTools(server) {
|
|
4
|
+
server.tool('dailey_billing', 'Get current billing info and resource usage', {}, async () => {
|
|
5
|
+
const res = await apiRequest('GET', '/billing');
|
|
6
|
+
if (!res.ok)
|
|
7
|
+
return textResult(formatError(res));
|
|
8
|
+
return jsonResult(res.data);
|
|
9
|
+
});
|
|
10
|
+
server.tool('dailey_billing_estimate', 'Estimate cost for scaling actions', {
|
|
11
|
+
action: z.string().describe('Action to estimate (e.g., "scale")'),
|
|
12
|
+
replicas: z.number().describe('Number of replicas'),
|
|
13
|
+
}, async ({ action, replicas }) => {
|
|
14
|
+
const res = await apiRequest('GET', `/billing/estimate?action=${encodeURIComponent(action)}&replicas=${replicas}`);
|
|
15
|
+
if (!res.ok)
|
|
16
|
+
return textResult(formatError(res));
|
|
17
|
+
return jsonResult(res.data);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=billing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.js","sourceRoot":"","sources":["../../src/tools/billing.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5E,MAAM,UAAU,oBAAoB,CAAC,MAAiB;IACpD,MAAM,CAAC,IAAI,CACT,gBAAgB,EAChB,6CAA6C,EAC7C,EAAE,EACF,KAAK,IAAI,EAAE;QACT,MAAM,GAAG,GAAG,MAAM,UAAU,CAA0B,KAAK,EAAE,UAAU,CAAC,CAAC;QACzE,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,OAAO,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;QACjD,OAAO,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,yBAAyB,EACzB,mCAAmC,EACnC;QACE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;QACjE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;KACpD,EACD,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC7B,MAAM,GAAG,GAAG,MAAM,UAAU,CAC1B,KAAK,EACL,4BAA4B,kBAAkB,CAAC,MAAM,CAAC,aAAa,QAAQ,EAAE,CAC9E,CAAC;QACF,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,OAAO,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;QACjD,OAAO,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../src/tools/db.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAgDpE,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,QAwHhD"}
|
package/dist/tools/db.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { apiRequest, formatError, textResult } from '../api.js';
|
|
3
|
+
export function registerDbTools(server) {
|
|
4
|
+
server.tool('dailey_db_info', 'Get database connection info for a project', { project_id: z.string().describe('The project ID') }, async ({ project_id }) => {
|
|
5
|
+
const res = await apiRequest('GET', `/projects/${project_id}/database`);
|
|
6
|
+
if (!res.ok)
|
|
7
|
+
return textResult(formatError(res));
|
|
8
|
+
const db = res.data;
|
|
9
|
+
const lines = [
|
|
10
|
+
`Database Info`,
|
|
11
|
+
'─────────────────────────────',
|
|
12
|
+
`Type: ${db.type || 'unknown'}`,
|
|
13
|
+
`Status: ${db.status || 'unknown'}`,
|
|
14
|
+
`Host: ${db.host || '-'}`,
|
|
15
|
+
`Port: ${db.port || '-'}`,
|
|
16
|
+
`Database: ${db.database || '-'}`,
|
|
17
|
+
`Username: ${db.username || '-'}`,
|
|
18
|
+
`Password: ${db.password || '-'}`,
|
|
19
|
+
];
|
|
20
|
+
if (db.size_mb !== undefined) {
|
|
21
|
+
lines.push(`Size: ${db.size_mb} MB`);
|
|
22
|
+
}
|
|
23
|
+
return textResult(lines.join('\n'));
|
|
24
|
+
});
|
|
25
|
+
server.tool('dailey_db_schema', 'Inspect the schema of a project database', { project_id: z.string().describe('The project ID') }, async ({ project_id }) => {
|
|
26
|
+
const res = await apiRequest('GET', `/projects/${project_id}/database/schema`);
|
|
27
|
+
if (!res.ok)
|
|
28
|
+
return textResult(formatError(res));
|
|
29
|
+
const schema = res.data;
|
|
30
|
+
const lines = [
|
|
31
|
+
`Schema: ${schema.database}`,
|
|
32
|
+
`Tables: ${schema.tables?.length || 0}`,
|
|
33
|
+
`Rows: ${schema.total_rows || 0}`,
|
|
34
|
+
`Size: ${schema.total_size_kb || 0} KB`,
|
|
35
|
+
'',
|
|
36
|
+
];
|
|
37
|
+
for (const table of schema.tables || []) {
|
|
38
|
+
lines.push(`${table.name} (${table.rows} rows, ${table.size_kb} KB)`);
|
|
39
|
+
for (const column of table.columns || []) {
|
|
40
|
+
const flags = [
|
|
41
|
+
column.key ? `key=${column.key}` : null,
|
|
42
|
+
column.nullable ? 'nullable' : 'required',
|
|
43
|
+
column.extra || null,
|
|
44
|
+
].filter(Boolean);
|
|
45
|
+
lines.push(` - ${column.name}: ${column.type}${flags.length ? ` [${flags.join(', ')}]` : ''}`);
|
|
46
|
+
}
|
|
47
|
+
lines.push('');
|
|
48
|
+
}
|
|
49
|
+
return textResult(lines.join('\n').trimEnd());
|
|
50
|
+
});
|
|
51
|
+
server.tool('dailey_db_recall', 'Recall records with a safe read-only SQL query', {
|
|
52
|
+
project_id: z.string().describe('The project ID'),
|
|
53
|
+
sql: z.string().describe('A read-only SQL query such as SELECT, SHOW, or DESCRIBE'),
|
|
54
|
+
limit: z.number().int().min(1).max(1000).optional().describe('Auto-limit for SELECT/WITH queries without LIMIT'),
|
|
55
|
+
}, async ({ project_id, sql, limit }) => {
|
|
56
|
+
const body = { sql };
|
|
57
|
+
if (limit !== undefined)
|
|
58
|
+
body.limit = limit;
|
|
59
|
+
const res = await apiRequest('POST', `/projects/${project_id}/database/recall`, body);
|
|
60
|
+
if (!res.ok)
|
|
61
|
+
return textResult(formatError(res));
|
|
62
|
+
if (res.data.error)
|
|
63
|
+
return textResult(`Error: ${res.data.error}`);
|
|
64
|
+
const rows = res.data.rows || [];
|
|
65
|
+
const lines = [
|
|
66
|
+
`Read-only recall`,
|
|
67
|
+
`Rows: ${res.data.row_count || 0}`,
|
|
68
|
+
`Duration: ${res.data.duration_ms || 0}ms`,
|
|
69
|
+
`Mode: ${res.data.read_only ? 'read-only' : 'unknown'}`,
|
|
70
|
+
`AutoLimit: ${res.data.auto_limited ? 'yes' : 'no'}`,
|
|
71
|
+
'',
|
|
72
|
+
];
|
|
73
|
+
if (rows.length === 0) {
|
|
74
|
+
lines.push('No rows returned.');
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
lines.push(JSON.stringify(rows, null, 2));
|
|
78
|
+
}
|
|
79
|
+
return textResult(lines.join('\n'));
|
|
80
|
+
});
|
|
81
|
+
server.tool('dailey_db_migrations', 'Show migration status for a project database', { project_id: z.string().describe('The project ID') }, async ({ project_id }) => {
|
|
82
|
+
const res = await apiRequest('GET', `/projects/${project_id}/database/migrations`);
|
|
83
|
+
if (!res.ok)
|
|
84
|
+
return textResult(formatError(res));
|
|
85
|
+
if (!res.data.has_migration_table) {
|
|
86
|
+
return textResult('No _migrations table found for this project.');
|
|
87
|
+
}
|
|
88
|
+
const lines = [
|
|
89
|
+
`Migrations`,
|
|
90
|
+
`Applied: ${res.data.total_applied}`,
|
|
91
|
+
'',
|
|
92
|
+
];
|
|
93
|
+
for (const migration of res.data.applied || []) {
|
|
94
|
+
lines.push(`- ${migration.name}${migration.applied_at ? ` (${migration.applied_at})` : ''}`);
|
|
95
|
+
}
|
|
96
|
+
return textResult(lines.join('\n'));
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=db.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db.js","sourceRoot":"","sources":["../../src/tools/db.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AA8ChE,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC/C,MAAM,CAAC,IAAI,CACT,gBAAgB,EAChB,4CAA4C,EAC5C,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,EACrD,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE;QACvB,MAAM,GAAG,GAAG,MAAM,UAAU,CAAe,KAAK,EAAE,aAAa,UAAU,WAAW,CAAC,CAAC;QACtF,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,OAAO,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;QAEjD,MAAM,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC;QACpB,MAAM,KAAK,GAAG;YACZ,eAAe;YACf,+BAA+B;YAC/B,aAAa,EAAE,CAAC,IAAI,IAAI,SAAS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AAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAgBpE,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,QAgEpD"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { apiRequest, formatError, textResult } from '../api.js';
|
|
3
|
+
export function registerDeployTools(server) {
|
|
4
|
+
server.tool('dailey_app_logs', 'Get application pod logs', {
|
|
5
|
+
project_id: z.string().describe('The project ID'),
|
|
6
|
+
tail: z.number().optional().describe('Number of log lines to fetch (default: 100)'),
|
|
7
|
+
}, async ({ project_id, tail }) => {
|
|
8
|
+
const query = tail ? `?tail=${tail}` : '?tail=100';
|
|
9
|
+
const res = await apiRequest('GET', `/projects/${project_id}/logs${query}`);
|
|
10
|
+
if (!res.ok)
|
|
11
|
+
return textResult(formatError(res));
|
|
12
|
+
const logs = res.data.logs;
|
|
13
|
+
if (!logs || logs.length === 0) {
|
|
14
|
+
return textResult('No logs available.');
|
|
15
|
+
}
|
|
16
|
+
return textResult([`Logs (last ${tail || 100} lines):`, '', ...logs].join('\n'));
|
|
17
|
+
});
|
|
18
|
+
server.tool('dailey_deploy_history', 'List recent deploys/builds for a project', { project_id: z.string().describe('The project ID') }, async ({ project_id }) => {
|
|
19
|
+
const res = await apiRequest('GET', `/projects/${project_id}/deploys`);
|
|
20
|
+
if (!res.ok)
|
|
21
|
+
return textResult(formatError(res));
|
|
22
|
+
const builds = res.data.builds;
|
|
23
|
+
if (!builds || builds.length === 0) {
|
|
24
|
+
return textResult('No deploys found.');
|
|
25
|
+
}
|
|
26
|
+
const lines = [
|
|
27
|
+
`Deploy History`,
|
|
28
|
+
`${'Build ID'.padEnd(38)} ${'Status'.padEnd(12)} ${'Commit'.padEnd(12)} Created`,
|
|
29
|
+
'─'.repeat(90),
|
|
30
|
+
];
|
|
31
|
+
for (const b of builds) {
|
|
32
|
+
lines.push(`${(b.id || '').padEnd(38)} ${(b.status || 'unknown').padEnd(12)} ${(b.commit || '-').substring(0, 10).padEnd(12)} ${b.created_at || '-'}`);
|
|
33
|
+
}
|
|
34
|
+
return textResult(lines.join('\n'));
|
|
35
|
+
});
|
|
36
|
+
server.tool('dailey_rollback', 'Rollback a project to a previous build', {
|
|
37
|
+
project_id: z.string().describe('The project ID'),
|
|
38
|
+
build_id: z.string().describe('The build ID to rollback to'),
|
|
39
|
+
}, async ({ project_id, build_id }) => {
|
|
40
|
+
const res = await apiRequest('POST', `/projects/${project_id}/rollback`, { build_id });
|
|
41
|
+
if (!res.ok)
|
|
42
|
+
return textResult(formatError(res));
|
|
43
|
+
return textResult(`Rollback initiated for project ${project_id} to build ${build_id}.`);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=deploy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/tools/deploy.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,mBAAmB,CAAC,MAAiB;IACnD,MAAM,CAAC,IAAI,CACT,iBAAiB,EACjB,0BAA0B,EAC1B;QACE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC;QACjD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6CAA6C,CAAC;KACpF,EACD,KAAK,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE;QAC7B,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC;QACnD,MAAM,GAAG,GAAG,MAAM,UAAU,CAAe,KAAK,EAAE,aAAa,UAAU,QAAQ,KAAK,EAAE,CAAC,CAAC;QAC1F,IAA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AS,EAAE,MAAM,yCAAyC,CAAC;AAUpE,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,QAkDpD"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { apiRequest, formatError, textResult } from '../api.js';
|
|
3
|
+
export function registerDomainTools(server) {
|
|
4
|
+
server.tool('dailey_domains', 'List, add, or remove custom domains for a project', {
|
|
5
|
+
project_id: z.string().describe('The project ID'),
|
|
6
|
+
action: z.enum(['list', 'add', 'remove']).describe('Action: list, add, or remove'),
|
|
7
|
+
domain: z.string().optional().describe('Domain name (required for add/remove)'),
|
|
8
|
+
}, async ({ project_id, action, domain }) => {
|
|
9
|
+
if (action === 'list') {
|
|
10
|
+
const res = await apiRequest('GET', `/projects/${project_id}/domains`);
|
|
11
|
+
if (!res.ok)
|
|
12
|
+
return textResult(formatError(res));
|
|
13
|
+
const domains = res.data.domains;
|
|
14
|
+
if (!domains || domains.length === 0) {
|
|
15
|
+
return textResult('No custom domains configured.');
|
|
16
|
+
}
|
|
17
|
+
const lines = [
|
|
18
|
+
`Custom Domains (${domains.length})`,
|
|
19
|
+
'─'.repeat(50),
|
|
20
|
+
];
|
|
21
|
+
for (const d of domains) {
|
|
22
|
+
lines.push(`${d.domain}${d.status ? ` (${d.status})` : ''}`);
|
|
23
|
+
}
|
|
24
|
+
return textResult(lines.join('\n'));
|
|
25
|
+
}
|
|
26
|
+
if (action === 'add') {
|
|
27
|
+
if (!domain) {
|
|
28
|
+
return textResult('Error: domain is required for add action.');
|
|
29
|
+
}
|
|
30
|
+
const res = await apiRequest('POST', `/projects/${project_id}/domains`, { domain });
|
|
31
|
+
if (!res.ok)
|
|
32
|
+
return textResult(formatError(res));
|
|
33
|
+
return textResult(`Domain ${domain} added to project.`);
|
|
34
|
+
}
|
|
35
|
+
if (action === 'remove') {
|
|
36
|
+
if (!domain) {
|
|
37
|
+
return textResult('Error: domain is required for remove action.');
|
|
38
|
+
}
|
|
39
|
+
const res = await apiRequest('DELETE', `/projects/${project_id}/domains`, { domain });
|
|
40
|
+
if (!res.ok)
|
|
41
|
+
return textResult(formatError(res));
|
|
42
|
+
return textResult(`Domain ${domain} removed from project.`);
|
|
43
|
+
}
|
|
44
|
+
return textResult('Error: Invalid action. Use list, add, or remove.');
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=domains.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domains.js","sourceRoot":"","sources":["../../src/tools/domains.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAQhE,MAAM,UAAU,mBAAmB,CAAC,MAAiB;IACnD,MAAM,CAAC,IAAI,CACT,gBAAgB,EAChB,mDAAmD,EACnD;QACE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC;QACjD,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,8BAA8B,CAAC;QAClF,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;KAChF,EACD,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE;QACvC,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;YACtB,MAAM,GAAG,GAAG,MAAM,UAAU,CAAwB,KAAK,EAAE,aAAa,UAAU,UAAU,CAAC,CAAC;YAC9F,IAAI,CAAC,GAAG,CAAC,EAAE;gBAAE,OAAO,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;YAEjD,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;YAC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G,CAAC,EAAE;gBAAE,OAAO,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;YACjD,OAAO,UAAU,CAAC,UAAU,MAAM,wBAAwB,CAAC,CAAC;QAC9D,CAAC;QAED,OAAO,UAAU,CAAC,kDAAkD,CAAC,CAAC;IACxE,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/tools/env.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AASpE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,QA2DjD"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { apiRequest, formatError, textResult } from '../api.js';
|
|
3
|
+
export function registerEnvTools(server) {
|
|
4
|
+
server.tool('dailey_env_vars', 'List, set, or delete environment variables for a project', {
|
|
5
|
+
project_id: z.string().describe('The project ID'),
|
|
6
|
+
action: z.enum(['list', 'set', 'delete']).describe('Action: list, set, or delete'),
|
|
7
|
+
key: z.string().optional().describe('Environment variable key (required for set/delete)'),
|
|
8
|
+
value: z.string().optional().describe('Environment variable value (required for set)'),
|
|
9
|
+
}, async ({ project_id, action, key, value }) => {
|
|
10
|
+
if (action === 'list') {
|
|
11
|
+
const res = await apiRequest('GET', `/projects/${project_id}/env`);
|
|
12
|
+
if (!res.ok)
|
|
13
|
+
return textResult(formatError(res));
|
|
14
|
+
const vars = res.data.env_vars;
|
|
15
|
+
if (!vars || vars.length === 0) {
|
|
16
|
+
return textResult('No environment variables set.');
|
|
17
|
+
}
|
|
18
|
+
const lines = [
|
|
19
|
+
`Environment Variables (${vars.length})`,
|
|
20
|
+
'─'.repeat(60),
|
|
21
|
+
];
|
|
22
|
+
for (const v of vars) {
|
|
23
|
+
lines.push(`${v.key}${v.updated_at ? ` updated=${v.updated_at}` : ''}`);
|
|
24
|
+
}
|
|
25
|
+
lines.push('');
|
|
26
|
+
lines.push('Values stay hidden here by design. Use the env set/delete actions to manage them safely.');
|
|
27
|
+
return textResult(lines.join('\n'));
|
|
28
|
+
}
|
|
29
|
+
if (action === 'set') {
|
|
30
|
+
if (!key || value === undefined) {
|
|
31
|
+
return textResult('Error: key and value are required for set action.');
|
|
32
|
+
}
|
|
33
|
+
// Try PUT first (update), fall back to POST (create)
|
|
34
|
+
const putRes = await apiRequest('PUT', `/projects/${project_id}/env/${encodeURIComponent(key)}`, { value });
|
|
35
|
+
if (putRes.ok) {
|
|
36
|
+
return textResult(`Environment variable ${key} updated.`);
|
|
37
|
+
}
|
|
38
|
+
// If PUT fails (var doesn't exist yet), try POST
|
|
39
|
+
const postRes = await apiRequest('POST', `/projects/${project_id}/env`, { key, value });
|
|
40
|
+
if (!postRes.ok)
|
|
41
|
+
return textResult(formatError(postRes));
|
|
42
|
+
return textResult(`Environment variable ${key} set.`);
|
|
43
|
+
}
|
|
44
|
+
if (action === 'delete') {
|
|
45
|
+
if (!key) {
|
|
46
|
+
return textResult('Error: key is required for delete action.');
|
|
47
|
+
}
|
|
48
|
+
const res = await apiRequest('DELETE', `/projects/${project_id}/env/${encodeURIComponent(key)}`);
|
|
49
|
+
if (!res.ok)
|
|
50
|
+
return textResult(formatError(res));
|
|
51
|
+
return textResult(`Environment variable ${key} deleted.`);
|
|
52
|
+
}
|
|
53
|
+
return textResult('Error: Invalid action. Use list, set, or delete.');
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/tools/env.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAOhE,MAAM,UAAU,gBAAgB,CAAC,MAAiB;IA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YACjG,IAAI,CAAC,GAAG,CAAC,EAAE;gBAAE,OAAO,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;YACjD,OAAO,UAAU,CAAC,wBAAwB,GAAG,WAAW,CAAC,CAAC;QAC5D,CAAC;QAED,OAAO,UAAU,CAAC,kDAAkD,CAAC,CAAC;IACxE,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../src/tools/platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA8BpE,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,QAuDtD"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { apiRequest, formatError, textResult } from '../api.js';
|
|
3
|
+
export function registerPlatformTools(server) {
|
|
4
|
+
server.tool('dailey_platform_info', 'Show the safe platform capabilities available to a project', { project_id: z.string().describe('The project ID') }, async ({ project_id }) => {
|
|
5
|
+
const res = await apiRequest('GET', `/projects/${project_id}/platform`);
|
|
6
|
+
if (!res.ok)
|
|
7
|
+
return textResult(formatError(res));
|
|
8
|
+
const data = res.data;
|
|
9
|
+
const lines = [
|
|
10
|
+
`Platform: ${data.project.name}`,
|
|
11
|
+
`Slug: ${data.project.slug}`,
|
|
12
|
+
`Status: ${data.project.status}`,
|
|
13
|
+
`URL: ${data.project.url}`,
|
|
14
|
+
'',
|
|
15
|
+
`Safety Model`,
|
|
16
|
+
`Mode: ${data.safety.model}`,
|
|
17
|
+
];
|
|
18
|
+
for (const line of data.safety.guarantees || []) {
|
|
19
|
+
lines.push(`- ${line}`);
|
|
20
|
+
}
|
|
21
|
+
if ((data.safety.restrictions || []).length > 0) {
|
|
22
|
+
lines.push('');
|
|
23
|
+
lines.push('Restrictions');
|
|
24
|
+
for (const line of data.safety.restrictions || []) {
|
|
25
|
+
lines.push(`- ${line}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
lines.push('');
|
|
29
|
+
lines.push('Capabilities');
|
|
30
|
+
for (const capability of data.capabilities || []) {
|
|
31
|
+
lines.push(`- ${capability.label} [${capability.status}]`);
|
|
32
|
+
lines.push(` ${capability.summary}`);
|
|
33
|
+
if (capability.interfaces && capability.interfaces.length > 0) {
|
|
34
|
+
lines.push(` Interfaces: ${capability.interfaces.join(', ')}`);
|
|
35
|
+
}
|
|
36
|
+
for (const [key, value] of Object.entries(capability.details || {})) {
|
|
37
|
+
if (value === null || value === undefined || value === '')
|
|
38
|
+
continue;
|
|
39
|
+
if (Array.isArray(value) && value.length === 0)
|
|
40
|
+
continue;
|
|
41
|
+
lines.push(` ${key}: ${Array.isArray(value) ? value.join(', ') : String(value)}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (data.next_step) {
|
|
45
|
+
lines.push('');
|
|
46
|
+
lines.push(`Next Step: ${data.next_step}`);
|
|
47
|
+
}
|
|
48
|
+
return textResult(lines.join('\n'));
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=platform.js.map
|