Skip to content

Commit d389d45

Browse files
ktnytclaude
andcommitted
🐛 Fix MCP command argument order for Claude CLI integration
- Move command and arguments before options to match Claude CLI format - Ensure npx cclsp@latest is passed as complete command - Fix argument ordering for both Windows and Unix platforms - Update tests to reflect correct command structure 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 3cb3785 commit d389d45

File tree

3 files changed

+13
-20
lines changed

3 files changed

+13
-20
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cclsp",
3-
"version": "0.5.10",
3+
"version": "0.5.11",
44
"description": "MCP server for accessing LSP functionality",
55
"main": "dist/index.js",
66
"bin": {

src/setup.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -428,11 +428,11 @@ describe('Windows platform support', () => {
428428
'add',
429429
'cclsp',
430430
'cmd',
431-
'--env',
432-
`CCLSP_CONFIG_PATH=${absoluteConfigPath}`,
433431
'/c',
434432
'npx',
435433
'cclsp@latest',
434+
'--env',
435+
`CCLSP_CONFIG_PATH=${absoluteConfigPath}`,
436436
]);
437437
});
438438

@@ -447,9 +447,9 @@ describe('Windows platform support', () => {
447447
'add',
448448
'cclsp',
449449
'npx',
450+
'cclsp@latest',
450451
'--env',
451452
`CCLSP_CONFIG_PATH=${absoluteConfigPath}`,
452-
'cclsp@latest',
453453
]);
454454

455455
// Test Linux platform (no quotes)
@@ -459,9 +459,9 @@ describe('Windows platform support', () => {
459459
'add',
460460
'cclsp',
461461
'npx',
462+
'cclsp@latest',
462463
'--env',
463464
`CCLSP_CONFIG_PATH=${absoluteConfigPath}`,
464-
'cclsp@latest',
465465
]);
466466
});
467467

@@ -475,13 +475,13 @@ describe('Windows platform support', () => {
475475
'add',
476476
'cclsp',
477477
'cmd',
478+
'/c',
479+
'npx',
480+
'cclsp@latest',
478481
'--scope',
479482
'user',
480483
'--env',
481484
`CCLSP_CONFIG_PATH=${absoluteConfigPath}`,
482-
'/c',
483-
'npx',
484-
'cclsp@latest',
485485
]);
486486

487487
// Test macOS with user scope (no quotes)
@@ -491,11 +491,11 @@ describe('Windows platform support', () => {
491491
'add',
492492
'cclsp',
493493
'npx',
494+
'cclsp@latest',
494495
'--scope',
495496
'user',
496497
'--env',
497498
`CCLSP_CONFIG_PATH=${absoluteConfigPath}`,
498-
'cclsp@latest',
499499
]);
500500
});
501501

src/setup.ts

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -284,14 +284,14 @@ export function buildMCPArgs(
284284
// Add the server name first
285285
mcpArgs.push('cclsp');
286286

287-
// Add the command second
287+
// Add the full command and its arguments
288288
if (isWindows) {
289-
mcpArgs.push('cmd');
289+
mcpArgs.push('cmd', '/c', 'npx', 'cclsp@latest');
290290
} else {
291-
mcpArgs.push('npx');
291+
mcpArgs.push('npx', 'cclsp@latest');
292292
}
293293

294-
// Add options last
294+
// Add options after the command
295295
if (isUser) {
296296
mcpArgs.push('--scope', 'user');
297297
}
@@ -306,13 +306,6 @@ export function buildMCPArgs(
306306
: absoluteConfigPath;
307307
mcpArgs.push('--env', `CCLSP_CONFIG_PATH=${quotedPath}`);
308308

309-
// Add remaining command args
310-
if (isWindows) {
311-
mcpArgs.push('/c', 'npx', 'cclsp@latest');
312-
} else {
313-
mcpArgs.push('cclsp@latest');
314-
}
315-
316309
return mcpArgs;
317310
}
318311

0 commit comments

Comments
 (0)