deveco-mcp-server 0.1.4
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.
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/index.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
|
|
7
|
+
const serverExePath = getServerPath();
|
|
8
|
+
const toolboxExePath = getToolboxPath();
|
|
9
|
+
|
|
10
|
+
function getServerPath() {
|
|
11
|
+
if (process.platform === 'win32') {
|
|
12
|
+
return path.join(__dirname, 'bin', 'win32', 'deveco-mcp-server.exe');
|
|
13
|
+
} else if (process.platform === 'darwin') {
|
|
14
|
+
return path.join(__dirname, 'bin', 'darwin', 'deveco-mcp-server');
|
|
15
|
+
}
|
|
16
|
+
throw new Error(`Unsupported platform: ${process.platform}`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function getToolboxPath() {
|
|
20
|
+
if (process.platform === 'win32') {
|
|
21
|
+
return path.join(__dirname, 'bin', 'win32', 'deveco-toolbox.exe');
|
|
22
|
+
} else if (process.platform === 'darwin') {
|
|
23
|
+
return path.join(__dirname, 'bin', 'darwin', 'DevEco Toolbox.app', 'Contents', 'MacOS', 'deveco-toolbox');
|
|
24
|
+
}
|
|
25
|
+
return '';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!fs.existsSync(serverExePath)) {
|
|
29
|
+
console.error(`Error: Server executable not found at ${serverExePath}`);
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Ensure execution permissions on Unix-like systems (macOS/Linux)
|
|
34
|
+
if (process.platform !== 'win32') {
|
|
35
|
+
try {
|
|
36
|
+
fs.chmodSync(serverExePath, 0o755);
|
|
37
|
+
} catch (err) {
|
|
38
|
+
console.warn(`Warning: Failed to set executable permissions for ${serverExePath}: ${err.message}`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
const args = process.argv.slice(2);
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
const env = {
|
|
48
|
+
...process.env,
|
|
49
|
+
DEVECO_TOOLBOX_PATH: toolboxExePath
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const child = spawn(serverExePath, args, {
|
|
53
|
+
stdio: 'inherit',
|
|
54
|
+
env: env
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
child.on('error', (err) => {
|
|
58
|
+
console.error('Failed to start deveco-mcp-server:', err);
|
|
59
|
+
process.exit(1);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
child.on('close', (code) => {
|
|
63
|
+
process.exit(code);
|
|
64
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "deveco-mcp-server",
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "NPM wrapper for deveco-mcp-server",
|
|
5
|
+
"files": [
|
|
6
|
+
"bin",
|
|
7
|
+
"index.js"
|
|
8
|
+
],
|
|
9
|
+
"bin": {
|
|
10
|
+
"deveco-mcp-server": "index.js"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
14
|
+
},
|
|
15
|
+
"os": [
|
|
16
|
+
"win32",
|
|
17
|
+
"darwin"
|
|
18
|
+
],
|
|
19
|
+
"cpu": [
|
|
20
|
+
"x64",
|
|
21
|
+
"arm64"
|
|
22
|
+
],
|
|
23
|
+
"author": "",
|
|
24
|
+
"license": "ISC"
|
|
25
|
+
}
|