voice-mcp-server 0.1.14 → 0.1.16
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/build/index.js +10 -5
- package/package.json +1 -1
- package/src/index.ts +12 -5
- package/src/mcp_server.py +1 -1
package/build/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { spawn, spawnSync } from "node:child_process";
|
|
3
3
|
import { join, dirname } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { existsSync, mkdirSync } from "node:fs";
|
|
5
|
+
import { existsSync, mkdirSync, writeFileSync, openSync, closeSync } from "node:fs";
|
|
6
6
|
import { homedir } from "node:os";
|
|
7
7
|
// Get the directory of the current module
|
|
8
8
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -16,6 +16,8 @@ const appSupportDir = join(homedir(), "Library", "Application Support", "VoiceMC
|
|
|
16
16
|
const venvPath = join(appSupportDir, "venv");
|
|
17
17
|
const venvPythonPath = join(venvPath, "bin", "python3");
|
|
18
18
|
const requirementsPath = join(projectRoot, "requirements.txt");
|
|
19
|
+
const setupMarker = join(venvPath, ".setup_complete");
|
|
20
|
+
const setupLogPath = join(appSupportDir, "setup.log");
|
|
19
21
|
/**
|
|
20
22
|
* Strips npm/npx specific environment variables that can break Python virtual environments.
|
|
21
23
|
*/
|
|
@@ -32,7 +34,7 @@ function cleanEnv() {
|
|
|
32
34
|
* Ensures the Python virtual environment exists and dependencies are installed.
|
|
33
35
|
*/
|
|
34
36
|
function ensurePythonEnvironment() {
|
|
35
|
-
if (!existsSync(
|
|
37
|
+
if (!existsSync(setupMarker)) {
|
|
36
38
|
console.error("Voice MCP: Initializing Python virtual environment. This may take a minute...");
|
|
37
39
|
// Ensure Application Support directory exists
|
|
38
40
|
if (!existsSync(appSupportDir)) {
|
|
@@ -48,17 +50,20 @@ function ensurePythonEnvironment() {
|
|
|
48
50
|
console.error("Voice MCP: Failed to create Python virtual environment.");
|
|
49
51
|
process.exit(1);
|
|
50
52
|
}
|
|
51
|
-
console.error(
|
|
53
|
+
console.error(`Voice MCP: Installing ML dependencies. This can take several minutes. Log: ${setupLogPath}`);
|
|
54
|
+
const outFd = openSync(setupLogPath, "w");
|
|
52
55
|
// Install requirements
|
|
53
56
|
const pipResult = spawnSync(venvPythonPath, ["-m", "pip", "install", "-r", requirementsPath], {
|
|
54
57
|
cwd: projectRoot,
|
|
55
|
-
stdio: "ignore",
|
|
58
|
+
stdio: ["ignore", outFd, outFd],
|
|
56
59
|
env: cleanEnv()
|
|
57
60
|
});
|
|
61
|
+
closeSync(outFd);
|
|
58
62
|
if (pipResult.status !== 0) {
|
|
59
|
-
console.error(
|
|
63
|
+
console.error(`Voice MCP: Failed to install Python dependencies. Please check the log at ${setupLogPath}`);
|
|
60
64
|
process.exit(1);
|
|
61
65
|
}
|
|
66
|
+
writeFileSync(setupMarker, "done");
|
|
62
67
|
console.error("Voice MCP: Environment setup complete!");
|
|
63
68
|
}
|
|
64
69
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { spawn, spawnSync } from "node:child_process";
|
|
4
4
|
import { join, dirname } from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
|
-
import { existsSync, mkdirSync } from "node:fs";
|
|
6
|
+
import { existsSync, mkdirSync, writeFileSync, openSync, closeSync } from "node:fs";
|
|
7
7
|
import { homedir } from "node:os";
|
|
8
8
|
|
|
9
9
|
// Get the directory of the current module
|
|
@@ -21,6 +21,8 @@ const appSupportDir = join(homedir(), "Library", "Application Support", "VoiceMC
|
|
|
21
21
|
const venvPath = join(appSupportDir, "venv");
|
|
22
22
|
const venvPythonPath = join(venvPath, "bin", "python3");
|
|
23
23
|
const requirementsPath = join(projectRoot, "requirements.txt");
|
|
24
|
+
const setupMarker = join(venvPath, ".setup_complete");
|
|
25
|
+
const setupLogPath = join(appSupportDir, "setup.log");
|
|
24
26
|
|
|
25
27
|
/**
|
|
26
28
|
* Strips npm/npx specific environment variables that can break Python virtual environments.
|
|
@@ -39,7 +41,7 @@ function cleanEnv(): NodeJS.ProcessEnv {
|
|
|
39
41
|
* Ensures the Python virtual environment exists and dependencies are installed.
|
|
40
42
|
*/
|
|
41
43
|
function ensurePythonEnvironment() {
|
|
42
|
-
if (!existsSync(
|
|
44
|
+
if (!existsSync(setupMarker)) {
|
|
43
45
|
console.error("Voice MCP: Initializing Python virtual environment. This may take a minute...");
|
|
44
46
|
|
|
45
47
|
// Ensure Application Support directory exists
|
|
@@ -59,20 +61,25 @@ function ensurePythonEnvironment() {
|
|
|
59
61
|
process.exit(1);
|
|
60
62
|
}
|
|
61
63
|
|
|
62
|
-
console.error(
|
|
64
|
+
console.error(`Voice MCP: Installing ML dependencies. This can take several minutes. Log: ${setupLogPath}`);
|
|
63
65
|
|
|
66
|
+
const outFd = openSync(setupLogPath, "w");
|
|
67
|
+
|
|
64
68
|
// Install requirements
|
|
65
69
|
const pipResult = spawnSync(venvPythonPath, ["-m", "pip", "install", "-r", requirementsPath], {
|
|
66
70
|
cwd: projectRoot,
|
|
67
|
-
stdio: "ignore",
|
|
71
|
+
stdio: ["ignore", outFd, outFd],
|
|
68
72
|
env: cleanEnv()
|
|
69
73
|
});
|
|
70
74
|
|
|
75
|
+
closeSync(outFd);
|
|
76
|
+
|
|
71
77
|
if (pipResult.status !== 0) {
|
|
72
|
-
console.error(
|
|
78
|
+
console.error(`Voice MCP: Failed to install Python dependencies. Please check the log at ${setupLogPath}`);
|
|
73
79
|
process.exit(1);
|
|
74
80
|
}
|
|
75
81
|
|
|
82
|
+
writeFileSync(setupMarker, "done");
|
|
76
83
|
console.error("Voice MCP: Environment setup complete!");
|
|
77
84
|
}
|
|
78
85
|
}
|
package/src/mcp_server.py
CHANGED
|
@@ -84,7 +84,7 @@ def ensure_daemon_running():
|
|
|
84
84
|
logging.info("Daemon is down, attempting to boot detached process...")
|
|
85
85
|
# Boot the daemon detached
|
|
86
86
|
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
|
|
87
|
-
python_exec = os.path.join(
|
|
87
|
+
python_exec = os.path.join(app_support_dir, "venv", "bin", "python3")
|
|
88
88
|
daemon_script = os.path.join(project_root, "src", "daemon", "audio_server.py")
|
|
89
89
|
|
|
90
90
|
subprocess.Popen(
|