Skip to content

Windows: "command" not json encoded in mcp context server modal, fails with windows paths #42692

@adam-huganir

Description

@adam-huganir

Summary

When going to edit an existing MCP server, if the server command has any backslashes (or ostensibly any other non json compat character) it will not print valid json, and you will not be able to save the config again.

Description

  1. Open zed, and open the agent panel
  2. Go into the agent settings
  3. Add an mcp, replacing the content block for "some-mcp-server" with the below. for my case it was the jetbrains ide mcp that i was using to test with:
{
  "some-mcp-server:" {
    "env": {
      "IJ_MCP_SERVER_PORT": "64342"
    },
    "command": "C:\\Users\\adam\\AppData\\Local\\Programs\\PyCharm Professional\\jbr\\bin\\java",
    "args": [
      "-classpath",
      "C:\\Users\\adam\\AppData\\Local\\Programs\\PyCharm Professional\\plugins\\mcpserver\\lib\\mcpserver-frontend.jar;C:\\Users\\adam\\AppData\\Local\\Programs\\PyCharm Professional\\lib\\util-8.jar;C:\\Users\\adam\\AppData\\Local\\Programs\\PyCharm Professional\\lib\\modules\\intellij.libraries.ktor.client.cio.jar;C:\\Users\\adam\\AppData\\Local\\Programs\\PyCharm Professional\\lib\\lib-client.jar;C:\\Users\\adam\\AppData\\Local\\Programs\\PyCharm Professional\\lib\\modules\\intellij.libraries.ktor.client.jar",
      "com.intellij.mcpserver.stdio.McpStdioRunnerKt"
    ]
  }
}
  1. Hit configure server, and either wait until it times out, or escape out of it.
  2. Click configure server on the newly created mcp.
  3. You will see command is "C:\Users\adam\AppData\Local\Programs\PyCharm Professional\jbr\bin\java" (the string of the pathbuf)

Expected Behavior:

Image

Actual Behavior:

Image

It's an easy fix that should not have any side affects since it only affects this modal and invalid json would never be desirable here. we'll see what the tests say

Zed Version and System Specs

Zed: v0.212.5 (Zed)
OS: Windows 10.0.26100
Memory: 61.7 GiB
Architecture: x86_64
GPU: NVIDIA GeForce RTX 4090 || NVIDIA Corporation || 581.8 r580_92

If applicable, attach your Zed.log file to this issue.

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform:windowshappens only on Windows, not other OS

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions