MCP server connection fails despite server working correctly
Resolved 💬 4 comments Opened Feb 10, 2026 by seanberry Closed Mar 13, 2026
Description
Claude Code v2.1.38 fails to connect to an MCP server (XcodeBuildMCP) with "Failed to reconnect to XcodeBuildMCP", despite the server working perfectly when tested manually.
Environment
- Claude Code version: 2.1.38 (latest as of Feb 10, 2026)
- OS: macOS (Darwin 25.2.0, Apple Silicon)
- Node.js: v23.10.0
- MCP Server: XcodeBuildMCP v2.0.5
MCP Configuration (~/.claude/mcp.json)
{
"mcpServers": {
"XcodeBuildMCP": {
"command": "node",
"args": ["/opt/homebrew/lib/node_modules/xcodebuildmcp/build/cli.js", "mcp"]
}
}
}
Steps to Reproduce
- Install XcodeBuildMCP globally:
npm install -g xcodebuildmcp - Configure it in
~/.claude/mcp.json(as shown above) - Start Claude Code
- Run
/mcp— shows "Failed to reconnect to XcodeBuildMCP"
What Works (Server is Fine)
Running the server manually with a proper MCP handshake succeeds:
const { spawn } = require('child_process');
const child = spawn('/opt/homebrew/bin/XcodeBuildMCP', ['mcp'], { stdio: ['pipe','pipe','pipe'] });
const msg = JSON.stringify({jsonrpc:'2.0',id:1,method:'initialize',params:{protocolVersion:'2024-11-05',capabilities:{},clientInfo:{name:'test',version:'1.0'}}});
child.stdin.write(msg + '\n');
The server responds correctly with:
- Valid JSON-RPC
initializeresponse protocolVersion: "2024-11-05"- Registers 24 tools and 5 resources
serverInfo: { name: "XcodeBuildMCP", version: "2.0.5" }
What I've Tried (All Failed)
- Removed duplicate config file (
~/.claude/mcp_servers.jsonin older flat format) — no effect - Restarted Claude Code multiple times — no effect
- Changed command to use binary symlink directly (
/opt/homebrew/bin/XcodeBuildMCP) instead ofnode— no effect - Changed command to use
nodewith full path to CLI script — no effect - Verified no stale processes (
ps aux | grep XcodeBuildMCPreturns nothing) - Verified file permissions on
~/.claude/mcp.json(644, correct owner)
Additional Context
- The working directory is in iCloud Drive (
~/Library/Mobile Documents/com~apple~CloudDocs/...) which contains spaces and special characters. The server logs "No project config found" for this path on startup, but this appears to be informational only and doesn't affect the MCP handshake. - This has persisted across multiple Claude Code sessions and full restarts.
Expected Behavior
Claude Code should successfully connect to the MCP server and make its 24 tools available.
Actual Behavior
/mcp always shows "Failed to reconnect to XcodeBuildMCP". No MCP tools are available.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗