@vibetools/dokploy-mcp 1.0.0 → 2.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 (102) hide show
  1. package/README.md +59 -160
  2. package/dist/api/client.d.ts +3 -0
  3. package/dist/api/client.js +38 -13
  4. package/dist/cli/index.js +1 -0
  5. package/dist/codemode/context/execute-context.d.ts +590 -0
  6. package/dist/codemode/context/execute-context.js +64 -0
  7. package/dist/codemode/context/search-context.d.ts +13851 -0
  8. package/dist/codemode/context/search-context.js +42 -0
  9. package/dist/codemode/gateway/api-gateway.d.ts +12 -0
  10. package/dist/codemode/gateway/api-gateway.js +160 -0
  11. package/dist/codemode/gateway/error-format.d.ts +13 -0
  12. package/dist/codemode/gateway/error-format.js +9 -0
  13. package/dist/codemode/gateway/request-normalizer.d.ts +3 -0
  14. package/dist/codemode/gateway/request-normalizer.js +21 -0
  15. package/dist/codemode/gateway/trace.d.ts +13 -0
  16. package/dist/codemode/gateway/trace.js +11 -0
  17. package/dist/codemode/sandbox/host.d.ts +11 -0
  18. package/dist/codemode/sandbox/host.js +28 -0
  19. package/dist/codemode/sandbox/limits.d.ts +2 -0
  20. package/dist/codemode/sandbox/limits.js +20 -0
  21. package/dist/codemode/sandbox/runner.d.ts +8 -0
  22. package/dist/codemode/sandbox/runner.js +113 -0
  23. package/dist/codemode/sandbox/runtime.d.ts +2 -0
  24. package/dist/codemode/sandbox/runtime.js +3 -0
  25. package/dist/codemode/sandbox/serialize.d.ts +1 -0
  26. package/dist/codemode/sandbox/serialize.js +45 -0
  27. package/dist/codemode/sandbox/subprocess-runner.d.ts +10 -0
  28. package/dist/codemode/sandbox/subprocess-runner.js +91 -0
  29. package/dist/codemode/sandbox/types.d.ts +12 -0
  30. package/dist/codemode/sandbox/types.js +1 -0
  31. package/dist/codemode/sandbox/worker-entry.d.ts +1 -0
  32. package/dist/codemode/sandbox/worker-entry.js +70 -0
  33. package/dist/codemode/server-codemode.d.ts +2 -0
  34. package/dist/codemode/server-codemode.js +17 -0
  35. package/dist/codemode/tools/execute.d.ts +583 -0
  36. package/dist/codemode/tools/execute.js +52 -0
  37. package/dist/codemode/tools/index.d.ts +2 -0
  38. package/dist/codemode/tools/index.js +3 -0
  39. package/dist/codemode/tools/search.d.ts +2 -0
  40. package/dist/codemode/tools/search.js +62 -0
  41. package/dist/generated/dokploy-catalog.d.ts +27 -0
  42. package/dist/generated/dokploy-catalog.js +16 -0
  43. package/dist/generated/dokploy-schemas.d.ts +17533 -0
  44. package/dist/generated/dokploy-schemas.js +20639 -0
  45. package/dist/generated/dokploy-sdk.d.ts +558 -0
  46. package/dist/generated/dokploy-sdk.js +561 -0
  47. package/dist/generated/openapi-index.json +10591 -0
  48. package/dist/{tools/_factory.d.ts → mcp/tool-factory.d.ts} +2 -0
  49. package/dist/{tools/_factory.js → mcp/tool-factory.js} +26 -7
  50. package/dist/server.d.ts +1 -1
  51. package/dist/server.js +2 -15
  52. package/package.json +22 -11
  53. package/dist/tools/_database.d.ts +0 -12
  54. package/dist/tools/_database.js +0 -96
  55. package/dist/tools/admin.d.ts +0 -2
  56. package/dist/tools/admin.js +0 -61
  57. package/dist/tools/application.d.ts +0 -2
  58. package/dist/tools/application.js +0 -464
  59. package/dist/tools/backup.d.ts +0 -2
  60. package/dist/tools/backup.js +0 -103
  61. package/dist/tools/certificates.d.ts +0 -2
  62. package/dist/tools/certificates.js +0 -54
  63. package/dist/tools/cluster.d.ts +0 -2
  64. package/dist/tools/cluster.js +0 -38
  65. package/dist/tools/compose.d.ts +0 -2
  66. package/dist/tools/compose.js +0 -213
  67. package/dist/tools/deployment.d.ts +0 -2
  68. package/dist/tools/deployment.js +0 -27
  69. package/dist/tools/destination.d.ts +0 -2
  70. package/dist/tools/destination.js +0 -78
  71. package/dist/tools/docker.d.ts +0 -2
  72. package/dist/tools/docker.js +0 -50
  73. package/dist/tools/domain.d.ts +0 -2
  74. package/dist/tools/domain.js +0 -134
  75. package/dist/tools/index.d.ts +0 -2
  76. package/dist/tools/index.js +0 -48
  77. package/dist/tools/mariadb.d.ts +0 -1
  78. package/dist/tools/mariadb.js +0 -14
  79. package/dist/tools/mongo.d.ts +0 -1
  80. package/dist/tools/mongo.js +0 -12
  81. package/dist/tools/mounts.d.ts +0 -2
  82. package/dist/tools/mounts.js +0 -65
  83. package/dist/tools/mysql.d.ts +0 -1
  84. package/dist/tools/mysql.js +0 -14
  85. package/dist/tools/port.d.ts +0 -2
  86. package/dist/tools/port.js +0 -54
  87. package/dist/tools/postgres.d.ts +0 -1
  88. package/dist/tools/postgres.js +0 -13
  89. package/dist/tools/project.d.ts +0 -2
  90. package/dist/tools/project.js +0 -94
  91. package/dist/tools/redirects.d.ts +0 -2
  92. package/dist/tools/redirects.js +0 -53
  93. package/dist/tools/redis.d.ts +0 -1
  94. package/dist/tools/redis.js +0 -11
  95. package/dist/tools/registry.d.ts +0 -2
  96. package/dist/tools/registry.js +0 -81
  97. package/dist/tools/security.d.ts +0 -2
  98. package/dist/tools/security.js +0 -48
  99. package/dist/tools/settings.d.ts +0 -2
  100. package/dist/tools/settings.js +0 -258
  101. package/dist/tools/user.d.ts +0 -2
  102. package/dist/tools/user.js +0 -12
@@ -0,0 +1,52 @@
1
+ import { z } from 'zod';
2
+ import { createTool } from '../../mcp/tool-factory.js';
3
+ import { createExecuteContext } from '../context/execute-context.js';
4
+ import { createSandboxHost } from '../sandbox/host.js';
5
+ import { resolveSandboxLimits } from '../sandbox/limits.js';
6
+ import { runSandboxedFunction } from '../sandbox/runner.js';
7
+ import { resolveSandboxRuntime } from '../sandbox/runtime.js';
8
+ import { runExecuteInSubprocess } from '../sandbox/subprocess-runner.js';
9
+ const executeSchema = z
10
+ .object({
11
+ code: z.string().min(1).describe('Async JavaScript function to execute a Dokploy workflow'),
12
+ })
13
+ .strict();
14
+ export function buildExecuteContext(executor, maxCalls = resolveSandboxLimits().maxCalls) {
15
+ return createExecuteContext(executor, maxCalls);
16
+ }
17
+ export async function runExecuteWithHost(code, host) {
18
+ const execution = resolveSandboxRuntime() === 'subprocess'
19
+ ? await runExecuteInSubprocess({
20
+ code,
21
+ onCall: async (procedure, input) => {
22
+ const result = await host.call(procedure, input);
23
+ return result.data;
24
+ },
25
+ })
26
+ : await runSandboxedFunction({
27
+ code,
28
+ context: (() => {
29
+ const context = buildExecuteContext((procedure, payload) => host.call(procedure, payload));
30
+ return {
31
+ dokploy: context.dokploy,
32
+ helpers: context.helpers,
33
+ };
34
+ })(),
35
+ });
36
+ return {
37
+ result: execution.result,
38
+ logs: execution.logs,
39
+ calls: host.getCalls(),
40
+ };
41
+ }
42
+ export const executeTool = createTool({
43
+ name: 'execute',
44
+ title: 'Execute Dokploy Workflow',
45
+ description: 'Execute a sandboxed Dokploy workflow against the generated Dokploy SDK.',
46
+ schema: executeSchema,
47
+ annotations: { openWorldHint: true },
48
+ handler: async ({ input }) => {
49
+ const host = createSandboxHost();
50
+ return runExecuteWithHost(input.code, host);
51
+ },
52
+ });
@@ -0,0 +1,2 @@
1
+ import type { ToolDefinition } from '../../mcp/tool-factory.js';
2
+ export declare const codeModeTools: ToolDefinition[];
@@ -0,0 +1,3 @@
1
+ import { executeTool } from './execute.js';
2
+ import { searchTool } from './search.js';
3
+ export const codeModeTools = [searchTool, executeTool];
@@ -0,0 +1,2 @@
1
+ import { type ToolDefinition } from '../../mcp/tool-factory.js';
2
+ export declare const searchTool: ToolDefinition;
@@ -0,0 +1,62 @@
1
+ import { z } from 'zod';
2
+ import { createTool } from '../../mcp/tool-factory.js';
3
+ import { createSearchCatalogView } from '../context/search-context.js';
4
+ import { runSandboxedFunction } from '../sandbox/runner.js';
5
+ import { resolveSandboxRuntime } from '../sandbox/runtime.js';
6
+ import { runSearchInSubprocess } from '../sandbox/subprocess-runner.js';
7
+ const searchSchema = z
8
+ .object({
9
+ code: z.string().min(1).describe('Async JavaScript function to search the Dokploy API catalog'),
10
+ })
11
+ .strict();
12
+ const searchCatalog = createSearchCatalogView();
13
+ const MAX_SEARCH_OUTPUT_BYTES = 32 * 1024;
14
+ function boundSearchResult(value) {
15
+ if (Array.isArray(value)) {
16
+ return trimArrayToBytes(value);
17
+ }
18
+ if (value && typeof value === 'object' && 'matches' in value) {
19
+ const typed = value;
20
+ if (Array.isArray(typed.matches)) {
21
+ return {
22
+ ...typed,
23
+ matches: trimArrayToBytes(typed.matches),
24
+ };
25
+ }
26
+ }
27
+ return value;
28
+ }
29
+ function trimArrayToBytes(items) {
30
+ const limited = items.slice(0, 50);
31
+ let length = limited.length;
32
+ while (length > 0) {
33
+ const candidate = limited.slice(0, length);
34
+ const bytes = Buffer.byteLength(JSON.stringify(candidate), 'utf8');
35
+ if (bytes <= MAX_SEARCH_OUTPUT_BYTES) {
36
+ return candidate;
37
+ }
38
+ length -= 1;
39
+ }
40
+ return [];
41
+ }
42
+ export const searchTool = createTool({
43
+ name: 'search',
44
+ title: 'Search Dokploy API',
45
+ description: 'Search the Dokploy API catalog by executing sandboxed code against a compact API index.',
46
+ schema: searchSchema,
47
+ annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
48
+ handler: async ({ input }) => {
49
+ const execution = resolveSandboxRuntime() === 'subprocess'
50
+ ? await runSearchInSubprocess({ code: input.code })
51
+ : await runSandboxedFunction({
52
+ code: input.code,
53
+ context: {
54
+ catalog: searchCatalog,
55
+ },
56
+ });
57
+ return {
58
+ result: boundSearchResult(execution.result),
59
+ logs: execution.logs,
60
+ };
61
+ },
62
+ });
@@ -0,0 +1,27 @@
1
+ export interface CatalogEndpoint {
2
+ procedure: string;
3
+ method: string;
4
+ path: string;
5
+ tag: string;
6
+ summary: string | null;
7
+ description: string | null;
8
+ inputKind: 'query' | 'body';
9
+ requiredInputs: string[];
10
+ optionalInputs: string[];
11
+ response: {
12
+ type: string;
13
+ keys: string[];
14
+ };
15
+ }
16
+ export interface DokployCatalog {
17
+ version: string;
18
+ endpointCount: number;
19
+ tagCount: number;
20
+ endpoints: CatalogEndpoint[];
21
+ byTag: Record<string, number[]>;
22
+ byProcedure: Record<string, number>;
23
+ byPath: Record<string, number>;
24
+ }
25
+ export declare const dokployCatalog: DokployCatalog;
26
+ export declare function getCatalogEndpoint(id: string): CatalogEndpoint | undefined;
27
+ export declare function getCatalogEndpointsByTag(tag: string): (CatalogEndpoint | undefined)[];
@@ -0,0 +1,16 @@
1
+ // Generated by scripts/v2/build-openapi-index.mjs
2
+ import openapiIndex from './openapi-index.json' with { type: 'json' };
3
+ export const dokployCatalog = openapiIndex;
4
+ export function getCatalogEndpoint(id) {
5
+ const byProcedureIndex = dokployCatalog.byProcedure[id];
6
+ if (byProcedureIndex !== undefined)
7
+ return dokployCatalog.endpoints[byProcedureIndex];
8
+ const byPathIndex = dokployCatalog.byPath[id];
9
+ if (byPathIndex !== undefined)
10
+ return dokployCatalog.endpoints[byPathIndex];
11
+ return undefined;
12
+ }
13
+ export function getCatalogEndpointsByTag(tag) {
14
+ const indexes = dokployCatalog.byTag[tag] ?? [];
15
+ return indexes.map((index) => dokployCatalog.endpoints[index]).filter(Boolean);
16
+ }