CodePilot icon indicating copy to clipboard operation
CodePilot copied to clipboard

MCP servers configured via CLI not discovered by CodePilot

Open gy212 opened this issue 9 months ago • 2 comments

Bug Description

CodePilot's Extensions page shows "No MCP servers configured" even when MCP servers are properly configured and connected via .

Environment: Windows 11

Steps to Reproduce

  1. Configure MCP servers via Claude Code CLI:

  2. Verify servers are connected in CLI:

  3. Open CodePilot, navigate to Extensions page

  4. Expected: See reactbits and shadcn servers listed

  5. Actual: Shows "No MCP servers configured"

Root Cause

Claude Code CLI (newer versions) stores MCP server configurations in an internal location that is not the mcpServers field in ~/.claude/settings.json. CodePilot's MCP API route (/api/plugins/mcp) only reads from settings.json, so it cannot find any CLI-configured servers.

Evidence:

  • claude mcp list → shows 2 servers, both Connected
  • claude mcp get reactbits → Scope: User config
  • ~/.claude/settings.json → no mcpServers field present
  • Searching entire ~/.claude/ directory → no file contains mcpServers

Impact

  • Extensions page always shows empty
  • MCP tools are not available during chat sessions
  • Users who configure MCP servers via the recommended CLI workflow cannot use them in CodePilot

Proposed Fix

  1. Add CLI discovery: Call claude mcp list to discover configured servers, parse the output, and cache results (60s TTL)
  2. Merge sources: Combine CLI-discovered servers with settings.json and .mcp.json configs (project > user > CLI priority)
  3. Pass to chat: Forward merged MCP config to streamClaude() so tools are available in conversations
  4. Protect settings: Change settings PUT handler to merge instead of overwrite, preventing CLI configs from being lost

gy212 avatar Feb 09 '26 16:02 gy212

你好!感谢详细的 bug 报告和分析。

这个问题已经在 commit a5cff79 中修复了:

fix: read MCP servers from both ~/.claude.json and ~/.claude/settings.json

现在 CodePilot 会同时读取 ~/.claude.json 和 ~/.claude/settings.json 中的 MCP 服务器配置,通过 CLI 配置的 MCP 服务器应该可以被正确发现了。

请更新到最新版本 v0.10.11 后重新测试。如果仍有问题,欢迎重新打开此 issue。

op7418 avatar Feb 23 '26 10:02 op7418

已在 commit a5cff79 中修复,关闭此 issue。

op7418 avatar Feb 23 '26 10:02 op7418