Skip to content

MCP /mcp reconnect fails with code-mode server #20684

@mark-software

Description

@mark-software

Description

The /mcp command fails to reconnect to a code-mode MCP server with the error:

Failed to reconnect to code-mode.

This happens even after restarting Claude Code. However, the underlying MCP server works perfectly when run manually from the terminal.

Environment

  • Claude Code version: 2.1.15 (also tested behavior persists after restart)
  • macOS Darwin 24.6.0
  • Node.js (npx works fine)

MCP Configuration

.mcp.json:

{
  "mcpServers": {
    "code-mode": {
      "command": "npx",
      "args": ["@utcp/code-mode-mcp"],
      "env": {
        "UTCP_CONFIG_FILE": "/path/to/.utcp_config.json"
      }
    }
  }
}

The code-mode server proxies to remote MCP servers (Supabase, Cloudflare) via mcp-remote.

Reproduction Steps

  1. Configure code-mode MCP server as shown above
  2. Start Claude Code - MCP may or may not connect initially
  3. Run /mcp to try to reconnect
  4. Observe "Failed to reconnect to code-mode" error

What Works

Running the server manually works fine:

npx @utcp/code-mode-mcp

Output shows successful connections:

  • Supabase: 20 tools discovered
  • Cloudflare observability: 10 tools discovered
  • Cloudflare bindings: 25 tools discovered

OAuth tokens are valid and fresh. No stale processes blocking.

Expected Behavior

/mcp should successfully reconnect to the code-mode server, or provide a more descriptive error message about what's failing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions