Skip to content

Commit b543447

Browse files
authored
Merge pull request #168 from QuantGeekDev/fix/cli-name-collision-53
fix: add mcp-framework CLI alias and PATH conflict detection
2 parents 81b8a85 + 2c5a1ca commit b543447

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
],
1818
"bin": {
1919
"mcp": "dist/cli/index.js",
20+
"mcp-framework": "dist/cli/index.js",
2021
"mcp-build": "dist/cli/framework/build-cli.js"
2122
},
2223
"scripts": {

src/cli/index.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env node
22
import { createRequire } from 'module';
3+
import { execSync } from 'child_process';
34
import { Command } from 'commander';
45
import { createProject } from './project/create.js';
56
import { addTool } from './project/add-tool.js';
@@ -9,6 +10,31 @@ import { addApp } from './project/add-app.js';
910
import { buildFramework } from './framework/build.js';
1011
import { validateCommand } from './commands/validate.js';
1112

13+
function checkForMcpConflict(): void {
14+
try {
15+
const isWindows = process.platform === 'win32';
16+
const cmd = isWindows ? 'where mcp' : 'which -a mcp';
17+
const result = execSync(cmd, { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] });
18+
const paths = result.trim().split(/\r?\n/).filter(Boolean);
19+
if (paths.length > 1) {
20+
console.warn(
21+
'\x1b[33m⚠ Warning: Multiple "mcp" executables found on your PATH:\x1b[0m'
22+
);
23+
for (const p of paths) {
24+
console.warn(` - ${p}`);
25+
}
26+
console.warn(
27+
'\x1b[33mIf you experience unexpected behavior (e.g., from a Python mcp package),\n' +
28+
'use \x1b[1mmcp-framework\x1b[0m\x1b[33m instead. For example: mcp-framework create my-project\x1b[0m\n'
29+
);
30+
}
31+
} catch {
32+
// Silently ignore — `which`/`where` may not be available
33+
}
34+
}
35+
36+
checkForMcpConflict();
37+
1238
const require = createRequire(import.meta.url);
1339
const frameworkPackageJson = require('../../package.json');
1440

0 commit comments

Comments
 (0)