imcp 0.0.8 → 0.0.9

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/README.md CHANGED
@@ -11,7 +11,12 @@ IMCP allows you to:
11
11
  - (in progress) Distribute your own MCP servers to others
12
12
 
13
13
  ## Installation
14
+ - Quick usage with latest version
15
+ ```
16
+ npx -y imcp@latest serve
17
+ ```
14
18
 
19
+ - Or install it globally
15
20
  ```bash
16
21
  npm install -g imcp
17
22
  ```
@@ -45,38 +45,52 @@ export class ClientInstaller {
45
45
  */
46
46
  async isCommandAvailable(command) {
47
47
  try {
48
- if (process.platform === 'win32') {
49
- // Windows-specific command check
50
- await execAsync(`where ${command}`);
51
- }
52
- else if (process.platform === 'darwin' && (command === 'code' || command === 'code-insiders')) {
53
- // macOS-specific VS Code check
54
- const vscodePath = command === 'code' ?
55
- '/Applications/Visual Studio Code.app' :
56
- '/Applications/Visual Studio Code - Insiders.app';
57
- await execAsync(`test -d "${vscodePath}"`);
58
- }
59
- else {
60
- // Unix-like systems
61
- await execAsync(`which ${command}`);
62
- }
63
- return true;
64
- }
65
- catch (error) {
48
+ // For VS Code on macOS, check both command-line tool and app bundle
66
49
  if (process.platform === 'darwin' && (command === 'code' || command === 'code-insiders')) {
67
- // Try checking in ~/Applications as well for macOS
68
50
  try {
69
- const homedir = process.env.HOME;
70
- const vscodePath = command === 'code' ?
71
- `${homedir}/Applications/Visual Studio Code.app` :
72
- `${homedir}/Applications/Visual Studio Code - Insiders.app`;
73
- await execAsync(`test -d "${vscodePath}"`);
51
+ // Try which command first
52
+ await execAsync(`which ${command}`);
74
53
  return true;
75
54
  }
76
55
  catch (error) {
77
- return false;
56
+ // If which fails, check application bundles
57
+ const systemVSCodePath = command === 'code' ?
58
+ '/Applications/Visual Studio Code.app' :
59
+ '/Applications/Visual Studio Code - Insiders.app';
60
+ try {
61
+ // Check system Applications first
62
+ await execAsync(`test -d "${systemVSCodePath}"`);
63
+ return true;
64
+ }
65
+ catch (error) {
66
+ // If system Applications check fails, try user Applications
67
+ const homedir = process.env.HOME;
68
+ if (homedir) {
69
+ const userVSCodePath = command === 'code' ?
70
+ `${homedir}/Applications/Visual Studio Code.app` :
71
+ `${homedir}/Applications/Visual Studio Code - Insiders.app`;
72
+ try {
73
+ await execAsync(`test -d "${userVSCodePath}"`);
74
+ return true;
75
+ }
76
+ catch (error) {
77
+ return false;
78
+ }
79
+ }
80
+ return false;
81
+ }
78
82
  }
79
83
  }
84
+ // For Windows, use where command
85
+ if (process.platform === 'win32') {
86
+ await execAsync(`where ${command}`);
87
+ return true;
88
+ }
89
+ // For all other cases (Unix-like systems), use which command
90
+ await execAsync(`which ${command}`);
91
+ return true;
92
+ }
93
+ catch (error) {
80
94
  return false;
81
95
  }
82
96
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imcp",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "Node.js SDK for Model Context Protocol (MCP)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -60,34 +60,52 @@ export class ClientInstaller {
60
60
  */
61
61
  private async isCommandAvailable(command: string): Promise<boolean> {
62
62
  try {
63
- if (process.platform === 'win32') {
64
- // Windows-specific command check
65
- await execAsync(`where ${command}`);
66
- } else if (process.platform === 'darwin' && (command === 'code' || command === 'code-insiders')) {
67
- // macOS-specific VS Code check
68
- const vscodePath = command === 'code' ?
69
- '/Applications/Visual Studio Code.app' :
70
- '/Applications/Visual Studio Code - Insiders.app';
71
- await execAsync(`test -d "${vscodePath}"`);
72
- } else {
73
- // Unix-like systems
74
- await execAsync(`which ${command}`);
75
- }
76
- return true;
77
- } catch (error) {
63
+ // For VS Code on macOS, check both command-line tool and app bundle
78
64
  if (process.platform === 'darwin' && (command === 'code' || command === 'code-insiders')) {
79
- // Try checking in ~/Applications as well for macOS
80
65
  try {
81
- const homedir = process.env.HOME;
82
- const vscodePath = command === 'code' ?
83
- `${homedir}/Applications/Visual Studio Code.app` :
84
- `${homedir}/Applications/Visual Studio Code - Insiders.app`;
85
- await execAsync(`test -d "${vscodePath}"`);
66
+ // Try which command first
67
+ await execAsync(`which ${command}`);
86
68
  return true;
87
69
  } catch (error) {
88
- return false;
70
+ // If which fails, check application bundles
71
+ const systemVSCodePath = command === 'code' ?
72
+ '/Applications/Visual Studio Code.app' :
73
+ '/Applications/Visual Studio Code - Insiders.app';
74
+
75
+ try {
76
+ // Check system Applications first
77
+ await execAsync(`test -d "${systemVSCodePath}"`);
78
+ return true;
79
+ } catch (error) {
80
+ // If system Applications check fails, try user Applications
81
+ const homedir = process.env.HOME;
82
+ if (homedir) {
83
+ const userVSCodePath = command === 'code' ?
84
+ `${homedir}/Applications/Visual Studio Code.app` :
85
+ `${homedir}/Applications/Visual Studio Code - Insiders.app`;
86
+
87
+ try {
88
+ await execAsync(`test -d "${userVSCodePath}"`);
89
+ return true;
90
+ } catch (error) {
91
+ return false;
92
+ }
93
+ }
94
+ return false;
95
+ }
89
96
  }
90
97
  }
98
+
99
+ // For Windows, use where command
100
+ if (process.platform === 'win32') {
101
+ await execAsync(`where ${command}`);
102
+ return true;
103
+ }
104
+
105
+ // For all other cases (Unix-like systems), use which command
106
+ await execAsync(`which ${command}`);
107
+ return true;
108
+ } catch (error) {
91
109
  return false;
92
110
  }
93
111
  }