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

  1. Install XcodeBuildMCP globally: npm install -g xcodebuildmcp
  2. Configure it in ~/.claude/mcp.json (as shown above)
  3. Start Claude Code
  4. 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 initialize response
  • protocolVersion: "2024-11-05"
  • Registers 24 tools and 5 resources
  • serverInfo: { name: "XcodeBuildMCP", version: "2.0.5" }

What I've Tried (All Failed)

  1. Removed duplicate config file (~/.claude/mcp_servers.json in older flat format) — no effect
  2. Restarted Claude Code multiple times — no effect
  3. Changed command to use binary symlink directly (/opt/homebrew/bin/XcodeBuildMCP) instead of node — no effect
  4. Changed command to use node with full path to CLI script — no effect
  5. Verified no stale processes (ps aux | grep XcodeBuildMCP returns nothing)
  6. 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.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗