voice-mcp-server 0.1.13 → 0.1.14
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 -3
- package/package.json +1 -1
- package/src/index.ts +12 -3
package/build/index.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
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 } from "node:fs";
|
|
5
|
+
import { existsSync, mkdirSync } from "node:fs";
|
|
6
|
+
import { homedir } from "node:os";
|
|
6
7
|
// Get the directory of the current module
|
|
7
8
|
const __filename = fileURLToPath(import.meta.url);
|
|
8
9
|
const __dirname = dirname(__filename);
|
|
@@ -10,7 +11,9 @@ const __dirname = dirname(__filename);
|
|
|
10
11
|
const projectRoot = join(__dirname, "..");
|
|
11
12
|
// Path to the Python script
|
|
12
13
|
const pythonScriptPath = join(projectRoot, "src", "mcp_server.py");
|
|
13
|
-
|
|
14
|
+
// Store the virtual environment in the user's App Support directory to avoid EACCES permission errors
|
|
15
|
+
const appSupportDir = join(homedir(), "Library", "Application Support", "VoiceMCP");
|
|
16
|
+
const venvPath = join(appSupportDir, "venv");
|
|
14
17
|
const venvPythonPath = join(venvPath, "bin", "python3");
|
|
15
18
|
const requirementsPath = join(projectRoot, "requirements.txt");
|
|
16
19
|
/**
|
|
@@ -31,8 +34,12 @@ function cleanEnv() {
|
|
|
31
34
|
function ensurePythonEnvironment() {
|
|
32
35
|
if (!existsSync(venvPath)) {
|
|
33
36
|
console.error("Voice MCP: Initializing Python virtual environment. This may take a minute...");
|
|
37
|
+
// Ensure Application Support directory exists
|
|
38
|
+
if (!existsSync(appSupportDir)) {
|
|
39
|
+
mkdirSync(appSupportDir, { recursive: true });
|
|
40
|
+
}
|
|
34
41
|
// Create the virtual environment
|
|
35
|
-
const venvResult = spawnSync("python3", ["-m", "venv",
|
|
42
|
+
const venvResult = spawnSync("python3", ["-m", "venv", venvPath], {
|
|
36
43
|
cwd: projectRoot,
|
|
37
44
|
stdio: "ignore",
|
|
38
45
|
env: cleanEnv()
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
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 } from "node:fs";
|
|
6
|
+
import { existsSync, mkdirSync } from "node:fs";
|
|
7
|
+
import { homedir } from "node:os";
|
|
7
8
|
|
|
8
9
|
// Get the directory of the current module
|
|
9
10
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -14,7 +15,10 @@ const projectRoot = join(__dirname, "..");
|
|
|
14
15
|
|
|
15
16
|
// Path to the Python script
|
|
16
17
|
const pythonScriptPath = join(projectRoot, "src", "mcp_server.py");
|
|
17
|
-
|
|
18
|
+
|
|
19
|
+
// Store the virtual environment in the user's App Support directory to avoid EACCES permission errors
|
|
20
|
+
const appSupportDir = join(homedir(), "Library", "Application Support", "VoiceMCP");
|
|
21
|
+
const venvPath = join(appSupportDir, "venv");
|
|
18
22
|
const venvPythonPath = join(venvPath, "bin", "python3");
|
|
19
23
|
const requirementsPath = join(projectRoot, "requirements.txt");
|
|
20
24
|
|
|
@@ -38,8 +42,13 @@ function ensurePythonEnvironment() {
|
|
|
38
42
|
if (!existsSync(venvPath)) {
|
|
39
43
|
console.error("Voice MCP: Initializing Python virtual environment. This may take a minute...");
|
|
40
44
|
|
|
45
|
+
// Ensure Application Support directory exists
|
|
46
|
+
if (!existsSync(appSupportDir)) {
|
|
47
|
+
mkdirSync(appSupportDir, { recursive: true });
|
|
48
|
+
}
|
|
49
|
+
|
|
41
50
|
// Create the virtual environment
|
|
42
|
-
const venvResult = spawnSync("python3", ["-m", "venv",
|
|
51
|
+
const venvResult = spawnSync("python3", ["-m", "venv", venvPath], {
|
|
43
52
|
cwd: projectRoot,
|
|
44
53
|
stdio: "ignore",
|
|
45
54
|
env: cleanEnv()
|