voice-mcp-server 0.1.1 → 0.1.2

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 CHANGED
@@ -13,6 +13,18 @@ const pythonScriptPath = join(projectRoot, "src", "mcp_server.py");
13
13
  const venvPath = join(projectRoot, "venv");
14
14
  const venvPythonPath = join(venvPath, "bin", "python3");
15
15
  const requirementsPath = join(projectRoot, "requirements.txt");
16
+ /**
17
+ * Strips npm/npx specific environment variables that can break Python virtual environments.
18
+ */
19
+ function cleanEnv() {
20
+ const env = { ...process.env, PYTHONUNBUFFERED: "1" };
21
+ for (const key in env) {
22
+ if (key.toLowerCase().startsWith("npm_")) {
23
+ delete env[key];
24
+ }
25
+ }
26
+ return env;
27
+ }
16
28
  /**
17
29
  * Ensures the Python virtual environment exists and dependencies are installed.
18
30
  */
@@ -22,7 +34,8 @@ function ensurePythonEnvironment() {
22
34
  // Create the virtual environment
23
35
  const venvResult = spawnSync("python3", ["-m", "venv", "venv"], {
24
36
  cwd: projectRoot,
25
- stdio: "inherit"
37
+ stdio: "inherit",
38
+ env: cleanEnv()
26
39
  });
27
40
  if (venvResult.status !== 0) {
28
41
  console.error("Voice MCP: Failed to create Python virtual environment.");
@@ -32,7 +45,8 @@ function ensurePythonEnvironment() {
32
45
  // Install requirements
33
46
  const pipResult = spawnSync(venvPythonPath, ["-m", "pip", "install", "-r", requirementsPath], {
34
47
  cwd: projectRoot,
35
- stdio: "inherit"
48
+ stdio: "inherit",
49
+ env: cleanEnv()
36
50
  });
37
51
  if (pipResult.status !== 0) {
38
52
  console.error("Voice MCP: Failed to install Python dependencies.");
@@ -48,11 +62,7 @@ function startBridge() {
48
62
  ensurePythonEnvironment();
49
63
  const pythonProcess = spawn(venvPythonPath, [pythonScriptPath], {
50
64
  stdio: ["pipe", "pipe", "inherit"],
51
- env: {
52
- ...process.env,
53
- // Ensure Python output isn't buffered
54
- PYTHONUNBUFFERED: "1",
55
- },
65
+ env: cleanEnv()
56
66
  });
57
67
  // Pipe our stdin into Python's stdin
58
68
  process.stdin.pipe(pythonProcess.stdin);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "voice-mcp-server",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "An MCP server to allow LLMs to speak and listen via bidirectional voice loops",
5
5
  "main": "build/index.js",
6
6
  "type": "module",
package/src/index.ts CHANGED
@@ -18,6 +18,19 @@ const venvPath = join(projectRoot, "venv");
18
18
  const venvPythonPath = join(venvPath, "bin", "python3");
19
19
  const requirementsPath = join(projectRoot, "requirements.txt");
20
20
 
21
+ /**
22
+ * Strips npm/npx specific environment variables that can break Python virtual environments.
23
+ */
24
+ function cleanEnv(): NodeJS.ProcessEnv {
25
+ const env: Record<string, string | undefined> = { ...process.env, PYTHONUNBUFFERED: "1" };
26
+ for (const key in env) {
27
+ if (key.toLowerCase().startsWith("npm_")) {
28
+ delete env[key];
29
+ }
30
+ }
31
+ return env as NodeJS.ProcessEnv;
32
+ }
33
+
21
34
  /**
22
35
  * Ensures the Python virtual environment exists and dependencies are installed.
23
36
  */
@@ -28,7 +41,8 @@ function ensurePythonEnvironment() {
28
41
  // Create the virtual environment
29
42
  const venvResult = spawnSync("python3", ["-m", "venv", "venv"], {
30
43
  cwd: projectRoot,
31
- stdio: "inherit"
44
+ stdio: "inherit",
45
+ env: cleanEnv()
32
46
  });
33
47
 
34
48
  if (venvResult.status !== 0) {
@@ -41,7 +55,8 @@ function ensurePythonEnvironment() {
41
55
  // Install requirements
42
56
  const pipResult = spawnSync(venvPythonPath, ["-m", "pip", "install", "-r", requirementsPath], {
43
57
  cwd: projectRoot,
44
- stdio: "inherit"
58
+ stdio: "inherit",
59
+ env: cleanEnv()
45
60
  });
46
61
 
47
62
  if (pipResult.status !== 0) {
@@ -61,11 +76,7 @@ function startBridge() {
61
76
 
62
77
  const pythonProcess = spawn(venvPythonPath, [pythonScriptPath], {
63
78
  stdio: ["pipe", "pipe", "inherit"],
64
- env: {
65
- ...process.env,
66
- // Ensure Python output isn't buffered
67
- PYTHONUNBUFFERED: "1",
68
- },
79
+ env: cleanEnv()
69
80
  });
70
81
 
71
82
  // Pipe our stdin into Python's stdin