@masonator/coolify-mcp 0.2.14 → 0.2.16

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 CHANGED
@@ -1,1404 +1,157 @@
1
1
  #!/usr/bin/env node
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
9
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
10
- }) : x)(function(x) {
11
- if (typeof require !== "undefined") return require.apply(this, arguments);
12
- throw Error('Dynamic require of "' + x + '" is not supported');
13
- });
14
- var __commonJS = (cb, mod) => function __require2() {
15
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
16
- };
17
- var __copyProps = (to, from, except, desc) => {
18
- if (from && typeof from === "object" || typeof from === "function") {
19
- for (let key of __getOwnPropNames(from))
20
- if (!__hasOwnProp.call(to, key) && key !== except)
21
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
22
- }
23
- return to;
24
- };
25
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
26
- // If the importer is in node compatibility mode or this is not an ESM
27
- // file that has been converted to a CommonJS file using a Babel-
28
- // compatible transform (i.e. "__esModule" has not been set), then set
29
- // "default" to the CommonJS "module.exports" for node compatibility.
30
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
31
- mod
32
- ));
33
-
34
- // node_modules/ms/index.js
35
- var require_ms = __commonJS({
36
- "node_modules/ms/index.js"(exports, module) {
37
- var s = 1e3;
38
- var m = s * 60;
39
- var h = m * 60;
40
- var d = h * 24;
41
- var w = d * 7;
42
- var y = d * 365.25;
43
- module.exports = function(val, options) {
44
- options = options || {};
45
- var type = typeof val;
46
- if (type === "string" && val.length > 0) {
47
- return parse(val);
48
- } else if (type === "number" && isFinite(val)) {
49
- return options.long ? fmtLong(val) : fmtShort(val);
50
- }
51
- throw new Error(
52
- "val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
53
- );
54
- };
55
- function parse(str) {
56
- str = String(str);
57
- if (str.length > 100) {
58
- return;
59
- }
60
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
61
- str
62
- );
63
- if (!match) {
64
- return;
65
- }
66
- var n = parseFloat(match[1]);
67
- var type = (match[2] || "ms").toLowerCase();
68
- switch (type) {
69
- case "years":
70
- case "year":
71
- case "yrs":
72
- case "yr":
73
- case "y":
74
- return n * y;
75
- case "weeks":
76
- case "week":
77
- case "w":
78
- return n * w;
79
- case "days":
80
- case "day":
81
- case "d":
82
- return n * d;
83
- case "hours":
84
- case "hour":
85
- case "hrs":
86
- case "hr":
87
- case "h":
88
- return n * h;
89
- case "minutes":
90
- case "minute":
91
- case "mins":
92
- case "min":
93
- case "m":
94
- return n * m;
95
- case "seconds":
96
- case "second":
97
- case "secs":
98
- case "sec":
99
- case "s":
100
- return n * s;
101
- case "milliseconds":
102
- case "millisecond":
103
- case "msecs":
104
- case "msec":
105
- case "ms":
106
- return n;
107
- default:
108
- return void 0;
109
- }
110
- }
111
- function fmtShort(ms) {
112
- var msAbs = Math.abs(ms);
113
- if (msAbs >= d) {
114
- return Math.round(ms / d) + "d";
115
- }
116
- if (msAbs >= h) {
117
- return Math.round(ms / h) + "h";
118
- }
119
- if (msAbs >= m) {
120
- return Math.round(ms / m) + "m";
121
- }
122
- if (msAbs >= s) {
123
- return Math.round(ms / s) + "s";
124
- }
125
- return ms + "ms";
126
- }
127
- function fmtLong(ms) {
128
- var msAbs = Math.abs(ms);
129
- if (msAbs >= d) {
130
- return plural(ms, msAbs, d, "day");
131
- }
132
- if (msAbs >= h) {
133
- return plural(ms, msAbs, h, "hour");
134
- }
135
- if (msAbs >= m) {
136
- return plural(ms, msAbs, m, "minute");
137
- }
138
- if (msAbs >= s) {
139
- return plural(ms, msAbs, s, "second");
140
- }
141
- return ms + " ms";
142
- }
143
- function plural(ms, msAbs, n, name) {
144
- var isPlural = msAbs >= n * 1.5;
145
- return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
146
- }
147
- }
148
- });
149
-
150
- // node_modules/debug/src/common.js
151
- var require_common = __commonJS({
152
- "node_modules/debug/src/common.js"(exports, module) {
153
- function setup(env) {
154
- createDebug.debug = createDebug;
155
- createDebug.default = createDebug;
156
- createDebug.coerce = coerce;
157
- createDebug.disable = disable;
158
- createDebug.enable = enable;
159
- createDebug.enabled = enabled;
160
- createDebug.humanize = require_ms();
161
- createDebug.destroy = destroy;
162
- Object.keys(env).forEach((key) => {
163
- createDebug[key] = env[key];
164
- });
165
- createDebug.names = [];
166
- createDebug.skips = [];
167
- createDebug.formatters = {};
168
- function selectColor(namespace) {
169
- let hash = 0;
170
- for (let i = 0; i < namespace.length; i++) {
171
- hash = (hash << 5) - hash + namespace.charCodeAt(i);
172
- hash |= 0;
173
- }
174
- return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
175
- }
176
- createDebug.selectColor = selectColor;
177
- function createDebug(namespace) {
178
- let prevTime;
179
- let enableOverride = null;
180
- let namespacesCache;
181
- let enabledCache;
182
- function debug2(...args) {
183
- if (!debug2.enabled) {
184
- return;
185
- }
186
- const self = debug2;
187
- const curr = Number(/* @__PURE__ */ new Date());
188
- const ms = curr - (prevTime || curr);
189
- self.diff = ms;
190
- self.prev = prevTime;
191
- self.curr = curr;
192
- prevTime = curr;
193
- args[0] = createDebug.coerce(args[0]);
194
- if (typeof args[0] !== "string") {
195
- args.unshift("%O");
196
- }
197
- let index = 0;
198
- args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
199
- if (match === "%%") {
200
- return "%";
201
- }
202
- index++;
203
- const formatter = createDebug.formatters[format];
204
- if (typeof formatter === "function") {
205
- const val = args[index];
206
- match = formatter.call(self, val);
207
- args.splice(index, 1);
208
- index--;
209
- }
210
- return match;
211
- });
212
- createDebug.formatArgs.call(self, args);
213
- const logFn = self.log || createDebug.log;
214
- logFn.apply(self, args);
215
- }
216
- debug2.namespace = namespace;
217
- debug2.useColors = createDebug.useColors();
218
- debug2.color = createDebug.selectColor(namespace);
219
- debug2.extend = extend;
220
- debug2.destroy = createDebug.destroy;
221
- Object.defineProperty(debug2, "enabled", {
222
- enumerable: true,
223
- configurable: false,
224
- get: () => {
225
- if (enableOverride !== null) {
226
- return enableOverride;
227
- }
228
- if (namespacesCache !== createDebug.namespaces) {
229
- namespacesCache = createDebug.namespaces;
230
- enabledCache = createDebug.enabled(namespace);
231
- }
232
- return enabledCache;
233
- },
234
- set: (v) => {
235
- enableOverride = v;
236
- }
2
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
+ import { z } from 'zod';
5
+ const serviceTypes = [
6
+ 'wordpress-with-mysql',
7
+ 'wordpress-without-database',
8
+ 'code-server',
9
+ 'gitea',
10
+ 'nextcloud',
11
+ 'uptime-kuma',
12
+ 'vaultwarden'
13
+ ];
14
+ class CoolifyClient {
15
+ baseUrl;
16
+ accessToken;
17
+ constructor(baseUrl, accessToken) {
18
+ this.baseUrl = baseUrl;
19
+ this.accessToken = accessToken;
20
+ if (!baseUrl)
21
+ throw new Error('Coolify base URL is required');
22
+ if (!accessToken)
23
+ throw new Error('Coolify access token is required');
24
+ this.baseUrl = baseUrl.replace(/\/$/, '');
25
+ }
26
+ async request(path, options = {}) {
27
+ const url = `${this.baseUrl}/api/v1${path}`;
28
+ const response = await fetch(url, {
29
+ headers: {
30
+ 'Content-Type': 'application/json',
31
+ Authorization: `Bearer ${this.accessToken}`,
32
+ },
33
+ ...options,
237
34
  });
238
- if (typeof createDebug.init === "function") {
239
- createDebug.init(debug2);
240
- }
241
- return debug2;
242
- }
243
- function extend(namespace, delimiter) {
244
- const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
245
- newDebug.log = this.log;
246
- return newDebug;
247
- }
248
- function enable(namespaces) {
249
- createDebug.save(namespaces);
250
- createDebug.namespaces = namespaces;
251
- createDebug.names = [];
252
- createDebug.skips = [];
253
- const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(" ", ",").split(",").filter(Boolean);
254
- for (const ns of split) {
255
- if (ns[0] === "-") {
256
- createDebug.skips.push(ns.slice(1));
257
- } else {
258
- createDebug.names.push(ns);
259
- }
260
- }
261
- }
262
- function matchesTemplate(search, template) {
263
- let searchIndex = 0;
264
- let templateIndex = 0;
265
- let starIndex = -1;
266
- let matchIndex = 0;
267
- while (searchIndex < search.length) {
268
- if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
269
- if (template[templateIndex] === "*") {
270
- starIndex = templateIndex;
271
- matchIndex = searchIndex;
272
- templateIndex++;
273
- } else {
274
- searchIndex++;
275
- templateIndex++;
276
- }
277
- } else if (starIndex !== -1) {
278
- templateIndex = starIndex + 1;
279
- matchIndex++;
280
- searchIndex = matchIndex;
281
- } else {
282
- return false;
283
- }
284
- }
285
- while (templateIndex < template.length && template[templateIndex] === "*") {
286
- templateIndex++;
287
- }
288
- return templateIndex === template.length;
289
- }
290
- function disable() {
291
- const namespaces = [
292
- ...createDebug.names,
293
- ...createDebug.skips.map((namespace) => "-" + namespace)
294
- ].join(",");
295
- createDebug.enable("");
296
- return namespaces;
297
- }
298
- function enabled(name) {
299
- for (const skip of createDebug.skips) {
300
- if (matchesTemplate(name, skip)) {
301
- return false;
302
- }
303
- }
304
- for (const ns of createDebug.names) {
305
- if (matchesTemplate(name, ns)) {
306
- return true;
307
- }
308
- }
309
- return false;
310
- }
311
- function coerce(val) {
312
- if (val instanceof Error) {
313
- return val.stack || val.message;
314
- }
315
- return val;
316
- }
317
- function destroy() {
318
- console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
319
- }
320
- createDebug.enable(createDebug.load());
321
- return createDebug;
322
- }
323
- module.exports = setup;
324
- }
325
- });
326
-
327
- // node_modules/debug/src/browser.js
328
- var require_browser = __commonJS({
329
- "node_modules/debug/src/browser.js"(exports, module) {
330
- exports.formatArgs = formatArgs;
331
- exports.save = save;
332
- exports.load = load;
333
- exports.useColors = useColors;
334
- exports.storage = localstorage();
335
- exports.destroy = /* @__PURE__ */ (() => {
336
- let warned = false;
337
- return () => {
338
- if (!warned) {
339
- warned = true;
340
- console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
341
- }
342
- };
343
- })();
344
- exports.colors = [
345
- "#0000CC",
346
- "#0000FF",
347
- "#0033CC",
348
- "#0033FF",
349
- "#0066CC",
350
- "#0066FF",
351
- "#0099CC",
352
- "#0099FF",
353
- "#00CC00",
354
- "#00CC33",
355
- "#00CC66",
356
- "#00CC99",
357
- "#00CCCC",
358
- "#00CCFF",
359
- "#3300CC",
360
- "#3300FF",
361
- "#3333CC",
362
- "#3333FF",
363
- "#3366CC",
364
- "#3366FF",
365
- "#3399CC",
366
- "#3399FF",
367
- "#33CC00",
368
- "#33CC33",
369
- "#33CC66",
370
- "#33CC99",
371
- "#33CCCC",
372
- "#33CCFF",
373
- "#6600CC",
374
- "#6600FF",
375
- "#6633CC",
376
- "#6633FF",
377
- "#66CC00",
378
- "#66CC33",
379
- "#9900CC",
380
- "#9900FF",
381
- "#9933CC",
382
- "#9933FF",
383
- "#99CC00",
384
- "#99CC33",
385
- "#CC0000",
386
- "#CC0033",
387
- "#CC0066",
388
- "#CC0099",
389
- "#CC00CC",
390
- "#CC00FF",
391
- "#CC3300",
392
- "#CC3333",
393
- "#CC3366",
394
- "#CC3399",
395
- "#CC33CC",
396
- "#CC33FF",
397
- "#CC6600",
398
- "#CC6633",
399
- "#CC9900",
400
- "#CC9933",
401
- "#CCCC00",
402
- "#CCCC33",
403
- "#FF0000",
404
- "#FF0033",
405
- "#FF0066",
406
- "#FF0099",
407
- "#FF00CC",
408
- "#FF00FF",
409
- "#FF3300",
410
- "#FF3333",
411
- "#FF3366",
412
- "#FF3399",
413
- "#FF33CC",
414
- "#FF33FF",
415
- "#FF6600",
416
- "#FF6633",
417
- "#FF9900",
418
- "#FF9933",
419
- "#FFCC00",
420
- "#FFCC33"
421
- ];
422
- function useColors() {
423
- if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
424
- return true;
425
- }
426
- if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
427
- return false;
428
- }
429
- let m;
430
- return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
431
- typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
432
- // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
433
- typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
434
- typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
435
- }
436
- function formatArgs(args) {
437
- args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
438
- if (!this.useColors) {
439
- return;
440
- }
441
- const c = "color: " + this.color;
442
- args.splice(1, 0, c, "color: inherit");
443
- let index = 0;
444
- let lastC = 0;
445
- args[0].replace(/%[a-zA-Z%]/g, (match) => {
446
- if (match === "%%") {
447
- return;
448
- }
449
- index++;
450
- if (match === "%c") {
451
- lastC = index;
452
- }
453
- });
454
- args.splice(lastC, 0, c);
455
- }
456
- exports.log = console.debug || console.log || (() => {
457
- });
458
- function save(namespaces) {
459
- try {
460
- if (namespaces) {
461
- exports.storage.setItem("debug", namespaces);
462
- } else {
463
- exports.storage.removeItem("debug");
464
- }
465
- } catch (error) {
466
- }
467
- }
468
- function load() {
469
- let r;
470
- try {
471
- r = exports.storage.getItem("debug");
472
- } catch (error) {
473
- }
474
- if (!r && typeof process !== "undefined" && "env" in process) {
475
- r = process.env.DEBUG;
476
- }
477
- return r;
478
- }
479
- function localstorage() {
480
- try {
481
- return localStorage;
482
- } catch (error) {
483
- }
484
- }
485
- module.exports = require_common()(exports);
486
- var { formatters } = module.exports;
487
- formatters.j = function(v) {
488
- try {
489
- return JSON.stringify(v);
490
- } catch (error) {
491
- return "[UnexpectedJSONParseError]: " + error.message;
492
- }
493
- };
494
- }
495
- });
496
-
497
- // node_modules/has-flag/index.js
498
- var require_has_flag = __commonJS({
499
- "node_modules/has-flag/index.js"(exports, module) {
500
- "use strict";
501
- module.exports = (flag, argv = process.argv) => {
502
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
503
- const position = argv.indexOf(prefix + flag);
504
- const terminatorPosition = argv.indexOf("--");
505
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
506
- };
507
- }
508
- });
509
-
510
- // node_modules/supports-color/index.js
511
- var require_supports_color = __commonJS({
512
- "node_modules/supports-color/index.js"(exports, module) {
513
- "use strict";
514
- var os = __require("os");
515
- var tty = __require("tty");
516
- var hasFlag = require_has_flag();
517
- var { env } = process;
518
- var forceColor;
519
- if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
520
- forceColor = 0;
521
- } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
522
- forceColor = 1;
523
- }
524
- if ("FORCE_COLOR" in env) {
525
- if (env.FORCE_COLOR === "true") {
526
- forceColor = 1;
527
- } else if (env.FORCE_COLOR === "false") {
528
- forceColor = 0;
529
- } else {
530
- forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
531
- }
532
- }
533
- function translateLevel(level) {
534
- if (level === 0) {
535
- return false;
536
- }
537
- return {
538
- level,
539
- hasBasic: true,
540
- has256: level >= 2,
541
- has16m: level >= 3
542
- };
543
- }
544
- function supportsColor(haveStream, streamIsTTY) {
545
- if (forceColor === 0) {
546
- return 0;
547
- }
548
- if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
549
- return 3;
550
- }
551
- if (hasFlag("color=256")) {
552
- return 2;
553
- }
554
- if (haveStream && !streamIsTTY && forceColor === void 0) {
555
- return 0;
556
- }
557
- const min = forceColor || 0;
558
- if (env.TERM === "dumb") {
559
- return min;
560
- }
561
- if (process.platform === "win32") {
562
- const osRelease = os.release().split(".");
563
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
564
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
565
- }
566
- return 1;
567
- }
568
- if ("CI" in env) {
569
- if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
570
- return 1;
35
+ const data = await response.json();
36
+ if (!response.ok) {
37
+ throw new Error(data.message || `HTTP ${response.status}`);
571
38
  }
572
- return min;
573
- }
574
- if ("TEAMCITY_VERSION" in env) {
575
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
576
- }
577
- if (env.COLORTERM === "truecolor") {
578
- return 3;
579
- }
580
- if ("TERM_PROGRAM" in env) {
581
- const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
582
- switch (env.TERM_PROGRAM) {
583
- case "iTerm.app":
584
- return version >= 3 ? 3 : 2;
585
- case "Apple_Terminal":
586
- return 2;
587
- }
588
- }
589
- if (/-256(color)?$/i.test(env.TERM)) {
590
- return 2;
591
- }
592
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
593
- return 1;
594
- }
595
- if ("COLORTERM" in env) {
596
- return 1;
597
- }
598
- return min;
599
- }
600
- function getSupportLevel(stream) {
601
- const level = supportsColor(stream, stream && stream.isTTY);
602
- return translateLevel(level);
603
- }
604
- module.exports = {
605
- supportsColor: getSupportLevel,
606
- stdout: translateLevel(supportsColor(true, tty.isatty(1))),
607
- stderr: translateLevel(supportsColor(true, tty.isatty(2)))
608
- };
609
- }
610
- });
611
-
612
- // node_modules/debug/src/node.js
613
- var require_node = __commonJS({
614
- "node_modules/debug/src/node.js"(exports, module) {
615
- var tty = __require("tty");
616
- var util = __require("util");
617
- exports.init = init;
618
- exports.log = log2;
619
- exports.formatArgs = formatArgs;
620
- exports.save = save;
621
- exports.load = load;
622
- exports.useColors = useColors;
623
- exports.destroy = util.deprecate(
624
- () => {
625
- },
626
- "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."
627
- );
628
- exports.colors = [6, 2, 3, 4, 5, 1];
629
- try {
630
- const supportsColor = require_supports_color();
631
- if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
632
- exports.colors = [
633
- 20,
634
- 21,
635
- 26,
636
- 27,
637
- 32,
638
- 33,
639
- 38,
640
- 39,
641
- 40,
642
- 41,
643
- 42,
644
- 43,
645
- 44,
646
- 45,
647
- 56,
648
- 57,
649
- 62,
650
- 63,
651
- 68,
652
- 69,
653
- 74,
654
- 75,
655
- 76,
656
- 77,
657
- 78,
658
- 79,
659
- 80,
660
- 81,
661
- 92,
662
- 93,
663
- 98,
664
- 99,
665
- 112,
666
- 113,
667
- 128,
668
- 129,
669
- 134,
670
- 135,
671
- 148,
672
- 149,
673
- 160,
674
- 161,
675
- 162,
676
- 163,
677
- 164,
678
- 165,
679
- 166,
680
- 167,
681
- 168,
682
- 169,
683
- 170,
684
- 171,
685
- 172,
686
- 173,
687
- 178,
688
- 179,
689
- 184,
690
- 185,
691
- 196,
692
- 197,
693
- 198,
694
- 199,
695
- 200,
696
- 201,
697
- 202,
698
- 203,
699
- 204,
700
- 205,
701
- 206,
702
- 207,
703
- 208,
704
- 209,
705
- 214,
706
- 215,
707
- 220,
708
- 221
709
- ];
710
- }
711
- } catch (error) {
39
+ return data;
712
40
  }
713
- exports.inspectOpts = Object.keys(process.env).filter((key) => {
714
- return /^debug_/i.test(key);
715
- }).reduce((obj, key) => {
716
- const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
717
- return k.toUpperCase();
718
- });
719
- let val = process.env[key];
720
- if (/^(yes|on|true|enabled)$/i.test(val)) {
721
- val = true;
722
- } else if (/^(no|off|false|disabled)$/i.test(val)) {
723
- val = false;
724
- } else if (val === "null") {
725
- val = null;
726
- } else {
727
- val = Number(val);
728
- }
729
- obj[prop] = val;
730
- return obj;
731
- }, {});
732
- function useColors() {
733
- return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty.isatty(process.stderr.fd);
41
+ async listServers() {
42
+ return this.request('/servers');
734
43
  }
735
- function formatArgs(args) {
736
- const { namespace: name, useColors: useColors2 } = this;
737
- if (useColors2) {
738
- const c = this.color;
739
- const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
740
- const prefix = ` ${colorCode};1m${name} \x1B[0m`;
741
- args[0] = prefix + args[0].split("\n").join("\n" + prefix);
742
- args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
743
- } else {
744
- args[0] = getDate() + name + " " + args[0];
745
- }
44
+ async getServer(uuid) {
45
+ return this.request(`/servers/${uuid}`);
746
46
  }
747
- function getDate() {
748
- if (exports.inspectOpts.hideDate) {
749
- return "";
750
- }
751
- return (/* @__PURE__ */ new Date()).toISOString() + " ";
47
+ async listServices() {
48
+ return this.request('/services');
752
49
  }
753
- function log2(...args) {
754
- return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + "\n");
50
+ async createService(data) {
51
+ return this.request('/services', {
52
+ method: 'POST',
53
+ body: JSON.stringify(data),
54
+ });
755
55
  }
756
- function save(namespaces) {
757
- if (namespaces) {
758
- process.env.DEBUG = namespaces;
759
- } else {
760
- delete process.env.DEBUG;
761
- }
56
+ async deleteService(uuid) {
57
+ return this.request(`/services/${uuid}`, {
58
+ method: 'DELETE',
59
+ });
762
60
  }
763
- function load() {
764
- return process.env.DEBUG;
61
+ }
62
+ class CoolifyMcpServer extends McpServer {
63
+ client;
64
+ constructor(config) {
65
+ super({
66
+ name: 'coolify',
67
+ version: '0.2.15',
68
+ capabilities: {
69
+ tools: true,
70
+ resources: true,
71
+ prompts: true
72
+ }
73
+ });
74
+ this.client = new CoolifyClient(config.baseUrl, config.accessToken);
75
+ this.setupTools();
76
+ }
77
+ setupTools() {
78
+ this.tool('list_servers', 'List all Coolify servers', {}, async () => {
79
+ const servers = await this.client.listServers();
80
+ return {
81
+ content: [{ type: 'text', text: JSON.stringify(servers, null, 2) }]
82
+ };
83
+ });
84
+ this.tool('get_server', 'Get details about a specific Coolify server', {
85
+ uuid: z.string()
86
+ }, async (args) => {
87
+ const server = await this.client.getServer(args.uuid);
88
+ return {
89
+ content: [{ type: 'text', text: JSON.stringify(server, null, 2) }]
90
+ };
91
+ });
92
+ this.tool('list_services', 'List all Coolify services', {}, async () => {
93
+ const services = await this.client.listServices();
94
+ return {
95
+ content: [{ type: 'text', text: JSON.stringify(services, null, 2) }]
96
+ };
97
+ });
98
+ this.tool('create_service', 'Create a new Coolify service', {
99
+ type: z.enum(serviceTypes),
100
+ project_uuid: z.string(),
101
+ server_uuid: z.string(),
102
+ name: z.string().optional(),
103
+ environment_name: z.string().optional()
104
+ }, async (args) => {
105
+ const result = await this.client.createService(args);
106
+ return {
107
+ content: [{ type: 'text', text: JSON.stringify(result, null, 2) }]
108
+ };
109
+ });
110
+ this.tool('delete_service', 'Delete a Coolify service', {
111
+ uuid: z.string()
112
+ }, async (args) => {
113
+ const result = await this.client.deleteService(args.uuid);
114
+ return {
115
+ content: [{ type: 'text', text: JSON.stringify(result, null, 2) }]
116
+ };
117
+ });
765
118
  }
766
- function init(debug2) {
767
- debug2.inspectOpts = {};
768
- const keys = Object.keys(exports.inspectOpts);
769
- for (let i = 0; i < keys.length; i++) {
770
- debug2.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
771
- }
119
+ async resources_list() {
120
+ return {
121
+ resources: [
122
+ 'coolify/servers/list',
123
+ 'coolify/servers/{id}',
124
+ 'coolify/services/list',
125
+ 'coolify/services/create',
126
+ 'coolify/services/{id}/delete'
127
+ ]
128
+ };
129
+ }
130
+ async prompts_list() {
131
+ return {
132
+ prompts: [
133
+ 'Show me all Coolify servers',
134
+ 'Get details for server {uuid}',
135
+ 'List all services',
136
+ 'Create a new {type} service',
137
+ 'Delete service {uuid}'
138
+ ]
139
+ };
772
140
  }
773
- module.exports = require_common()(exports);
774
- var { formatters } = module.exports;
775
- formatters.o = function(v) {
776
- this.inspectOpts.colors = this.useColors;
777
- return util.inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
778
- };
779
- formatters.O = function(v) {
780
- this.inspectOpts.colors = this.useColors;
781
- return util.inspect(v, this.inspectOpts);
141
+ }
142
+ async function main() {
143
+ const config = {
144
+ baseUrl: process.env.COOLIFY_BASE_URL || 'http://localhost:3000',
145
+ accessToken: process.env.COOLIFY_ACCESS_TOKEN || '',
782
146
  };
783
- }
784
- });
785
-
786
- // node_modules/debug/src/index.js
787
- var require_src = __commonJS({
788
- "node_modules/debug/src/index.js"(exports, module) {
789
- if (typeof process === "undefined" || process.type === "renderer" || process.browser === true || process.__nwjs) {
790
- module.exports = require_browser();
791
- } else {
792
- module.exports = require_node();
793
- }
794
- }
795
- });
796
-
797
- // src/index.ts
798
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
799
-
800
- // src/lib/mcp-server.ts
801
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
802
-
803
- // src/lib/coolify-client.ts
804
- var CoolifyClient = class {
805
- constructor(config) {
806
- if (!config.baseUrl) {
807
- throw new Error("Coolify base URL is required");
808
- }
809
147
  if (!config.accessToken) {
810
- throw new Error("Coolify access token is required");
148
+ throw new Error('COOLIFY_ACCESS_TOKEN environment variable is required');
811
149
  }
812
- this.baseUrl = config.baseUrl.replace(/\/$/, "");
813
- this.accessToken = config.accessToken;
814
- }
815
- async request(path, options = {}) {
816
- try {
817
- const url = `${this.baseUrl}/api/v1${path}`;
818
- const response = await fetch(url, {
819
- headers: {
820
- "Content-Type": "application/json",
821
- Authorization: `Bearer ${this.accessToken}`
822
- },
823
- ...options
824
- });
825
- const data = await response.json();
826
- if (!response.ok) {
827
- const error = data;
828
- throw new Error(error.message || `HTTP ${response.status}: ${response.statusText}`);
829
- }
830
- return data;
831
- } catch (error) {
832
- if (error instanceof TypeError && error.message.includes("fetch")) {
833
- throw new Error(
834
- `Failed to connect to Coolify server at ${this.baseUrl}. Please check if the server is running and the URL is correct.`
835
- );
836
- }
837
- throw error;
838
- }
839
- }
840
- async listServers() {
841
- return this.request("/servers");
842
- }
843
- async getServer(uuid) {
844
- return this.request(`/servers/${uuid}`);
845
- }
846
- async getServerResources(uuid) {
847
- return this.request(`/servers/${uuid}/resources`);
848
- }
849
- async getServerDomains(uuid) {
850
- return this.request(`/servers/${uuid}/domains`);
851
- }
852
- async validateServer(uuid) {
853
- return this.request(`/servers/${uuid}/validate`);
854
- }
855
- async validateConnection() {
856
- try {
857
- await this.listServers();
858
- } catch (error) {
859
- throw new Error(
860
- `Failed to connect to Coolify server: ${error instanceof Error ? error.message : "Unknown error"}`
861
- );
862
- }
863
- }
864
- async listProjects() {
865
- return this.request("/projects");
866
- }
867
- async getProject(uuid) {
868
- return this.request(`/projects/${uuid}`);
869
- }
870
- async createProject(project) {
871
- return this.request("/projects", {
872
- method: "POST",
873
- body: JSON.stringify(project)
874
- });
875
- }
876
- async updateProject(uuid, project) {
877
- return this.request(`/projects/${uuid}`, {
878
- method: "PATCH",
879
- body: JSON.stringify(project)
880
- });
881
- }
882
- async deleteProject(uuid) {
883
- return this.request(`/projects/${uuid}`, {
884
- method: "DELETE"
885
- });
886
- }
887
- async getProjectEnvironment(projectUuid, environmentNameOrUuid) {
888
- return this.request(`/projects/${projectUuid}/${environmentNameOrUuid}`);
889
- }
890
- async deployApplication(uuid) {
891
- const response = await this.request(`/applications/${uuid}/deploy`, {
892
- method: "POST"
893
- });
894
- return response;
895
- }
896
- async listDatabases() {
897
- return this.request("/databases");
898
- }
899
- async getDatabase(uuid) {
900
- return this.request(`/databases/${uuid}`);
901
- }
902
- async updateDatabase(uuid, data) {
903
- return this.request(`/databases/${uuid}`, {
904
- method: "PATCH",
905
- body: JSON.stringify(data)
906
- });
907
- }
908
- async deleteDatabase(uuid, options) {
909
- const queryParams = new URLSearchParams();
910
- if (options) {
911
- if (options.deleteConfigurations !== void 0) {
912
- queryParams.set("delete_configurations", options.deleteConfigurations.toString());
913
- }
914
- if (options.deleteVolumes !== void 0) {
915
- queryParams.set("delete_volumes", options.deleteVolumes.toString());
916
- }
917
- if (options.dockerCleanup !== void 0) {
918
- queryParams.set("docker_cleanup", options.dockerCleanup.toString());
919
- }
920
- if (options.deleteConnectedNetworks !== void 0) {
921
- queryParams.set("delete_connected_networks", options.deleteConnectedNetworks.toString());
922
- }
923
- }
924
- const queryString = queryParams.toString();
925
- const url = queryString ? `/databases/${uuid}?${queryString}` : `/databases/${uuid}`;
926
- return this.request(url, {
927
- method: "DELETE"
928
- });
929
- }
930
- async listServices() {
931
- return this.request("/services");
932
- }
933
- async getService(uuid) {
934
- return this.request(`/services/${uuid}`);
935
- }
936
- async createService(data) {
937
- return this.request("/services", {
938
- method: "POST",
939
- body: JSON.stringify(data)
940
- });
941
- }
942
- async deleteService(uuid, options) {
943
- const queryParams = new URLSearchParams();
944
- if (options) {
945
- if (options.deleteConfigurations !== void 0) {
946
- queryParams.set("delete_configurations", options.deleteConfigurations.toString());
947
- }
948
- if (options.deleteVolumes !== void 0) {
949
- queryParams.set("delete_volumes", options.deleteVolumes.toString());
950
- }
951
- if (options.dockerCleanup !== void 0) {
952
- queryParams.set("docker_cleanup", options.dockerCleanup.toString());
953
- }
954
- if (options.deleteConnectedNetworks !== void 0) {
955
- queryParams.set("delete_connected_networks", options.deleteConnectedNetworks.toString());
956
- }
957
- }
958
- const queryString = queryParams.toString();
959
- const url = queryString ? `/services/${uuid}?${queryString}` : `/services/${uuid}`;
960
- return this.request(url, {
961
- method: "DELETE"
962
- });
963
- }
964
- // Add more methods as needed for other endpoints
965
- };
966
-
967
- // src/lib/mcp-server.ts
968
- var import_debug = __toESM(require_src(), 1);
969
- import { z } from "zod";
970
- var log = (0, import_debug.default)("coolify:mcp");
971
- var serviceTypes = [
972
- "activepieces",
973
- "appsmith",
974
- "appwrite",
975
- "authentik",
976
- "babybuddy",
977
- "budge",
978
- "changedetection",
979
- "chatwoot",
980
- "classicpress-with-mariadb",
981
- "classicpress-with-mysql",
982
- "classicpress-without-database",
983
- "cloudflared",
984
- "code-server",
985
- "dashboard",
986
- "directus",
987
- "directus-with-postgresql",
988
- "docker-registry",
989
- "docuseal",
990
- "docuseal-with-postgres",
991
- "dokuwiki",
992
- "duplicati",
993
- "emby",
994
- "embystat",
995
- "fider",
996
- "filebrowser",
997
- "firefly",
998
- "formbricks",
999
- "ghost",
1000
- "gitea",
1001
- "gitea-with-mariadb",
1002
- "gitea-with-mysql",
1003
- "gitea-with-postgresql",
1004
- "glance",
1005
- "glances",
1006
- "glitchtip",
1007
- "grafana",
1008
- "grafana-with-postgresql",
1009
- "grocy",
1010
- "heimdall",
1011
- "homepage",
1012
- "jellyfin",
1013
- "kuzzle",
1014
- "listmonk",
1015
- "logto",
1016
- "mediawiki",
1017
- "meilisearch",
1018
- "metabase",
1019
- "metube",
1020
- "minio",
1021
- "moodle",
1022
- "n8n",
1023
- "n8n-with-postgresql",
1024
- "next-image-transformation",
1025
- "nextcloud",
1026
- "nocodb",
1027
- "odoo",
1028
- "openblocks",
1029
- "pairdrop",
1030
- "penpot",
1031
- "phpmyadmin",
1032
- "pocketbase",
1033
- "posthog",
1034
- "reactive-resume",
1035
- "rocketchat",
1036
- "shlink",
1037
- "slash",
1038
- "snapdrop",
1039
- "statusnook",
1040
- "stirling-pdf",
1041
- "supabase",
1042
- "syncthing",
1043
- "tolgee",
1044
- "trigger",
1045
- "trigger-with-external-database",
1046
- "twenty",
1047
- "umami",
1048
- "unleash-with-postgresql",
1049
- "unleash-without-database",
1050
- "uptime-kuma",
1051
- "vaultwarden",
1052
- "vikunja",
1053
- "weblate",
1054
- "whoogle",
1055
- "wordpress-with-mariadb",
1056
- "wordpress-with-mysql",
1057
- "wordpress-without-database"
1058
- ];
1059
- var CoolifyMcpServer = class extends McpServer {
1060
- constructor(config) {
1061
- super({
1062
- name: "coolify",
1063
- version: "0.1.18",
1064
- capabilities: {
1065
- tools: true,
1066
- resources: true,
1067
- prompts: true
1068
- }
1069
- });
1070
- log("Initializing server with config: %o", config);
1071
- this.client = new CoolifyClient(config);
1072
- this.setupTools();
1073
- }
1074
- setupTools() {
1075
- log("Setting up tools");
1076
- this.tool("list_servers", "List all Coolify servers", {}, async (_args, _extra) => {
1077
- const servers = await this.client.listServers();
1078
- return {
1079
- content: [{ type: "text", text: JSON.stringify(servers, null, 2) }]
1080
- };
1081
- });
1082
- this.tool("get_server", "Get details about a specific Coolify server", {
1083
- uuid: z.string().describe("UUID of the server to get details for")
1084
- }, async (args) => {
1085
- const server = await this.client.getServer(args.uuid);
1086
- return {
1087
- content: [{ type: "text", text: JSON.stringify(server, null, 2) }]
1088
- };
1089
- });
1090
- this.tool("get_server_resources", "Get the current resources running on a specific Coolify server", {
1091
- uuid: z.string()
1092
- }, async (args, _extra) => {
1093
- const resources = await this.client.getServerResources(args.uuid);
1094
- return {
1095
- content: [{ type: "text", text: JSON.stringify(resources, null, 2) }]
1096
- };
1097
- });
1098
- this.tool("get_server_domains", "Get domains for a specific Coolify server", {
1099
- uuid: z.string()
1100
- }, async (args, _extra) => {
1101
- const domains = await this.client.getServerDomains(args.uuid);
1102
- return {
1103
- content: [{ type: "text", text: JSON.stringify(domains, null, 2) }]
1104
- };
1105
- });
1106
- this.tool("validate_server", "Validate a specific Coolify server", {
1107
- uuid: z.string()
1108
- }, async (args, _extra) => {
1109
- const validation = await this.client.validateServer(args.uuid);
1110
- return {
1111
- content: [{ type: "text", text: JSON.stringify(validation, null, 2) }]
1112
- };
1113
- });
1114
- this.tool("list_projects", "List all Coolify projects", {}, async (_args, _extra) => {
1115
- const projects = await this.client.listProjects();
1116
- return {
1117
- content: [{ type: "text", text: JSON.stringify(projects, null, 2) }]
1118
- };
1119
- });
1120
- this.tool("get_project", "Get details about a specific Coolify project", {
1121
- uuid: z.string()
1122
- }, async (args, _extra) => {
1123
- const project = await this.client.getProject(args.uuid);
1124
- return {
1125
- content: [{ type: "text", text: JSON.stringify(project, null, 2) }]
1126
- };
1127
- });
1128
- this.tool("create_project", "Create a new Coolify project", {
1129
- name: z.string(),
1130
- description: z.string().optional()
1131
- }, async (args, _extra) => {
1132
- const result = await this.client.createProject({
1133
- name: args.name,
1134
- description: args.description
1135
- });
1136
- return {
1137
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1138
- };
1139
- });
1140
- this.tool("update_project", "Update an existing Coolify project", {
1141
- uuid: z.string(),
1142
- name: z.string(),
1143
- description: z.string().optional()
1144
- }, async (args, _extra) => {
1145
- const { uuid, ...updateData } = args;
1146
- const result = await this.client.updateProject(uuid, updateData);
1147
- return {
1148
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1149
- };
1150
- });
1151
- this.tool("delete_project", "Delete a Coolify project", {
1152
- uuid: z.string()
1153
- }, async (args, _extra) => {
1154
- const result = await this.client.deleteProject(args.uuid);
1155
- return {
1156
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1157
- };
1158
- });
1159
- this.tool("get_project_environment", "Get environment details for a Coolify project", {
1160
- project_uuid: z.string(),
1161
- environment_name_or_uuid: z.string()
1162
- }, async (args, _extra) => {
1163
- const environment = await this.client.getProjectEnvironment(args.project_uuid, args.environment_name_or_uuid);
1164
- return {
1165
- content: [{ type: "text", text: JSON.stringify(environment, null, 2) }]
1166
- };
1167
- });
1168
- this.tool("list_databases", "List all Coolify databases", {}, async (_args, _extra) => {
1169
- const databases = await this.client.listDatabases();
1170
- return {
1171
- content: [{ type: "text", text: JSON.stringify(databases, null, 2) }]
1172
- };
1173
- });
1174
- this.tool("get_database", "Get details about a specific Coolify database", {
1175
- uuid: z.string()
1176
- }, async (args, _extra) => {
1177
- const database = await this.client.getDatabase(args.uuid);
1178
- return {
1179
- content: [{ type: "text", text: JSON.stringify(database, null, 2) }]
1180
- };
1181
- });
1182
- this.tool("update_database", "Update a Coolify database", {
1183
- uuid: z.string(),
1184
- data: z.record(z.unknown())
1185
- }, async (args, _extra) => {
1186
- const result = await this.client.updateDatabase(args.uuid, args.data);
1187
- return {
1188
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1189
- };
1190
- });
1191
- const deleteOptionsSchema = {
1192
- deleteConfigurations: z.boolean().optional(),
1193
- deleteVolumes: z.boolean().optional(),
1194
- dockerCleanup: z.boolean().optional(),
1195
- deleteConnectedNetworks: z.boolean().optional()
1196
- };
1197
- this.tool("delete_database", "Delete a Coolify database", {
1198
- uuid: z.string(),
1199
- options: z.object(deleteOptionsSchema).optional()
1200
- }, async (args, _extra) => {
1201
- const result = await this.client.deleteDatabase(args.uuid, args.options);
1202
- return {
1203
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1204
- };
1205
- });
1206
- this.tool("deploy_application", "Deploy a Coolify application", {
1207
- uuid: z.string()
1208
- }, async (args, _extra) => {
1209
- const result = await this.client.deployApplication(args.uuid);
1210
- return {
1211
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1212
- };
1213
- });
1214
- this.tool("list_services", "List all Coolify services", {}, async (_args, _extra) => {
1215
- const services = await this.client.listServices();
1216
- return {
1217
- content: [{ type: "text", text: JSON.stringify(services, null, 2) }]
1218
- };
1219
- });
1220
- this.tool("get_service", "Get details about a specific Coolify service", {
1221
- uuid: z.string()
1222
- }, async (args, _extra) => {
1223
- const service = await this.client.getService(args.uuid);
1224
- return {
1225
- content: [{ type: "text", text: JSON.stringify(service, null, 2) }]
1226
- };
1227
- });
1228
- this.tool("create_service", "Create a new Coolify service", {
1229
- type: z.enum(serviceTypes),
1230
- project_uuid: z.string(),
1231
- server_uuid: z.string(),
1232
- name: z.string().optional(),
1233
- description: z.string().optional(),
1234
- environment_name: z.string().optional(),
1235
- environment_uuid: z.string().optional(),
1236
- destination_uuid: z.string().optional(),
1237
- instant_deploy: z.boolean().optional()
1238
- }, async (args, _extra) => {
1239
- const result = await this.client.createService(args);
1240
- return {
1241
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1242
- };
1243
- });
1244
- this.tool("delete_service", "Delete a Coolify service", {
1245
- uuid: z.string(),
1246
- options: z.object(deleteOptionsSchema).optional()
1247
- }, async (args, _extra) => {
1248
- const result = await this.client.deleteService(args.uuid, args.options);
1249
- return {
1250
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
1251
- };
1252
- });
1253
- }
1254
- async connect(transport) {
1255
- log("Starting server...");
1256
- log("Validating connection...");
1257
- await this.client.validateConnection();
1258
- await super.connect(transport);
1259
- log("Server started successfully");
1260
- }
1261
- async list_servers() {
1262
- return this.client.listServers();
1263
- }
1264
- async get_server(uuid) {
1265
- return this.client.getServer(uuid);
1266
- }
1267
- async get_server_resources(uuid) {
1268
- return this.client.getServerResources(uuid);
1269
- }
1270
- async get_server_domains(uuid) {
1271
- return this.client.getServerDomains(uuid);
1272
- }
1273
- async validate_server(uuid) {
1274
- return this.client.validateServer(uuid);
1275
- }
1276
- async list_projects() {
1277
- return this.client.listProjects();
1278
- }
1279
- async get_project(uuid) {
1280
- return this.client.getProject(uuid);
1281
- }
1282
- async create_project(project) {
1283
- return this.client.createProject(project);
1284
- }
1285
- async update_project(uuid, project) {
1286
- return this.client.updateProject(uuid, project);
1287
- }
1288
- async delete_project(uuid) {
1289
- return this.client.deleteProject(uuid);
1290
- }
1291
- async get_project_environment(projectUuid, environmentNameOrUuid) {
1292
- return this.client.getProjectEnvironment(projectUuid, environmentNameOrUuid);
1293
- }
1294
- async deploy_application(params) {
1295
- return this.client.deployApplication(params.uuid);
1296
- }
1297
- async list_databases() {
1298
- return this.client.listDatabases();
1299
- }
1300
- async get_database(uuid) {
1301
- return this.client.getDatabase(uuid);
1302
- }
1303
- async update_database(uuid, data) {
1304
- return this.client.updateDatabase(uuid, data);
1305
- }
1306
- async delete_database(uuid, options) {
1307
- return this.client.deleteDatabase(uuid, options);
1308
- }
1309
- async list_services() {
1310
- return this.client.listServices();
1311
- }
1312
- async get_service(uuid) {
1313
- return this.client.getService(uuid);
1314
- }
1315
- async create_service(data) {
1316
- return this.client.createService(data);
1317
- }
1318
- async delete_service(uuid, options) {
1319
- return this.client.deleteService(uuid, options);
1320
- }
1321
- async resources_list() {
1322
- return {
1323
- resources: [
1324
- "coolify/servers/list",
1325
- "coolify/servers/{id}",
1326
- "coolify/servers/{id}/resources",
1327
- "coolify/servers/{id}/domains",
1328
- "coolify/servers/{id}/validate",
1329
- "coolify/projects/list",
1330
- "coolify/projects/{id}",
1331
- "coolify/projects/create",
1332
- "coolify/projects/{id}/update",
1333
- "coolify/projects/{id}/delete",
1334
- "coolify/projects/{id}/environments/{env}",
1335
- "coolify/databases/list",
1336
- "coolify/databases/{id}",
1337
- "coolify/databases/{id}/update",
1338
- "coolify/databases/{id}/delete",
1339
- "coolify/services/list",
1340
- "coolify/services/{id}",
1341
- "coolify/services/create",
1342
- "coolify/services/{id}/delete",
1343
- "coolify/applications/deploy/{id}"
1344
- ]
1345
- };
1346
- }
1347
- async prompts_list() {
1348
- return {
1349
- prompts: [
1350
- "Show me all Coolify servers in my instance",
1351
- "What's the status of server {uuid}?",
1352
- "Show me the resources running on server {uuid}",
1353
- "What domains are configured for server {uuid}?",
1354
- "Can you validate the connection to server {uuid}?",
1355
- "How much CPU and memory is server {uuid} using?",
1356
- "List all resources running on server {uuid}",
1357
- "Show me the current status of all servers",
1358
- "List all my Coolify projects",
1359
- 'Create a new project called "{name}" with description "{description}"',
1360
- "Show me the details of project {uuid}",
1361
- 'Update project {uuid} to change its name to "{name}"',
1362
- "Delete project {uuid}",
1363
- "Show me the environments in project {uuid}",
1364
- "Get details of the {env} environment in project {uuid}",
1365
- "What variables are set in the {env} environment of project {uuid}?",
1366
- "List all applications",
1367
- "Show me details of application {uuid}",
1368
- 'Create a new application called "{name}"',
1369
- "Delete application {uuid}",
1370
- "Show me all running services",
1371
- "Create a new {type} service",
1372
- "What's the status of service {uuid}?",
1373
- "Delete service {uuid} and clean up its resources",
1374
- "List all databases",
1375
- "Show me the configuration of database {uuid}",
1376
- "Update database {uuid}",
1377
- "Delete database {uuid} and clean up volumes",
1378
- "Show me all active deployments",
1379
- "What's the status of deployment {uuid}?",
1380
- "Deploy application {uuid}",
1381
- "Force rebuild and deploy application {uuid}",
1382
- "List recent deployments for application {uuid}"
1383
- ]
1384
- };
1385
- }
1386
- };
1387
-
1388
- // src/index.ts
1389
- async function main() {
1390
- const config = {
1391
- baseUrl: process.env.COOLIFY_BASE_URL || "http://localhost:3000",
1392
- accessToken: process.env.COOLIFY_ACCESS_TOKEN || ""
1393
- };
1394
- if (!config.accessToken) {
1395
- throw new Error("COOLIFY_ACCESS_TOKEN environment variable is required");
1396
- }
1397
- const server = new CoolifyMcpServer(config);
1398
- const transport = new StdioServerTransport();
1399
- await server.connect(transport);
150
+ const server = new CoolifyMcpServer(config);
151
+ const transport = new StdioServerTransport();
152
+ await server.connect(transport);
1400
153
  }
1401
154
  main().catch((error) => {
1402
- console.error("Fatal error:", error);
1403
- process.exit(1);
155
+ console.error('Fatal error:', error);
156
+ process.exit(1);
1404
157
  });