github / github/copilot-cli

MCP Server 'Command to run' strips backslashes from Windows paths

未關閉
#2,786 0 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視
area:configuration area:mcp area:platform-windows
主要語言
Shell
星號
11.2k
分支
1.9k
平均合併
14 小時 16 分鐘
30 天內合併 PR
6

描述

### Describe the bug

When adding an MCP server in Copilot CLI, the **Command to run** field incorrectly processes Windows-style paths containing backslashes (`\`). The backslashes are stripped, causing the saved command path to become invalid.

This is a common scenario when pointing Copilot CLI at a locally built MCP server executable.

### Steps to reproduce

1. Open Copilot CLI settings/config UI for **MCP Servers**
2. Add a new MCP server (or edit an existing one)
3. In **Command to run**, enter a Windows path with backslashes, e.g.:
`C:\src\external\gitrepo\mcpserver\bin\mcpserver.exe`
4. Save

### Actual behavior

The saved value strips the backslashes, e.g. it becomes:
`C:srcexternalgitrepomcpserverbinmcpserver.exe`

### Expected behavior

The saved command should preserve the Windows path exactly as entered (including backslashes), e.g.:
`C:\src\external\gitrepo\mcpserver\bin\mcpserver.exe`

### Environment

- OS: Windows
- Scenario: locally built MCP server executable path entered into “Command to run”

### Additional context / notes

This looks like an escaping/serialization issue (e.g., treating backslashes as escape characters) when persisting the MCP server config. The UI should either:
- properly escape backslashes when storing, or
- treat the field as a raw string, or
- clearly document/accept `\\` if that’s required (but ideally it shouldn’t be).

貢獻指南

開啟貢獻指南

研究方向

在 Windows 上使用報告中的路徑,在 MCP Servers 設定 UI 中重現此問題,然後追蹤 Command to run 值的持久化方式。當儲存並重新開啟 MCP server 後,輸入的 Windows 路徑中的每個反斜線都能保留時,即表示完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
shell
領域
cli
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
冷清
描述清晰度
基本清楚
新手友好度
58/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。