[BUG] IntelliJ MCP: Connection fails with -32000 when project path contains spaces (Windows, OneDrive)
Environment
- Claude Code: v2.1.175
- IntelliJ IDEA: 2026.1 Community, Build #IU-261.22158.277, JDK 25.0.2
- Claude Code JetBrains Plugin:
com.anthropic.code.pluginv0.1.14-beta (Dec 2025) - OS: Windows 11 Pro
- Project path:
C:\Users\username\OneDrive - Example Corp (Business)\IdeaProjects\my-project
Problem
Since approximately 2026-06-08/09, the idea MCP server fails at connect time — not just individual tool calls.
/mcp output:
Failed to reconnect to idea: -32000
Root Cause (confirmed from idea.log)
IntelliJ's bundled com.intellij.mcpServer plugin calls java.net.URI(rawString) with an
unencoded file path that contains spaces. This throws java.net.URISyntaxException during
the MCP initialize phase.
Stack trace from idea.log:
SEVERE - McpServerService - Failed to determine project for MCP tool call by provided arguments
java.net.URISyntaxException: Illegal character in path at index 34:
file://C:/Users/username/OneDrive - Example Corp (Business)/IdeaProjects/my-project
at com.intellij.mcpserver.util.Fs_utilKt.findMostRelevantProject(fs.util.kt:58)
at com.intellij.mcpserver.util.Fs_utilKt.findMostRelevantProjectForRoots(fs.util.kt:50)
at com.intellij.mcpserver.impl.McpServerService$mcpToolToRegisteredTool$1.invokeSuspend(McpServerService.kt:542)
Regression Timeline
| Period | Behavior |
|--------|----------|
| Before 2026-06-08 | URISyntaxException thrown per tool call; MCP connection itself stayed up |
| After 2026-06-08/09 | findMostRelevantProject is now called during initialize; entire MCP handshake fails with -32000 |
The underlying bug in IntelliJ's com.intellij.mcpServer plugin existed before (tool calls failed individually), but a recent Claude Code update moved the affected code path into the initialize phase, turning a per-call error into a connection-level failure.
Reproduction
Affects any Windows project path that contains spaces — most commonly OneDrive for Business directories (e.g. OneDrive - Company Name (Subdomain)).
Workaround
None confirmed. An NTFS junction pointing to the OneDrive directory may or may not help depending on whether the JVM resolves the reparse point via GetFinalPathNameByHandle / getCanonicalPath().
Suggested Fix
JetBrains side (fs.util.kt:58):
Replace the raw URI construction with Paths.get(path).toUri() instead of URI("file://" + path) — Paths.get().toUri() correctly percent-encodes special characters including spaces.
Claude Code side (potential mitigation):
Percent-encode the working directory path before passing it to IntelliJ's MCP server during the initialize handshake, so IntelliJ receives a valid file URI even if its own URI construction is broken.
Note: The same bug has been reported to JetBrains YouTrack under the IDEA project.