-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Description
Bug Description
Operating System: macOS Darwin 24.5.0
Node.js Version: v23.10.0 (via nvm)
Issue Description:
MCP servers consistently fail to connect in Claude Code, even though they are properly configured and the servers themselves work correctly when tested independently.
Steps to Reproduce:
- Install MCP server globally:
npm install -g @modelcontextprotocol/server-filesystem - Add MCP server to Claude Code:
claude mcp add filesystem "npx" "@modelcontextprotocol/server-filesystem" "/Users/username/Projects/" - Verify server is listed:
claude mcp list
Output shows: filesystem: npx @modelcontextprotocol/server-filesystem /Users/username/Projects/
- Start Claude Code:
claude - Attempt to use MCP tools - all fail with "MCP servers failed to connect"
Expected Behavior:
MCP servers should connect and be available for use within Claude Code.
Actual Behavior:
All MCP servers fail to connect, despite being properly configured and working when tested independently.
Additional Information:
- The MCP server works correctly when tested directly:
echo '{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2024-11-05","clientInfo":{"name":"test","version":"1.0.0"},"capabilities":{}},"id":1}' | npx @modelcontextprotocol/server-filesystem /path/to/directory - Returns successful initialization response.
- Tried multiple configuration approaches:
- Using npx with -y flag
- Using direct node path with full path to server
- Creating .mcp.json in project directory
- Using --mcp-config flag with JSON file
- Importing from Claude Desktop config - No error logs are generated in any standard log locations.
- The same configuration works in Claude Desktop app but fails in Claude Code CLI.
Environment Details:
- Multiple MCP servers tested (filesystem, memory, github, etc.)
- All exhibit the same connection failure
- No permission issues (all files have correct permissions)
- PATH includes node/npm directories
This appears to be a fundamental issue with Claude Code's MCP integration rather than a configuration problem, as the servers work correctly outside of Claude Code.
Environment Info
- Platform: macos
- Terminal: pycharm
- Version: 1.0.11
- Feedback ID: 74d37a8d-973a-43c3-96ea-e43aa60b7888
Errors
[{"error":"AbortError: The operation was aborted\n at abortChildProcess (node:child_process:716:27)\n at onAbortListener (node:child_process:786:7)\n at process.processTicksAndRejections (node:internal/process/task_queues:85:11)","timestamp":"2025-06-04T23:03:51.295Z"},{"error":"Error: Command failed: security find-generic-password -a $USER -w -s \"Claude Code\"\nsecurity: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.\n\n at genericNodeError (node:internal/errors:983:15)\n at wrappedFn (node:internal/errors:537:14)\n at checkExecSyncError (node:child_process:882:11)\n at execSync (node:child_process:954:15)\n at JZ (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:683:2402)\n at file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:582:11763\n at Q (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:526:17069)\n at LU (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:582:10909)\n at HG (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:582:10355)\n at lO2 (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:2042:4758)","timestamp":"2025-06-04T23:03:51.321Z"},{"error":"Error: No logs found at /Users/davidandrews/Library/Caches/claude-cli-nodejs/-Users-davidandrews-PycharmProjects-lexgenius/messages\n at tT4 (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:583:3738)\n at iQ1 (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:583:3487)\n at OAA.<anonymous> (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:2337:2015)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async OAA.parseAsync (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:517:4184)\n at async vE5 (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:2340:5983)\n at async xE5 (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:2336:17530)","timestamp":"2025-06-04T23:03:51.349Z"},{"error":"AbortError: The operation was aborted\n at abortChildProcess (node:child_process:716:27)\n at AbortSignal.onAbortListener (node:child_process:786:7)\n at [nodejs.internal.kHybridDispatch] (node:internal/event_target:827:20)\n at AbortSignal.dispatchEvent (node:internal/event_target:762:26)\n at runAbort (node:internal/abort_controller:449:10)\n at abortSignal (node:internal/abort_controller:435:3)\n at AbortController.abort (node:internal/abort_controller:468:5)\n at Timeout._onTimeout (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:2336:15943)\n at listOnTimeout (node:internal/timers:611:17)\n at process.processTimers (node:internal/timers:546:7)","timestamp":"2025-06-04T23:03:54.232Z"},{"error":"ShellError: Shell command failed\n at Object.call (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1547:1326)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async pZ5 (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1889:19078)\n at async YK1 (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1889:17664)\n at async dZ5 (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1889:16706)\n at async hZ5 (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1889:16356)\n at async oe (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1889:15392)\n at async oe (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1889:16218)\n at async oe (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1889:16218)\n at async oe (file:///Users/davidandrews/.nvm/versions/node/v23.10.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1889:16218)","timestamp":"2025-06-04T23:05:14.363Z"},{"error":"ShellError: Shell command failed\n at Object.call (file:///Users/davidandrews/.nvm/versions/nodNote: Error logs were truncated.