mlgym-deploy 2.4.0 → 2.4.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.
Files changed (2) hide show
  1. package/index.js +66 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -16,8 +16,8 @@ import crypto from 'crypto';
16
16
 
17
17
  const execAsync = promisify(exec);
18
18
 
19
- // Current version of this MCP server - INCREMENT FOR SECURITY FIX
20
- const CURRENT_VERSION = '2.4.0';
19
+ // Current version of this MCP server - INCREMENT FOR WORKFLOW FIX
20
+ const CURRENT_VERSION = '2.4.1';
21
21
  const PACKAGE_NAME = 'mlgym-deploy';
22
22
 
23
23
  // Version check state
@@ -353,6 +353,57 @@ async function authenticate(args) {
353
353
  };
354
354
  }
355
355
 
356
+ // Check authentication status
357
+ async function checkAuthStatus() {
358
+ const auth = await loadAuth();
359
+
360
+ if (!auth.token) {
361
+ return {
362
+ content: [{
363
+ type: 'text',
364
+ text: JSON.stringify({
365
+ status: 'not_authenticated',
366
+ message: 'No authentication found. Please use mlgym_authenticate first.',
367
+ next_step: 'Call mlgym_authenticate with email and password'
368
+ }, null, 2)
369
+ }]
370
+ };
371
+ }
372
+
373
+ // Verify token is still valid
374
+ try {
375
+ const result = await apiRequest('GET', '/api/v1/user', null, true);
376
+
377
+ if (result.success) {
378
+ return {
379
+ content: [{
380
+ type: 'text',
381
+ text: JSON.stringify({
382
+ status: 'authenticated',
383
+ email: auth.email,
384
+ message: 'Authentication valid',
385
+ user: result.data,
386
+ next_step: 'You can now use mlgym_project_init to create a project'
387
+ }, null, 2)
388
+ }]
389
+ };
390
+ }
391
+ } catch (error) {
392
+ // Token might be expired
393
+ }
394
+
395
+ return {
396
+ content: [{
397
+ type: 'text',
398
+ text: JSON.stringify({
399
+ status: 'token_expired',
400
+ message: 'Authentication token expired. Please authenticate again.',
401
+ next_step: 'Call mlgym_authenticate with email and password'
402
+ }, null, 2)
403
+ }]
404
+ };
405
+ }
406
+
356
407
  // Initialize Project (requires authentication)
357
408
  async function initProject(args) {
358
409
  let { name, description, enable_deployment = true, hostname, local_path = '.' } = args;
@@ -495,9 +546,17 @@ const server = new Server(
495
546
  server.setRequestHandler(ListToolsRequestSchema, async () => {
496
547
  return {
497
548
  tools: [
549
+ {
550
+ name: 'mlgym_auth_status',
551
+ description: 'Check if you are authenticated. Always call this first to see if authentication is needed.',
552
+ inputSchema: {
553
+ type: 'object',
554
+ properties: {}
555
+ }
556
+ },
498
557
  {
499
558
  name: 'mlgym_authenticate',
500
- description: 'Authenticate with MLGym (handles both login and account creation securely)',
559
+ description: 'Step 1: Authenticate with MLGym. Just provide email and password. For new users, optionally set create_if_not_exists=true with full_name.',
501
560
  inputSchema: {
502
561
  type: 'object',
503
562
  properties: {
@@ -532,7 +591,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
532
591
  },
533
592
  {
534
593
  name: 'mlgym_project_init',
535
- description: 'Initialize a project with GitLab repository and optional Coolify deployment (requires authentication)',
594
+ description: 'Step 2: After authentication, create project. Provide name, description, and optionally hostname for deployment.',
536
595
  inputSchema: {
537
596
  type: 'object',
538
597
  properties: {
@@ -580,6 +639,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
580
639
 
581
640
  try {
582
641
  switch (name) {
642
+ case 'mlgym_auth_status':
643
+ return await checkAuthStatus();
644
+
583
645
  case 'mlgym_authenticate':
584
646
  return await authenticate(args);
585
647
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mlgym-deploy",
3
- "version": "2.4.0",
3
+ "version": "2.4.1",
4
4
  "description": "MCP server for GitLab Backend - User creation and project deployment",
5
5
  "main": "index.js",
6
6
  "type": "module",