continuedev/continue

After using the official node installation, the mac configuration mcp cannot be used

Closed this issue ยท 6 comments

Before submitting your bug report

Relevant environment info

- OS:macOS
- Continue version:1.3.11
- IDE version:VSCode 1.104.0
- Node:v22.19.0
- config:
  
name: Memory MCP server
version: 0.0.1
schema: v1
mcpServers:
  - name: Memory MCP server
    command: npx
    args:
      - -y
      - "@modelcontextprotocol/server-memory"

Description

Node was installed using the official nvm method: https://nodejs.org/zh-cn/download

After configuring the MCP file, it can be started from the shell, and the service can also be used from a remote URL.

Only the npx method fails to start, and the error message appears:

Failed to connect to "Memory MCP server"
Error: spawn ENAMETOOLONG

I run npx normally in the local command line:

>npx -v
10.9.3
Image

To reproduce

No response

Log output

Opening the VSCode console, I see the following error:

console.ts:137 [Extension Host] Failed to fetch MCP prompt content for write_custom_semgrep_rule from server Semgrep MCP: McpError: MCP error 0: Missing required arguments: {'code', 'language'}
	at Client2._onresponse (/Users/666/.vscode/extensions/continue.continue-1.3.11/out/extension.js:259662:26)
	at _transport.onmessage (/Users/666/.vscode/extensions/continue.continue-1.3.11/out/extension.js:259542:18)
	at StreamableHTTPClientTransport.send (/Users/666/.vscode/extensions/continue.continue-1.3.11/out/extension.js:267370:79)
	at process.processTicksAndRejections (node:internal/process/task_queues:105:5)

Issue Analysis: ENAMETOOLONG Error on macOS

I've investigated this issue and found the root cause. When Continue spawns MCP servers, it copies the entire process environment () to the child process. On macOS systems with large environments, this can exceed system limits and cause the error.

Root Cause

The issue is in in the method, which copies all environment variables when spawning MCP server processes.

Proposed Solution

Filter environment variables to only include:

  1. Essential variables (HOME, USER, PATH, etc.)
  2. MCP-specific variables (MCP_, NODE_, NPM_, CONTINUE_)
  3. Clean up PATH by removing duplicates

This would significantly reduce the environment size passed to child processes.

For Contributors

If you'd like to work on this issue:

  1. Please read our Contributing Guide
  2. The main file to modify is
  3. Add environment filtering logic to the method
  4. Include tests to verify the fix works with various MCP servers

This affects multiple users on macOS (#6699 has the same issue), so a fix would be very helpful!

Update: Workaround Available

A user in #6699 found a workaround - use the full path to the command instead of relying on PATH resolution:

mcpServers:
  - name: Memory MCP server
    command: /usr/local/bin/npx  # Use full path
    args:
      - -y
      - "@modelcontextprotocol/server-memory"

To find the full path to npx on your system, run: which npx

This avoids the PATH environment variable issues that contribute to the ENAMETOOLONG error.

๐ŸŽ‰ This issue has been resolved in version 1.31.0 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€

๐ŸŽ‰ This issue has been resolved in version 1.4.0 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€

๐ŸŽ‰ This issue has been resolved in version 1.28.0 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€

idoall commented

@sestinj
A new error has occurred:

name: MUI MCP Server
version: 1.0.0
schema: v1
mcpServers:
  - name: MUI MCP
    type: stdio
    command: /Users/xxx/.nvm/versions/node/v22.19.0/bin/npx
    args:
      - -y
      - "@mui/mcp@latest"

Failed to connect to "MUI MCP"
Error: MCP error -32000: Connection closed

name: Fetch MCP Server
version: 1.0.0
schema: v1
mcpServers:
  - name: Fetch MCP
    type: stdio
    command: /opt/homebrew/bin/uvx
    args:
      - -y
      - "mcp-server-fetch"
Failed to connect to "Fetch MCP"
Error: MCP error -32000: Connection closed

Process output:
STDERR:
error: unexpected argument '-y' found

Usage: uvx [OPTIONS] [COMMAND]

For more information, try '--help'.