Skip to content

【bug】本地 MCP 只解析 .gemini\config\mcp_config.json,空文件即整体加载失败、已配置的 MCP 全不显示 #632

Closed

Description

@galact-byte

环境

  • codeg-server: v0.29.0
  • 系统: Windows x64

问题内容

偏好设置 → MCP → 本地 MCP,直接报红加载失败,并显示"当前未检测到本地 MCP",点刷新无效:

加载失败:invalid JSON at C:\Users<用户名>.gemini\config\mcp_config.json:
EOF while parsing a value at line 1 column 0
Image

但是我在pi里装了好几个mcp了

Image

也让AI看了下

   1. 报错指向的 `C:\Users\<用户名>\.gemini\config\mcp_config.json` 是一个 **0 字节空文件**,所以 JSON 解析一进来就 EOF
 报错。
   2. codeg 把"本地 MCP"的唯一来源指到了 **Gemini CLI 的配置路径**,一旦这个文件为空/损坏,就让整个本地 MCP 列表加载失
 败、一个都不显示。

我本机其实配了很多 MCP,codeg 一个都没读到:

  • C:\Users\<用户名>\.claude.json 里有 8 个:github / filesystem / sequential-thinking / exa / memory / context7 / tinyfish / blender

复现

  1. 确保 ~/.gemini/config/mcp_config.json 存在且为空文件(0 字节)。
  2. 打开 codeg → MCP → 本地 MCP。
  3. 直接报 "invalid JSON ... EOF",列表全空,刷新无效。

期望

  1. 空文件 / 损坏文件应当作"无配置"跳过,而不是让整个本地 MCP 加载失败。
  2. 单个来源解析失败要降级:跳过坏的、继续显示能读到的,并把错误做成某一项的告警而非整页失败。
  3. 本地 MCP 最好能从多个常见来源聚合(至少别把用户在 .claude.json 等处已配置的 MCP 全漏掉),或提供可配置的扫描路
    径。

Activity

  1. dawNotPoi commented on Sep 3, 2026

    @dawNotPoi
    Contributor

    I would like to work on this. I will make local MCP discovery isolate per-source read/parse failures so an empty or malformed Antigravity config cannot suppress valid Claude and other configured servers, with focused regression tests for the aggregate scan.

  2. xintaofei commented on Sep 3, 2026

    @xintaofei
    Collaborator

    codeg work task 148 is done — merged locally into main as f2a06c6 (16 files, +527/-67).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions