mlgym-deploy 3.3.5 → 3.3.6

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 (2) hide show
  1. package/index.js +30 -27
  2. package/package.json +5 -1
package/index.js CHANGED
@@ -18,7 +18,7 @@ import crypto from 'crypto';
18
18
  const execAsync = promisify(exec);
19
19
 
20
20
  // Current version of this MCP server - INCREMENT FOR WORKFLOW FIXES
21
- const CURRENT_VERSION = '3.3.5'; // Fixed mlgym_deploy_logs project lookup (data.projects data) by importing fsSync for synchronous file operations
21
+ const CURRENT_VERSION = '3.3.6'; // Added mlgym_deploy_logs to package.json tools list for proper MCP registration
22
22
  const PACKAGE_NAME = 'mlgym-deploy';
23
23
 
24
24
  // Debug logging configuration - ENABLED BY DEFAULT
@@ -986,8 +986,8 @@ async function detectDeploymentStrategy(projectPath) {
986
986
 
987
987
  // Case 2: Only docker-compose
988
988
  if (!hasDockerfile && hasCompose) {
989
- log.info('MCP >>> [detectDeploymentStrategy] Strategy: docker-compose (compose only)');
990
- return { type: 'docker-compose', reason: 'docker-compose.yml only' };
989
+ log.info('MCP >>> [detectDeploymentStrategy] Strategy: dockercompose (compose only)');
990
+ return { type: 'dockercompose', reason: 'docker-compose.yml only' };
991
991
  }
992
992
 
993
993
  // Case 3: Both exist - analyze docker-compose to decide
@@ -1008,11 +1008,11 @@ async function detectDeploymentStrategy(projectPath) {
1008
1008
 
1009
1009
  // COMPLEX: Multiple services (web + database, etc.)
1010
1010
  // → MUST use docker-compose for orchestration
1011
- log.info('MCP >>> [detectDeploymentStrategy] Strategy: docker-compose (multi-service)');
1012
- return { type: 'docker-compose', reason: 'Application requires multiple services (web + database/cache/etc)' };
1011
+ log.info('MCP >>> [detectDeploymentStrategy] Strategy: dockercompose (multi-service)');
1012
+ return { type: 'dockercompose', reason: 'Application requires multiple services (web + database/cache/etc)' };
1013
1013
  } catch (err) {
1014
- log.error('MCP >>> [detectDeploymentStrategy] Analysis failed, defaulting to docker-compose:', err.message);
1015
- return { type: 'docker-compose', reason: 'Multiple deployment files found' };
1014
+ log.error('MCP >>> [detectDeploymentStrategy] Analysis failed, defaulting to dockercompose:', err.message);
1015
+ return { type: 'dockercompose', reason: 'Multiple deployment files found' };
1016
1016
  }
1017
1017
  }
1018
1018
 
@@ -1296,8 +1296,8 @@ async function initProject(args) {
1296
1296
  projectData.hostname = hostname;
1297
1297
  projectData.local_path = local_path;
1298
1298
 
1299
- // Read docker-compose content if using docker-compose strategy (v3.2.1+)
1300
- if (strategy.type === 'docker-compose') {
1299
+ // Read docker-compose content if using dockercompose strategy (v3.2.1+)
1300
+ if (strategy.type === 'dockercompose') {
1301
1301
  const composeFiles = ['docker-compose.yml', 'docker-compose.yaml'];
1302
1302
  let composeContent = null;
1303
1303
 
@@ -2020,7 +2020,7 @@ async function deployProject(args) {
2020
2020
  log.info('MCP >>> STEP 4.5: Validating deployment configuration...');
2021
2021
  const strategy = detectDeploymentStrategy(local_path);
2022
2022
 
2023
- if (strategy.type === 'docker-compose') {
2023
+ if (strategy.type === 'dockercompose') {
2024
2024
  const composePath = path.join(local_path, 'docker-compose.yml');
2025
2025
  const composePathYAML = path.join(local_path, 'docker-compose.yaml');
2026
2026
  const actualPath = fsSync.existsSync(composePath) ? composePath : composePathYAML;
@@ -2232,27 +2232,30 @@ async function getDeploymentLogs(args) {
2232
2232
  }
2233
2233
 
2234
2234
  log.info(`MCP >>> [getDeploymentLogs] Detected project name: ${projectName}`);
2235
+ // Get Coolify app UUID directly from User Agent by name
2236
+ const userAgentURL = 'http://coolify.eu.ezb.net:9000';
2237
+ const appLookupEndpoint = `${userAgentURL}/applications/by-name/${projectName}`;
2238
+
2239
+ log.info(`MCP >>> [getDeploymentLogs] Looking up application by name`);
2235
2240
 
2236
- // Get project details from backend to get Coolify app UUID
2237
- const projectsResult = await apiRequest('GET', '/api/v1/projects', null, true);
2238
- if (!projectsResult.success) {
2239
- throw new Error(`Failed to get projects: ${projectsResult.error}`);
2240
- }
2241
-
2242
- const project = projectsResult.data?.find(p => p.name === projectName);
2243
- if (!project) {
2244
- throw new Error(`Project "${projectName}" not found in your account`);
2245
- }
2246
-
2247
- if (!project.coolify_app_uuid) {
2248
- throw new Error(`Project "${projectName}" does not have deployment enabled`);
2241
+ let appUUID;
2242
+ try {
2243
+ const appResponse = await axios.get(appLookupEndpoint, {
2244
+ headers: {
2245
+ 'Authorization': 'Bearer 1|Jkztb5qPptwRKgtocfbT2TLjp8WGJG1SkPE4DzLt4c5d600f',
2246
+ 'Content-Type': 'application/json'
2247
+ }
2248
+ });
2249
+ appUUID = appResponse.data.uuid;
2250
+ log.info(`MCP >>> [getDeploymentLogs] Found Coolify app UUID: ${appUUID}`);
2251
+ } catch (appError) {
2252
+ if (appError.response?.status === 404) {
2253
+ throw new Error(`Project "${projectName}" not found in Coolify. Make sure deployment is enabled.`);
2254
+ }
2255
+ throw new Error(`Failed to lookup application: ${appError.message}`);
2249
2256
  }
2250
2257
 
2251
- const appUUID = project.coolify_app_uuid;
2252
- log.info(`MCP >>> [getDeploymentLogs] Found Coolify app UUID: ${appUUID}`);
2253
-
2254
2258
  // Call User Agent API to get deployment logs
2255
- const userAgentURL = 'http://coolify.eu.ezb.net:9000';
2256
2259
  const endpoint = `${userAgentURL}/applications/${appUUID}/deployment-logs?depth=${depth}`;
2257
2260
 
2258
2261
  log.info(`MCP >>> [getDeploymentLogs] Calling User Agent: ${endpoint}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mlgym-deploy",
3
- "version": "3.3.5",
3
+ "version": "3.3.6",
4
4
  "description": "MCP server for MLGym - Complete deployment management: deploy, configure, monitor, and rollback applications",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -52,6 +52,10 @@
52
52
  "name": "mlgym_set_env_vars",
53
53
  "description": "Set environment variables for an application (DATABASE_URL, API keys, etc.)"
54
54
  },
55
+ {
56
+ "name": "mlgym_deploy_logs",
57
+ "description": "View deployment history and logs for a project"
58
+ },
55
59
  {
56
60
  "name": "mlgym_set_health_check",
57
61
  "description": "Configure health checks to monitor application availability"