github / github/copilot-cli

Comments in .mcp.json not supported, causing all workspace MCP servers to be skipped

未关闭
#4,323 0 条评论 1 个 reaction 已指派 2 人 已被 @devm33 认领 在 GitHub 查看
area:configuration area:mcp
主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

描述

### Describe the bug

Repository-level  `.mcp.json` files are parsed as strict JSON. Adding a  `//` or  `/* ... */`  comment causes Copilot CLI to reject the entire file and skip every MCP server it defines.
This makes it difficult to maintain a shared repository configuration containing documentation or temporarily disabled server definitions.

### Affected version

1.0.78-0

### Steps to reproduce the behavior

1. Create a trusted Git repository.
2. Add `.mcp.json`:
```
{
"mcpServers": {
// Used for browser-based integration tests.
"playwright": {
"type": "stdio",
"command": "npx",
"args": ["@playwright/mcp@latest"],
"tools": ["*"]
}
}
}
```
3. Run `copilot mcp list --json`
4. Copilot reports:
```
Warning: skipping workspace MCP config ".mcp.json" because it is malformed:
Invalid JSON: key must be a string
```

5. Remove the comment and repeat the command. The workspace MCP server is then discovered successfully.

### Expected behavior

Copilot CLI should parse `.mcp.json` as JSONC, supporting  `//` and  `/* ... */` comments while continuing to load valid MCP definitions.

Alternatively, the configuration schema could provide a documented repository-level mechanism such as `"enabled": false` for retaining optional MCP definitions without loading them.

A malformed individual server entry should ideally not prevent unrelated valid servers from loading.

### Additional context

_No response_

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。