mlgym-deploy 2.3.3 → 2.3.5

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 +88 -36
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -17,13 +17,14 @@ import crypto from 'crypto';
17
17
  const execAsync = promisify(exec);
18
18
 
19
19
  // Current version of this MCP server
20
- const CURRENT_VERSION = '2.3.3';
20
+ const CURRENT_VERSION = '2.3.5';
21
21
  const PACKAGE_NAME = 'mlgym-deploy';
22
22
 
23
23
  // Version check state
24
24
  let versionCheckResult = null;
25
25
  let lastVersionCheck = 0;
26
26
  const VERSION_CHECK_INTERVAL = 3600000; // Check once per hour
27
+ let updateAcknowledged = false; // Track if user has acknowledged the update
27
28
 
28
29
  // Helper to wrap tool response with update message if needed
29
30
  function wrapResponseWithUpdateMessage(response) {
@@ -317,6 +318,14 @@ const server = new Server(
317
318
 
318
319
  // Tool definitions
319
320
  const TOOLS = [
321
+ {
322
+ name: 'mlgym_update_acknowledge',
323
+ description: 'Acknowledge the update notification and continue using the current version (not recommended)',
324
+ inputSchema: {
325
+ type: 'object',
326
+ properties: {}
327
+ }
328
+ },
320
329
  {
321
330
  name: 'mlgym_git_configure',
322
331
  description: 'Check and configure git user settings (required before making commits)',
@@ -432,18 +441,18 @@ const TOOLS = [
432
441
  },
433
442
  {
434
443
  name: 'mlgym_auth_check',
435
- description: '🚨 ALWAYS USE THIS FIRST when deploying! Check if user account exists BEFORE asking for other details. Start by ONLY asking for email.',
444
+ description: '🚨 ALWAYS USE THIS FIRST when deploying! Check if user account exists. First call with email only, then call again with password if needed.',
436
445
  inputSchema: {
437
446
  type: 'object',
438
447
  properties: {
439
448
  email: {
440
449
  type: 'string',
441
- description: 'Email address to check (ask for this FIRST)',
450
+ description: 'Email address to check',
442
451
  pattern: '^[^@]+@[^@]+\\.[^@]+$'
443
452
  },
444
453
  password: {
445
454
  type: 'string',
446
- description: 'Password (ONLY ask if account exists)',
455
+ description: 'Password (optional - add on second call to authenticate)',
447
456
  minLength: 8
448
457
  }
449
458
  },
@@ -1206,6 +1215,71 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
1206
1215
  server.setRequestHandler(CallToolRequestSchema, async (request) => {
1207
1216
  const { name, arguments: args } = request.params;
1208
1217
 
1218
+ // Check for updates before executing ANY tool
1219
+ // Special handling: mlgym_version_check and mlgym_update_acknowledge bypass this check
1220
+ if (name !== 'mlgym_version_check' && name !== 'mlgym_update_acknowledge') {
1221
+ // Perform version check
1222
+ await checkForUpdates();
1223
+
1224
+ // If update is available and not acknowledged, force user to acknowledge
1225
+ if (versionCheckResult && versionCheckResult.updateAvailable && !updateAcknowledged) {
1226
+ return {
1227
+ content: [
1228
+ {
1229
+ type: 'text',
1230
+ text: `╔════════════════════════════════════════════════════════════════════╗
1231
+ ║ 🚨 UPDATE REQUIRED 🚨 ║
1232
+ ╚════════════════════════════════════════════════════════════════════╝
1233
+
1234
+ A newer version of MLGym MCP Server is available!
1235
+
1236
+ Current version: ${CURRENT_VERSION}
1237
+ Latest version: ${versionCheckResult.latest}
1238
+
1239
+ The MCP server requires an update before you can continue using it.
1240
+
1241
+ Please choose one of the following options:
1242
+
1243
+ 1. **UPDATE NOW (Recommended)**
1244
+ Open a new terminal in Cursor and run:
1245
+ \`\`\`bash
1246
+ npm install -g ${PACKAGE_NAME}@latest
1247
+ \`\`\`
1248
+ Then restart Cursor to use the updated MCP server.
1249
+
1250
+ 2. **ACKNOWLEDGE AND CONTINUE**
1251
+ If you need to continue without updating, use the special tool:
1252
+ \`mlgym_update_acknowledge\`
1253
+
1254
+ ⚠️ Warning: Continuing with an outdated version may cause:
1255
+ - Missing features
1256
+ - Compatibility issues
1257
+ - Unexpected errors
1258
+ - Deployment failures
1259
+
1260
+ Please update the MCP server or explicitly acknowledge to continue.`
1261
+ }
1262
+ ]
1263
+ };
1264
+ }
1265
+ }
1266
+
1267
+ // Handle special update acknowledgment tool
1268
+ if (name === 'mlgym_update_acknowledge') {
1269
+ updateAcknowledged = true;
1270
+ return {
1271
+ content: [
1272
+ {
1273
+ type: 'text',
1274
+ text: `✓ Update acknowledgment received. You can now continue using the MCP server.
1275
+
1276
+ ⚠️ You are using version ${CURRENT_VERSION} while version ${versionCheckResult?.latest || 'unknown'} is available.
1277
+ Some features may not work correctly. Please update as soon as possible.`
1278
+ }
1279
+ ]
1280
+ };
1281
+ }
1282
+
1209
1283
  let response;
1210
1284
  switch (name) {
1211
1285
  case 'mlgym_git_configure':
@@ -1866,44 +1940,22 @@ async function checkUserExists(args) {
1866
1940
  }
1867
1941
  }
1868
1942
 
1869
- // Try to check if email exists without password (will fail but gives info)
1870
- try {
1871
- const result = await apiRequest('POST', '/api/v1/auth/login', {
1872
- email,
1873
- password: 'dummy_check'
1874
- }, false);
1875
-
1876
- // If we get here, it means the endpoint is accessible
1877
- // The error message will tell us if user exists
1878
- if (result.error && result.error.includes('Invalid credentials')) {
1879
- return {
1880
- content: [{
1881
- type: 'text',
1882
- text: JSON.stringify({
1883
- status: 'success',
1884
- exists: true,
1885
- authenticated: false,
1886
- email: email,
1887
- message: 'User exists but needs password to authenticate',
1888
- next_step: 'Please provide password to check SSH keys'
1889
- }, null, 2)
1890
- }]
1891
- };
1892
- }
1893
- } catch (err) {
1894
- // Network or other error
1895
- }
1896
-
1897
- // User doesn't exist
1943
+ // Without password, we cannot definitively check if user exists
1944
+ // Return a response that prompts for password to check
1898
1945
  return {
1899
1946
  content: [{
1900
1947
  type: 'text',
1901
1948
  text: JSON.stringify({
1902
1949
  status: 'success',
1903
- exists: false,
1950
+ exists: 'unknown',
1951
+ authenticated: false,
1904
1952
  email: email,
1905
- message: 'User does not exist. You can create a new account.',
1906
- next_step: 'Use mlgym_user_create to create a new account'
1953
+ message: 'Cannot determine if account exists without password',
1954
+ next_step: 'Please provide your password to check if you have an existing account, or provide full details to create a new account',
1955
+ options: [
1956
+ 'If you have an account: Provide your password',
1957
+ 'If you are new: Provide name, password, and accept terms to create account'
1958
+ ]
1907
1959
  }, null, 2)
1908
1960
  }]
1909
1961
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mlgym-deploy",
3
- "version": "2.3.3",
3
+ "version": "2.3.5",
4
4
  "description": "MCP server for GitLab Backend - User creation and project deployment",
5
5
  "main": "index.js",
6
6
  "type": "module",