MCP server "ide" connection fails immediately on startup - IntelliJ IDEA plugin 0.1.14-beta
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
The ide MCP server fails to connect on Claude Code startup when using the IntelliJ IDEA plugin. The /ide command returns "Failed to connect to IntelliJ IDEA." even though IntelliJ is running and the WebSocket server is listening on the correct port.
Debug log shows the connection fails after only 49ms with [object ErrorEvent]:
MCP server "ide": Starting connection with timeout of 30000ms
MCP server "ide": Connection failed after 49ms: [object ErrorEvent]
MCP server "ide" Connection failed: [object ErrorEvent]
All prerequisites are confirmed to be in place:
- Lock file exists at
~/.claude/ide/49948.lockwith correct workspaceFolders, pid, transport: ws - IntelliJ IDEA process is running (verified via
ps aux) - WebSocket server is listening on port 49948 (verified via
lsof -i :49948) - curl to
ws://localhost:49948/returns HTTP 400 (server responds but rejects connection)
What Should Happen?
Claude Code should successfully connect to IntelliJ IDEA via the ide MCP server on startup, enabling IDE integration features such as opening files, viewing diffs, and the /ide command working correctly.
Error Messages/Logs
Steps to Reproduce
- Install Claude Code plugin 0.1.14-beta in IntelliJ IDEA
- Open IntelliJ IDEA with any project
- Launch Claude Code by clicking the plugin button inside IntelliJ IDEA (uses IntelliJ's built-in terminal)
- Run the
/idecommand - Observe "Failed to connect to IntelliJ IDEA." error
Additional verification steps:
ls ~/.claude/ide/→ shows lock file (e.g.49948.lock)cat ~/.claude/ide/49948.lock→ shows valid JSON with correct workspaceFolders and transport: wslsof -i :49948→ confirms IntelliJ is listening on that portclaude --debug→ showsMCP server "ide": Connection failed after 49ms: [object ErrorEvent]on startup
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.132
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
IntelliJ IDEA terminal
Additional Information
IntelliJ IDEA plugin version: 0.1.14-beta
Lock file content (~/.claude/ide/49948.lock):
{"workspaceFolders":["/Users/rimichoi/REPO/BIZ/bizweb"],"pid":1525,"ideName":"IntelliJ IDEA","transport":"ws","runningInWindows":false,"authToken":"[REDACTED]"}
lsof -i :49948 output:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
idea 1525 rimichoi 332u IPv6 ... 0t0 TCP localhost:49948 (LISTEN)
curl test result:
curl ... ws://localhost:49948/→ HTTP 400 (even with Authorization Bearer token)curl ... ws://localhost:49948/ide→ HTTP 404
The WebSocket server is running and responding, but the connection handshake fails. This appears to be a protocol or authentication mismatch between CLI 2.1.132 and plugin 0.1.14-beta.
4 Comments
Seeing similar connection issues with Claude Code 2.1.142, JetBrains Rider 2026.1.1, Claude Code plugin 0.1.14-beta, and macOS 26.4.1.
i have the same problem:
Environment:
Description:
Running /ide in Claude Code CLI fails with "Failed to connect to IntelliJ IDEA" when using
JetBrains Gateway (Remote Dev). The IDE backend runs as a headless server inside WSL2, and
the CLI also runs inside WSL2 (in a terminal spawned by the Remote Dev server).
Debug log output (claude --debug-file /tmp/claude-debug.log):
MCP server "ide": Starting connection with timeout of 30000ms
MCP server "ide": Connection failed after 22ms: [object ErrorEvent]
MCP server "ide" Connection failed: [object ErrorEvent]
Root cause identified:
The plugin starts a WebSocket MCP server on port 38900 (confirmed via ~/.claude/ide/38900.lock).
Manual testing shows the server requires "Sec-WebSocket-Protocol: mcp" in the WebSocket upgrade
request:
# Without mcp subprotocol (what the CLI sends) -> rejected
curl -H "Upgrade: websocket" -H "Sec-WebSocket-Version: 13" ... http://localhost:38900/
# -> HTTP 400 Bad Request
# With mcp subprotocol (manual test) -> accepted
curl -H "Upgrade: websocket" -H "Sec-WebSocket-Protocol: mcp" ... http://localhost:38900/
# -> HTTP 101 Switching Protocols
The CLI does not send "Sec-WebSocket-Protocol: mcp", causing the immediate 400 rejection.
Note: The same plugin version (0.1.14-beta) works correctly when IDEA runs natively on Windows
(not via Remote Dev). The issue is specific to the Remote Dev / WSL2 setup.
Had similar issue with Claude Code v2.1.71 (Windows native), Claude Code plugin 0.1.14-beta, but finally I found it was my HTTP proxy server failed to correctly handle the websocket connection.
Still seeing this problem.