11#!/usr/bin/env node
22import { createRequire } from 'module' ;
3+ import { execSync } from 'child_process' ;
34import { Command } from 'commander' ;
45import { createProject } from './project/create.js' ;
56import { addTool } from './project/add-tool.js' ;
@@ -9,6 +10,31 @@ import { addApp } from './project/add-app.js';
910import { buildFramework } from './framework/build.js' ;
1011import { 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+
1238const require = createRequire ( import . meta. url ) ;
1339const frameworkPackageJson = require ( '../../package.json' ) ;
1440
0 commit comments