ls-mcp 1.3.0 → 1.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/bin/cli.cjs +29 -5
- package/dist/bin/cli.mjs +29 -5
- package/dist/main.cjs +29 -5
- package/dist/main.mjs +29 -5
- package/package.json +1 -1
- package/src/services/mcp-server-manager-service.ts +40 -7
package/dist/bin/cli.cjs
CHANGED
|
@@ -105,7 +105,7 @@ var MCPServerManagerService = class {
|
|
|
105
105
|
try {
|
|
106
106
|
let psOutput;
|
|
107
107
|
if ((0, import_node_os.platform)() === "win32") {
|
|
108
|
-
psOutput = (0, import_node_child_process.execSync)("
|
|
108
|
+
psOutput = (0, import_node_child_process.execSync)('powershell -Command "Get-CimInstance -ClassName Win32_Process | Select-Object ProcessId,Name,CommandLine,ParentProcessId | ConvertTo-Csv -NoTypeInformation"', {
|
|
109
109
|
encoding: "utf8",
|
|
110
110
|
timeout: 5e3
|
|
111
111
|
});
|
|
@@ -123,11 +123,12 @@ var MCPServerManagerService = class {
|
|
|
123
123
|
let ppid;
|
|
124
124
|
let commandLine;
|
|
125
125
|
if ((0, import_node_os.platform)() === "win32") {
|
|
126
|
-
|
|
126
|
+
if (processLine.startsWith('"ProcessId"') || processLine.startsWith("ProcessId")) continue;
|
|
127
|
+
const parts = this.parseCSVLine(processLine);
|
|
127
128
|
if (parts.length < 4) continue;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
pid = parts[0] || "";
|
|
130
|
+
commandLine = parts[2] || "";
|
|
131
|
+
ppid = parts[3] || "";
|
|
131
132
|
} else {
|
|
132
133
|
const match = processLine.trim().match(/^\s*(\d+)\s+(\d+)\s+(.+)$/);
|
|
133
134
|
if (!match) continue;
|
|
@@ -318,6 +319,29 @@ var MCPServerManagerService = class {
|
|
|
318
319
|
}
|
|
319
320
|
return false;
|
|
320
321
|
}
|
|
322
|
+
parseCSVLine(line) {
|
|
323
|
+
const result = [];
|
|
324
|
+
let current = "";
|
|
325
|
+
let inQuotes = false;
|
|
326
|
+
for (let i = 0; i < line.length; i++) {
|
|
327
|
+
const char = line[i];
|
|
328
|
+
if (char === '"') {
|
|
329
|
+
if (inQuotes && line[i + 1] === '"') {
|
|
330
|
+
current += '"';
|
|
331
|
+
i++;
|
|
332
|
+
} else {
|
|
333
|
+
inQuotes = !inQuotes;
|
|
334
|
+
}
|
|
335
|
+
} else if (char === "," && !inQuotes) {
|
|
336
|
+
result.push(current);
|
|
337
|
+
current = "";
|
|
338
|
+
} else {
|
|
339
|
+
current += char;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
result.push(current);
|
|
343
|
+
return result;
|
|
344
|
+
}
|
|
321
345
|
parseCommandLine(commandLine) {
|
|
322
346
|
const tokens = [];
|
|
323
347
|
let current = "";
|
package/dist/bin/cli.mjs
CHANGED
|
@@ -83,7 +83,7 @@ var MCPServerManagerService = class {
|
|
|
83
83
|
try {
|
|
84
84
|
let psOutput;
|
|
85
85
|
if (platform() === "win32") {
|
|
86
|
-
psOutput = execSync("
|
|
86
|
+
psOutput = execSync('powershell -Command "Get-CimInstance -ClassName Win32_Process | Select-Object ProcessId,Name,CommandLine,ParentProcessId | ConvertTo-Csv -NoTypeInformation"', {
|
|
87
87
|
encoding: "utf8",
|
|
88
88
|
timeout: 5e3
|
|
89
89
|
});
|
|
@@ -101,11 +101,12 @@ var MCPServerManagerService = class {
|
|
|
101
101
|
let ppid;
|
|
102
102
|
let commandLine;
|
|
103
103
|
if (platform() === "win32") {
|
|
104
|
-
|
|
104
|
+
if (processLine.startsWith('"ProcessId"') || processLine.startsWith("ProcessId")) continue;
|
|
105
|
+
const parts = this.parseCSVLine(processLine);
|
|
105
106
|
if (parts.length < 4) continue;
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
pid = parts[0] || "";
|
|
108
|
+
commandLine = parts[2] || "";
|
|
109
|
+
ppid = parts[3] || "";
|
|
109
110
|
} else {
|
|
110
111
|
const match = processLine.trim().match(/^\s*(\d+)\s+(\d+)\s+(.+)$/);
|
|
111
112
|
if (!match) continue;
|
|
@@ -296,6 +297,29 @@ var MCPServerManagerService = class {
|
|
|
296
297
|
}
|
|
297
298
|
return false;
|
|
298
299
|
}
|
|
300
|
+
parseCSVLine(line) {
|
|
301
|
+
const result = [];
|
|
302
|
+
let current = "";
|
|
303
|
+
let inQuotes = false;
|
|
304
|
+
for (let i = 0; i < line.length; i++) {
|
|
305
|
+
const char = line[i];
|
|
306
|
+
if (char === '"') {
|
|
307
|
+
if (inQuotes && line[i + 1] === '"') {
|
|
308
|
+
current += '"';
|
|
309
|
+
i++;
|
|
310
|
+
} else {
|
|
311
|
+
inQuotes = !inQuotes;
|
|
312
|
+
}
|
|
313
|
+
} else if (char === "," && !inQuotes) {
|
|
314
|
+
result.push(current);
|
|
315
|
+
current = "";
|
|
316
|
+
} else {
|
|
317
|
+
current += char;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
result.push(current);
|
|
321
|
+
return result;
|
|
322
|
+
}
|
|
299
323
|
parseCommandLine(commandLine) {
|
|
300
324
|
const tokens = [];
|
|
301
325
|
let current = "";
|
package/dist/main.cjs
CHANGED
|
@@ -114,7 +114,7 @@ var MCPServerManagerService = class {
|
|
|
114
114
|
try {
|
|
115
115
|
let psOutput;
|
|
116
116
|
if ((0, import_node_os.platform)() === "win32") {
|
|
117
|
-
psOutput = (0, import_node_child_process.execSync)("
|
|
117
|
+
psOutput = (0, import_node_child_process.execSync)('powershell -Command "Get-CimInstance -ClassName Win32_Process | Select-Object ProcessId,Name,CommandLine,ParentProcessId | ConvertTo-Csv -NoTypeInformation"', {
|
|
118
118
|
encoding: "utf8",
|
|
119
119
|
timeout: 5e3
|
|
120
120
|
});
|
|
@@ -132,11 +132,12 @@ var MCPServerManagerService = class {
|
|
|
132
132
|
let ppid;
|
|
133
133
|
let commandLine;
|
|
134
134
|
if ((0, import_node_os.platform)() === "win32") {
|
|
135
|
-
|
|
135
|
+
if (processLine.startsWith('"ProcessId"') || processLine.startsWith("ProcessId")) continue;
|
|
136
|
+
const parts = this.parseCSVLine(processLine);
|
|
136
137
|
if (parts.length < 4) continue;
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
pid = parts[0] || "";
|
|
139
|
+
commandLine = parts[2] || "";
|
|
140
|
+
ppid = parts[3] || "";
|
|
140
141
|
} else {
|
|
141
142
|
const match = processLine.trim().match(/^\s*(\d+)\s+(\d+)\s+(.+)$/);
|
|
142
143
|
if (!match) continue;
|
|
@@ -327,6 +328,29 @@ var MCPServerManagerService = class {
|
|
|
327
328
|
}
|
|
328
329
|
return false;
|
|
329
330
|
}
|
|
331
|
+
parseCSVLine(line) {
|
|
332
|
+
const result = [];
|
|
333
|
+
let current = "";
|
|
334
|
+
let inQuotes = false;
|
|
335
|
+
for (let i = 0; i < line.length; i++) {
|
|
336
|
+
const char = line[i];
|
|
337
|
+
if (char === '"') {
|
|
338
|
+
if (inQuotes && line[i + 1] === '"') {
|
|
339
|
+
current += '"';
|
|
340
|
+
i++;
|
|
341
|
+
} else {
|
|
342
|
+
inQuotes = !inQuotes;
|
|
343
|
+
}
|
|
344
|
+
} else if (char === "," && !inQuotes) {
|
|
345
|
+
result.push(current);
|
|
346
|
+
current = "";
|
|
347
|
+
} else {
|
|
348
|
+
current += char;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
result.push(current);
|
|
352
|
+
return result;
|
|
353
|
+
}
|
|
330
354
|
parseCommandLine(commandLine) {
|
|
331
355
|
const tokens = [];
|
|
332
356
|
let current = "";
|
package/dist/main.mjs
CHANGED
|
@@ -82,7 +82,7 @@ var MCPServerManagerService = class {
|
|
|
82
82
|
try {
|
|
83
83
|
let psOutput;
|
|
84
84
|
if (platform() === "win32") {
|
|
85
|
-
psOutput = execSync("
|
|
85
|
+
psOutput = execSync('powershell -Command "Get-CimInstance -ClassName Win32_Process | Select-Object ProcessId,Name,CommandLine,ParentProcessId | ConvertTo-Csv -NoTypeInformation"', {
|
|
86
86
|
encoding: "utf8",
|
|
87
87
|
timeout: 5e3
|
|
88
88
|
});
|
|
@@ -100,11 +100,12 @@ var MCPServerManagerService = class {
|
|
|
100
100
|
let ppid;
|
|
101
101
|
let commandLine;
|
|
102
102
|
if (platform() === "win32") {
|
|
103
|
-
|
|
103
|
+
if (processLine.startsWith('"ProcessId"') || processLine.startsWith("ProcessId")) continue;
|
|
104
|
+
const parts = this.parseCSVLine(processLine);
|
|
104
105
|
if (parts.length < 4) continue;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
pid = parts[0] || "";
|
|
107
|
+
commandLine = parts[2] || "";
|
|
108
|
+
ppid = parts[3] || "";
|
|
108
109
|
} else {
|
|
109
110
|
const match = processLine.trim().match(/^\s*(\d+)\s+(\d+)\s+(.+)$/);
|
|
110
111
|
if (!match) continue;
|
|
@@ -295,6 +296,29 @@ var MCPServerManagerService = class {
|
|
|
295
296
|
}
|
|
296
297
|
return false;
|
|
297
298
|
}
|
|
299
|
+
parseCSVLine(line) {
|
|
300
|
+
const result = [];
|
|
301
|
+
let current = "";
|
|
302
|
+
let inQuotes = false;
|
|
303
|
+
for (let i = 0; i < line.length; i++) {
|
|
304
|
+
const char = line[i];
|
|
305
|
+
if (char === '"') {
|
|
306
|
+
if (inQuotes && line[i + 1] === '"') {
|
|
307
|
+
current += '"';
|
|
308
|
+
i++;
|
|
309
|
+
} else {
|
|
310
|
+
inQuotes = !inQuotes;
|
|
311
|
+
}
|
|
312
|
+
} else if (char === "," && !inQuotes) {
|
|
313
|
+
result.push(current);
|
|
314
|
+
current = "";
|
|
315
|
+
} else {
|
|
316
|
+
current += char;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
result.push(current);
|
|
320
|
+
return result;
|
|
321
|
+
}
|
|
298
322
|
parseCommandLine(commandLine) {
|
|
299
323
|
const tokens = [];
|
|
300
324
|
let current = "";
|
package/package.json
CHANGED
|
@@ -59,8 +59,8 @@ export class MCPServerManagerService {
|
|
|
59
59
|
let psOutput: string
|
|
60
60
|
|
|
61
61
|
if (platform() === 'win32') {
|
|
62
|
-
// Windows: Use
|
|
63
|
-
psOutput = execSync('
|
|
62
|
+
// Windows: Use PowerShell Get-CimInstance to get process info
|
|
63
|
+
psOutput = execSync('powershell -Command "Get-CimInstance -ClassName Win32_Process | Select-Object ProcessId,Name,CommandLine,ParentProcessId | ConvertTo-Csv -NoTypeInformation"', {
|
|
64
64
|
encoding: 'utf8',
|
|
65
65
|
timeout: 5000
|
|
66
66
|
})
|
|
@@ -83,12 +83,16 @@ export class MCPServerManagerService {
|
|
|
83
83
|
let commandLine: string
|
|
84
84
|
|
|
85
85
|
if (platform() === 'win32') {
|
|
86
|
-
// Parse Windows CSV format:
|
|
87
|
-
|
|
86
|
+
// Parse Windows CSV format: ProcessId,Name,CommandLine,ParentProcessId
|
|
87
|
+
// Skip header line
|
|
88
|
+
if (processLine.startsWith('"ProcessId"') || processLine.startsWith('ProcessId')) continue
|
|
89
|
+
|
|
90
|
+
const parts = this.parseCSVLine(processLine)
|
|
88
91
|
if (parts.length < 4) continue
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
+
pid = parts[0] || ''
|
|
93
|
+
// Skip Name (parts[1])
|
|
94
|
+
commandLine = parts[2] || ''
|
|
95
|
+
ppid = parts[3] || ''
|
|
92
96
|
} else {
|
|
93
97
|
// Parse Unix ps output: PID PPID COMMAND
|
|
94
98
|
const match = processLine.trim().match(/^\s*(\d+)\s+(\d+)\s+(.+)$/)
|
|
@@ -367,6 +371,35 @@ export class MCPServerManagerService {
|
|
|
367
371
|
return false
|
|
368
372
|
}
|
|
369
373
|
|
|
374
|
+
private parseCSVLine (line: string): string[] {
|
|
375
|
+
const result: string[] = []
|
|
376
|
+
let current = ''
|
|
377
|
+
let inQuotes = false
|
|
378
|
+
|
|
379
|
+
for (let i = 0; i < line.length; i++) {
|
|
380
|
+
const char = line[i]
|
|
381
|
+
|
|
382
|
+
if (char === '"') {
|
|
383
|
+
if (inQuotes && line[i + 1] === '"') {
|
|
384
|
+
// Escaped quote
|
|
385
|
+
current += '"'
|
|
386
|
+
i++ // Skip next quote
|
|
387
|
+
} else {
|
|
388
|
+
// Toggle quote state
|
|
389
|
+
inQuotes = !inQuotes
|
|
390
|
+
}
|
|
391
|
+
} else if (char === ',' && !inQuotes) {
|
|
392
|
+
result.push(current)
|
|
393
|
+
current = ''
|
|
394
|
+
} else {
|
|
395
|
+
current += char
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
result.push(current)
|
|
400
|
+
return result
|
|
401
|
+
}
|
|
402
|
+
|
|
370
403
|
private parseCommandLine (commandLine: string): string[] {
|
|
371
404
|
const tokens: string[] = []
|
|
372
405
|
let current = ''
|