mlgym-deploy 3.0.5 → 3.0.7
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/DEBUG.md +78 -0
- package/index.js +105 -13
- package/package.json +2 -2
package/DEBUG.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# MCP Debug Mode
|
|
2
|
+
|
|
3
|
+
## Debug Logging (Enabled by Default)
|
|
4
|
+
|
|
5
|
+
**✨ Debug mode is ON by default!** You'll automatically see detailed messages when you start Cursor from a terminal.
|
|
6
|
+
|
|
7
|
+
### To see debug output:
|
|
8
|
+
```bash
|
|
9
|
+
# Just start Cursor from terminal
|
|
10
|
+
cd ~/your-project
|
|
11
|
+
cursor .
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### To DISABLE debug logging (if too verbose):
|
|
15
|
+
```bash
|
|
16
|
+
export MLGYM_DEBUG=false
|
|
17
|
+
cursor .
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Or:
|
|
21
|
+
```bash
|
|
22
|
+
export DEBUG=off
|
|
23
|
+
cursor .
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## What You'll See
|
|
27
|
+
|
|
28
|
+
When debug mode is enabled, you'll see colored output in the terminal:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
╔═══════════════════════════════════════════════════════╗
|
|
32
|
+
║ MLGym MCP Server v3.0.6 ║
|
|
33
|
+
╚═══════════════════════════════════════════════════════╝
|
|
34
|
+
Backend: https://backend.eu.ezb.net
|
|
35
|
+
Debug mode: ENABLED
|
|
36
|
+
✓ Server ready and waiting for requests...
|
|
37
|
+
|
|
38
|
+
[12:34:56.789] ℹ INFO ═══════════════════════════════════════════════════
|
|
39
|
+
[12:34:56.790] ℹ INFO Tool called: mlgym_deploy (MCP v3.0.6)
|
|
40
|
+
[12:34:56.791] ⋯ DEBUG Arguments: {...}
|
|
41
|
+
[12:34:56.792] ℹ INFO Starting deployment workflow...
|
|
42
|
+
[12:34:58.123] ✓ SUCCESS Tool mlgym_deploy completed in 1331ms
|
|
43
|
+
[12:34:58.124] ℹ INFO ═══════════════════════════════════════════════════
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Log Levels
|
|
47
|
+
|
|
48
|
+
- **ℹ INFO** (cyan) - General information about operations
|
|
49
|
+
- **✓ SUCCESS** (green) - Successful completions
|
|
50
|
+
- **⚠ WARNING** (yellow) - Non-fatal issues (always shown)
|
|
51
|
+
- **✗ ERROR** (red) - Errors and failures (always shown)
|
|
52
|
+
- **⋯ DEBUG** (dim) - Detailed debugging info (only in debug mode)
|
|
53
|
+
|
|
54
|
+
## Debugging Tips
|
|
55
|
+
|
|
56
|
+
1. **Start Cursor from terminal** to see the output:
|
|
57
|
+
```bash
|
|
58
|
+
cd ~/your-project
|
|
59
|
+
cursor .
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
2. **Check the terminal** where you launched Cursor - all MCP logs appear there
|
|
63
|
+
|
|
64
|
+
3. **Errors and warnings** are always shown
|
|
65
|
+
|
|
66
|
+
4. **Disable debug mode** if output is too verbose:
|
|
67
|
+
```bash
|
|
68
|
+
export MLGYM_DEBUG=false
|
|
69
|
+
cursor .
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Troubleshooting
|
|
73
|
+
|
|
74
|
+
If you don't see debug messages:
|
|
75
|
+
1. Make sure you started Cursor from a terminal (not from GUI/Dock)
|
|
76
|
+
2. Check that you're using MCP v3.0.6 or later
|
|
77
|
+
3. Verify debug isn't explicitly disabled: `echo $MLGYM_DEBUG`
|
|
78
|
+
4. Look at the terminal where you launched Cursor, not inside Cursor itself
|
package/index.js
CHANGED
|
@@ -17,9 +17,68 @@ import crypto from 'crypto';
|
|
|
17
17
|
const execAsync = promisify(exec);
|
|
18
18
|
|
|
19
19
|
// Current version of this MCP server - INCREMENT FOR WORKFLOW FIXES
|
|
20
|
-
const CURRENT_VERSION = '3.0.
|
|
20
|
+
const CURRENT_VERSION = '3.0.7'; // Fixed Dockerfile generation path bug
|
|
21
21
|
const PACKAGE_NAME = 'mlgym-deploy';
|
|
22
22
|
|
|
23
|
+
// Debug logging configuration - ENABLED BY DEFAULT
|
|
24
|
+
const DEBUG_ENABLED = process.env.MLGYM_DEBUG !== 'false' && process.env.DEBUG !== 'off';
|
|
25
|
+
const DEBUG_COLORS = {
|
|
26
|
+
reset: '\x1b[0m',
|
|
27
|
+
bright: '\x1b[1m',
|
|
28
|
+
dim: '\x1b[2m',
|
|
29
|
+
cyan: '\x1b[36m',
|
|
30
|
+
green: '\x1b[32m',
|
|
31
|
+
yellow: '\x1b[33m',
|
|
32
|
+
red: '\x1b[31m',
|
|
33
|
+
magenta: '\x1b[35m',
|
|
34
|
+
blue: '\x1b[34m'
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// Enhanced debug logging functions
|
|
38
|
+
function debugLog(level, message, ...args) {
|
|
39
|
+
const timestamp = new Date().toISOString().split('T')[1].replace('Z', '');
|
|
40
|
+
let color = DEBUG_COLORS.reset;
|
|
41
|
+
let prefix = '';
|
|
42
|
+
|
|
43
|
+
switch(level) {
|
|
44
|
+
case 'info':
|
|
45
|
+
color = DEBUG_COLORS.cyan;
|
|
46
|
+
prefix = 'ℹ INFO';
|
|
47
|
+
break;
|
|
48
|
+
case 'success':
|
|
49
|
+
color = DEBUG_COLORS.green;
|
|
50
|
+
prefix = '✓ SUCCESS';
|
|
51
|
+
break;
|
|
52
|
+
case 'warning':
|
|
53
|
+
color = DEBUG_COLORS.yellow;
|
|
54
|
+
prefix = '⚠ WARNING';
|
|
55
|
+
break;
|
|
56
|
+
case 'error':
|
|
57
|
+
color = DEBUG_COLORS.red;
|
|
58
|
+
prefix = '✗ ERROR';
|
|
59
|
+
break;
|
|
60
|
+
case 'debug':
|
|
61
|
+
color = DEBUG_COLORS.dim;
|
|
62
|
+
prefix = '⋯ DEBUG';
|
|
63
|
+
break;
|
|
64
|
+
default:
|
|
65
|
+
prefix = '• LOG';
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (DEBUG_ENABLED || level === 'error' || level === 'warning') {
|
|
69
|
+
console.error(`${DEBUG_COLORS.dim}[${timestamp}]${DEBUG_COLORS.reset} ${color}${prefix}${DEBUG_COLORS.reset} ${message}`, ...args);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Convenience logging functions
|
|
74
|
+
const log = {
|
|
75
|
+
info: (msg, ...args) => debugLog('info', msg, ...args),
|
|
76
|
+
success: (msg, ...args) => debugLog('success', msg, ...args),
|
|
77
|
+
warning: (msg, ...args) => debugLog('warning', msg, ...args),
|
|
78
|
+
error: (msg, ...args) => debugLog('error', msg, ...args),
|
|
79
|
+
debug: (msg, ...args) => debugLog('debug', msg, ...args)
|
|
80
|
+
};
|
|
81
|
+
|
|
23
82
|
// Version check state
|
|
24
83
|
let versionCheckResult = null;
|
|
25
84
|
let lastVersionCheck = 0;
|
|
@@ -1472,13 +1531,13 @@ class DeploymentWorkflow {
|
|
|
1472
1531
|
}
|
|
1473
1532
|
}
|
|
1474
1533
|
|
|
1475
|
-
async prepareProject(projectType, framework, packageManager) {
|
|
1534
|
+
async prepareProject(localPath, projectType, framework, packageManager) {
|
|
1476
1535
|
this.currentStep = 'preparation';
|
|
1477
1536
|
this.addStep('prepare_project', 'running');
|
|
1478
1537
|
|
|
1479
1538
|
try {
|
|
1480
1539
|
// Check if Dockerfile exists
|
|
1481
|
-
const analysis = this.projectAnalysis || await analyzeProject(
|
|
1540
|
+
const analysis = this.projectAnalysis || await analyzeProject(localPath);
|
|
1482
1541
|
|
|
1483
1542
|
if (analysis.has_dockerfile) {
|
|
1484
1543
|
this.updateLastStep('skipped', 'Dockerfile already exists');
|
|
@@ -1487,7 +1546,7 @@ class DeploymentWorkflow {
|
|
|
1487
1546
|
|
|
1488
1547
|
// Generate Dockerfile
|
|
1489
1548
|
const prepResult = await prepareProject({
|
|
1490
|
-
local_path:
|
|
1549
|
+
local_path: localPath,
|
|
1491
1550
|
project_type: projectType || analysis.project_type,
|
|
1492
1551
|
framework: framework || analysis.framework,
|
|
1493
1552
|
package_manager: packageManager || 'npm'
|
|
@@ -1605,7 +1664,7 @@ async function deployProject(args) {
|
|
|
1605
1664
|
const analysis = await workflow.analyzeProject(local_path);
|
|
1606
1665
|
|
|
1607
1666
|
// Step 4: Prepare project (generate Dockerfile if needed)
|
|
1608
|
-
await workflow.prepareProject(project_type, framework, package_manager);
|
|
1667
|
+
await workflow.prepareProject(local_path, project_type, framework, package_manager);
|
|
1609
1668
|
|
|
1610
1669
|
// Step 5: Create GitLab project and deploy
|
|
1611
1670
|
const deployResult = await workflow.createAndDeployProject({
|
|
@@ -1863,27 +1922,47 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
1863
1922
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
1864
1923
|
const { name, arguments: args } = request.params;
|
|
1865
1924
|
|
|
1866
|
-
|
|
1925
|
+
log.info(`═══════════════════════════════════════════════════`);
|
|
1926
|
+
log.info(`Tool called: ${DEBUG_COLORS.bright}${name}${DEBUG_COLORS.reset} (MCP v${CURRENT_VERSION})`);
|
|
1927
|
+
log.debug(`Arguments:`, JSON.stringify(args, null, 2));
|
|
1867
1928
|
|
|
1868
1929
|
try {
|
|
1930
|
+
let result;
|
|
1931
|
+
const startTime = Date.now();
|
|
1932
|
+
|
|
1869
1933
|
switch (name) {
|
|
1870
1934
|
case 'mlgym_deploy':
|
|
1871
|
-
|
|
1935
|
+
log.info(`Starting deployment workflow...`);
|
|
1936
|
+
result = await deployProject(args);
|
|
1937
|
+
break;
|
|
1872
1938
|
|
|
1873
1939
|
case 'mlgym_status':
|
|
1874
|
-
|
|
1940
|
+
log.info(`Checking status...`);
|
|
1941
|
+
result = await getStatus(args);
|
|
1942
|
+
break;
|
|
1875
1943
|
|
|
1876
1944
|
case 'mlgym_user_create':
|
|
1877
|
-
|
|
1945
|
+
log.info(`Creating user account...`);
|
|
1946
|
+
result = await createUser(args);
|
|
1947
|
+
break;
|
|
1878
1948
|
|
|
1879
1949
|
case 'mlgym_auth_login':
|
|
1880
|
-
|
|
1950
|
+
log.info(`Authenticating user...`);
|
|
1951
|
+
result = await loginUser(args);
|
|
1952
|
+
break;
|
|
1881
1953
|
|
|
1882
1954
|
default:
|
|
1883
1955
|
throw new Error(`Unknown tool: ${name}. Available tools: mlgym_deploy, mlgym_status, mlgym_user_create, mlgym_auth_login`);
|
|
1884
1956
|
}
|
|
1957
|
+
|
|
1958
|
+
const duration = Date.now() - startTime;
|
|
1959
|
+
log.success(`Tool ${name} completed in ${duration}ms`);
|
|
1960
|
+
log.info(`═══════════════════════════════════════════════════`);
|
|
1961
|
+
|
|
1962
|
+
return result;
|
|
1885
1963
|
} catch (error) {
|
|
1886
|
-
|
|
1964
|
+
log.error(`Tool execution failed:`, error.message);
|
|
1965
|
+
log.error(`Stack trace:`, error.stack);
|
|
1887
1966
|
return {
|
|
1888
1967
|
content: [{
|
|
1889
1968
|
type: 'text',
|
|
@@ -1900,10 +1979,23 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
1900
1979
|
async function main() {
|
|
1901
1980
|
const transport = new StdioServerTransport();
|
|
1902
1981
|
await server.connect(transport);
|
|
1903
|
-
|
|
1982
|
+
|
|
1983
|
+
console.error(`\n${DEBUG_COLORS.bright}${DEBUG_COLORS.cyan}╔═══════════════════════════════════════════════════════╗${DEBUG_COLORS.reset}`);
|
|
1984
|
+
console.error(`${DEBUG_COLORS.bright}${DEBUG_COLORS.cyan}║${DEBUG_COLORS.reset} ${DEBUG_COLORS.bright}MLGym MCP Server v${CURRENT_VERSION}${DEBUG_COLORS.reset} ${DEBUG_COLORS.bright}${DEBUG_COLORS.cyan}║${DEBUG_COLORS.reset}`);
|
|
1985
|
+
console.error(`${DEBUG_COLORS.bright}${DEBUG_COLORS.cyan}╚═══════════════════════════════════════════════════════╝${DEBUG_COLORS.reset}`);
|
|
1986
|
+
console.error(`${DEBUG_COLORS.dim}Backend: ${CONFIG.backend_url}${DEBUG_COLORS.reset}`);
|
|
1987
|
+
console.error(`${DEBUG_COLORS.dim}Debug mode: ${DEBUG_ENABLED ? DEBUG_COLORS.green + 'ENABLED (default)' : DEBUG_COLORS.yellow + 'DISABLED'}${DEBUG_COLORS.reset}`);
|
|
1988
|
+
|
|
1989
|
+
if (!DEBUG_ENABLED) {
|
|
1990
|
+
console.error(`${DEBUG_COLORS.yellow}💡 Debug disabled. To re-enable: unset MLGYM_DEBUG${DEBUG_COLORS.reset}`);
|
|
1991
|
+
} else {
|
|
1992
|
+
console.error(`${DEBUG_COLORS.dim}💡 To disable debug: export MLGYM_DEBUG=false${DEBUG_COLORS.reset}`);
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1995
|
+
console.error(`${DEBUG_COLORS.green}✓ Server ready and waiting for requests...${DEBUG_COLORS.reset}\n`);
|
|
1904
1996
|
}
|
|
1905
1997
|
|
|
1906
1998
|
main().catch((error) => {
|
|
1907
|
-
|
|
1999
|
+
log.error('Server startup failed:', error);
|
|
1908
2000
|
process.exit(1);
|
|
1909
2001
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mlgym-deploy",
|
|
3
|
-
"version": "3.0.
|
|
4
|
-
"description": "MCP server for MLGym -
|
|
3
|
+
"version": "3.0.7",
|
|
4
|
+
"description": "MCP server for MLGym - Fixed Dockerfile generation path bug",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|