@masonator/coolify-mcp 0.2.18 → 0.3.1

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,144 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
2
  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,
34
- });
35
- const data = await response.json();
36
- if (!response.ok) {
37
- throw new Error(data.message || `HTTP ${response.status}`);
38
- }
39
- return data;
40
- }
41
- async listServers() {
42
- return this.request('/servers');
43
- }
44
- async getServer(uuid) {
45
- return this.request(`/servers/${uuid}`);
46
- }
47
- async listServices() {
48
- return this.request('/services');
49
- }
50
- async createService(data) {
51
- return this.request('/services', {
52
- method: 'POST',
53
- body: JSON.stringify(data),
54
- });
55
- }
56
- async deleteService(uuid) {
57
- return this.request(`/services/${uuid}`, {
58
- method: 'DELETE',
59
- });
60
- }
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
- });
118
- }
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
- };
140
- }
141
- }
3
+ import { CoolifyMcpServer } from './lib/mcp-server.js';
142
4
  async function main() {
143
5
  const config = {
144
6
  baseUrl: process.env.COOLIFY_BASE_URL || 'http://localhost:3000',
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Coolify API Client
3
+ * Complete HTTP client for the Coolify API v1
4
+ */
5
+ import type { CoolifyConfig, DeleteOptions, MessageResponse, UuidResponse, Server, ServerResource, ServerDomain, ServerValidation, CreateServerRequest, UpdateServerRequest, Project, CreateProjectRequest, UpdateProjectRequest, Environment, CreateEnvironmentRequest, Application, CreateApplicationPublicRequest, CreateApplicationPrivateGHRequest, CreateApplicationPrivateKeyRequest, CreateApplicationDockerfileRequest, CreateApplicationDockerImageRequest, CreateApplicationDockerComposeRequest, UpdateApplicationRequest, ApplicationActionResponse, EnvironmentVariable, CreateEnvVarRequest, UpdateEnvVarRequest, BulkUpdateEnvVarsRequest, Database, UpdateDatabaseRequest, DatabaseBackup, CreateDatabaseBackupRequest, Service, CreateServiceRequest, UpdateServiceRequest, ServiceCreateResponse, Deployment, Team, TeamMember, PrivateKey, CreatePrivateKeyRequest, UpdatePrivateKeyRequest, CloudToken, CreateCloudTokenRequest, UpdateCloudTokenRequest, CloudTokenValidation, Version } from '../types/coolify.js';
6
+ /**
7
+ * HTTP client for the Coolify API
8
+ */
9
+ export declare class CoolifyClient {
10
+ private readonly baseUrl;
11
+ private readonly accessToken;
12
+ constructor(config: CoolifyConfig);
13
+ private request;
14
+ private buildQueryString;
15
+ getVersion(): Promise<Version>;
16
+ validateConnection(): Promise<void>;
17
+ listServers(): Promise<Server[]>;
18
+ getServer(uuid: string): Promise<Server>;
19
+ createServer(data: CreateServerRequest): Promise<UuidResponse>;
20
+ updateServer(uuid: string, data: UpdateServerRequest): Promise<Server>;
21
+ deleteServer(uuid: string): Promise<MessageResponse>;
22
+ getServerResources(uuid: string): Promise<ServerResource[]>;
23
+ getServerDomains(uuid: string): Promise<ServerDomain[]>;
24
+ validateServer(uuid: string): Promise<ServerValidation>;
25
+ listProjects(): Promise<Project[]>;
26
+ getProject(uuid: string): Promise<Project>;
27
+ createProject(data: CreateProjectRequest): Promise<UuidResponse>;
28
+ updateProject(uuid: string, data: UpdateProjectRequest): Promise<Project>;
29
+ deleteProject(uuid: string): Promise<MessageResponse>;
30
+ listProjectEnvironments(projectUuid: string): Promise<Environment[]>;
31
+ getProjectEnvironment(projectUuid: string, environmentNameOrUuid: string): Promise<Environment>;
32
+ createProjectEnvironment(projectUuid: string, data: CreateEnvironmentRequest): Promise<UuidResponse>;
33
+ deleteProjectEnvironment(environmentUuid: string): Promise<MessageResponse>;
34
+ listApplications(): Promise<Application[]>;
35
+ getApplication(uuid: string): Promise<Application>;
36
+ createApplicationPublic(data: CreateApplicationPublicRequest): Promise<UuidResponse>;
37
+ createApplicationPrivateGH(data: CreateApplicationPrivateGHRequest): Promise<UuidResponse>;
38
+ createApplicationPrivateKey(data: CreateApplicationPrivateKeyRequest): Promise<UuidResponse>;
39
+ createApplicationDockerfile(data: CreateApplicationDockerfileRequest): Promise<UuidResponse>;
40
+ createApplicationDockerImage(data: CreateApplicationDockerImageRequest): Promise<UuidResponse>;
41
+ createApplicationDockerCompose(data: CreateApplicationDockerComposeRequest): Promise<UuidResponse>;
42
+ updateApplication(uuid: string, data: UpdateApplicationRequest): Promise<Application>;
43
+ deleteApplication(uuid: string, options?: DeleteOptions): Promise<MessageResponse>;
44
+ getApplicationLogs(uuid: string, lines?: number): Promise<string>;
45
+ startApplication(uuid: string, options?: {
46
+ force?: boolean;
47
+ instant_deploy?: boolean;
48
+ }): Promise<ApplicationActionResponse>;
49
+ stopApplication(uuid: string): Promise<ApplicationActionResponse>;
50
+ restartApplication(uuid: string): Promise<ApplicationActionResponse>;
51
+ listApplicationEnvVars(uuid: string): Promise<EnvironmentVariable[]>;
52
+ createApplicationEnvVar(uuid: string, data: CreateEnvVarRequest): Promise<UuidResponse>;
53
+ updateApplicationEnvVar(uuid: string, data: UpdateEnvVarRequest): Promise<MessageResponse>;
54
+ bulkUpdateApplicationEnvVars(uuid: string, data: BulkUpdateEnvVarsRequest): Promise<MessageResponse>;
55
+ deleteApplicationEnvVar(uuid: string, envUuid: string): Promise<MessageResponse>;
56
+ listDatabases(): Promise<Database[]>;
57
+ getDatabase(uuid: string): Promise<Database>;
58
+ updateDatabase(uuid: string, data: UpdateDatabaseRequest): Promise<Database>;
59
+ deleteDatabase(uuid: string, options?: DeleteOptions): Promise<MessageResponse>;
60
+ startDatabase(uuid: string): Promise<MessageResponse>;
61
+ stopDatabase(uuid: string): Promise<MessageResponse>;
62
+ restartDatabase(uuid: string): Promise<MessageResponse>;
63
+ listDatabaseBackups(uuid: string): Promise<DatabaseBackup[]>;
64
+ createDatabaseBackup(uuid: string, data: CreateDatabaseBackupRequest): Promise<UuidResponse & MessageResponse>;
65
+ listServices(): Promise<Service[]>;
66
+ getService(uuid: string): Promise<Service>;
67
+ createService(data: CreateServiceRequest): Promise<ServiceCreateResponse>;
68
+ updateService(uuid: string, data: UpdateServiceRequest): Promise<Service>;
69
+ deleteService(uuid: string, options?: DeleteOptions): Promise<MessageResponse>;
70
+ startService(uuid: string): Promise<MessageResponse>;
71
+ stopService(uuid: string): Promise<MessageResponse>;
72
+ restartService(uuid: string): Promise<MessageResponse>;
73
+ listServiceEnvVars(uuid: string): Promise<EnvironmentVariable[]>;
74
+ createServiceEnvVar(uuid: string, data: CreateEnvVarRequest): Promise<UuidResponse>;
75
+ updateServiceEnvVar(uuid: string, data: UpdateEnvVarRequest): Promise<MessageResponse>;
76
+ deleteServiceEnvVar(uuid: string, envUuid: string): Promise<MessageResponse>;
77
+ listDeployments(): Promise<Deployment[]>;
78
+ getDeployment(uuid: string): Promise<Deployment>;
79
+ deployByTagOrUuid(tagOrUuid: string, force?: boolean): Promise<MessageResponse>;
80
+ listApplicationDeployments(appUuid: string): Promise<Deployment[]>;
81
+ listTeams(): Promise<Team[]>;
82
+ getTeam(id: number): Promise<Team>;
83
+ getTeamMembers(id: number): Promise<TeamMember[]>;
84
+ getCurrentTeam(): Promise<Team>;
85
+ getCurrentTeamMembers(): Promise<TeamMember[]>;
86
+ listPrivateKeys(): Promise<PrivateKey[]>;
87
+ getPrivateKey(uuid: string): Promise<PrivateKey>;
88
+ createPrivateKey(data: CreatePrivateKeyRequest): Promise<UuidResponse>;
89
+ updatePrivateKey(uuid: string, data: UpdatePrivateKeyRequest): Promise<PrivateKey>;
90
+ deletePrivateKey(uuid: string): Promise<MessageResponse>;
91
+ listCloudTokens(): Promise<CloudToken[]>;
92
+ getCloudToken(uuid: string): Promise<CloudToken>;
93
+ createCloudToken(data: CreateCloudTokenRequest): Promise<UuidResponse>;
94
+ updateCloudToken(uuid: string, data: UpdateCloudTokenRequest): Promise<CloudToken>;
95
+ deleteCloudToken(uuid: string): Promise<MessageResponse>;
96
+ validateCloudToken(uuid: string): Promise<CloudTokenValidation>;
97
+ }