Skip to content

Bug Report: MCP Server fails to reconnect on Windows - mixed path separators #330

@joemonster

Description

@joemonster

Bug Description

The claude-mem MCP server fails to reconnect on Windows due to mixed path separators (backslashes and forward slashes) in the resolved command path. Claude Code displays: Failed to reconnect to plugin:claude-mem:claude-mem-search.

The MCP server command path shows:
C:\Users\mariu.claude\plugins\cache\thedotmack\claude-mem\7.2.3/scripts/mcp-server.cjs

Note the mixed path separators - Windows-style backslashes () for the plugin root, but forward slash (/) for the /scripts/mcp-server.cjs part from the .mcp.json template.

Steps to Reproduce

  1. Install claude-mem plugin on Windows
  2. Start Claude Code
  3. Run /mcp command
  4. Observe "Failed to reconnect" error for Plugin:claude-mem:claude-mem-search
  5. Click "Reconnect" - fails repeatedly

Expected Behavior

The MCP server should connect successfully. Path should be normalized to use consistent separators.

Root Cause Analysis

In .mcp.json:
{
"mcpServers": {
"claude-mem-search": {
"type": "stdio",
"command": "${CLAUDE_PLUGIN_ROOT}/scripts/mcp-server.cjs"
}
}
}

When Claude Code resolves ${CLAUDE_PLUGIN_ROOT} on Windows, it produces a Windows path with backslashes, but the /scripts/mcp-server.cjs suffix keeps its forward slash, resulting in a mixed-separator path.

Interesting finding: Running the script manually with either path style works:

Both of these work when run manually:

node "C:\Users\mariu.claude\plugins\cache\thedotmack\claude-mem\7.2.3/scripts/mcp-server.cjs"
node "C:\Users\mariu.claude\plugins\cache\thedotmack\claude-mem\7.2.3\scripts\mcp-server.cjs"

The worker itself starts successfully (logs show it's running on port 37777), but Claude Code's MCP client cannot connect, possibly due to path comparison/validation issues.

Environment

  • Claude-mem version: 7.2.3
  • Claude Code version: 2.0.69
  • OS: Windows 10/11 (MSYS_NT-10.0-26200)
  • Platform: win32
  • Node.js: 18+

Worker Logs (working normally)

[2025-12-15 11:31:25.637] [INFO ] [SYSTEM] Worker started {host=127.0.0.1, port=37777, pid=60364}
[2025-12-15 11:31:26.247] [INFO ] [HTTP ] → GET /api/version {requestId=GET-1765794686246}
[2025-12-15 11:31:26.250] [INFO ] [HTTP ] ← 200 /api/version {requestId=GET-1765794686246, duration=4ms}
[2025-12-15 11:31:27.244] [INFO ] [DB ] Database initialized
[2025-12-15 11:31:28.157] [INFO ] [WORKER] ✓ Connected to MCP server
[2025-12-15 11:31:28.157] [INFO ] [SYSTEM] Background initialization complete

Suggested Fix

Normalize path separators in the MCP command resolution. Options:

  1. In claude-mem (plugin side): Use path.join() or normalize the path in mcp-server.cjs bootstrap
  2. In Claude Code (client side): Normalize paths when resolving ${CLAUDE_PLUGIN_ROOT} template variables on Windows

Workaround Attempts

  • Reconnecting via /mcp menu - does not work
  • Restarting Claude Code - temporarily works, then fails again

Additional Context

This is a Windows-specific issue. The same plugin likely works correctly on macOS/Linux where forward slashes are the standard path separator.


Labels: bug, windows, mcp, path-handling

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions