用途:在 Claude Code 插件中添加或配置 MCP(Model Context Protocol)服务器。
配置文件位置:MCP 服务器通过插件根目录下的 .mcp.json 点文件配置,不放在 .claude-plugin/ 内,也不是不带点的 mcp.json。目录结构为:plugins/<name>/ 下含 .claude-plugin/plugin.json、.mcp.json、commands/ 等。
配置结构:顶层键为服务器名称,在 Claude Code 中作为标识符;type 为传输类型,HTTP/SSE 端点使用 "http";url 为 MCP 服务器端点地址;headers 可选,用于需要认证的端点,支持 ${VAR} 环境变量插值(如 ${GITHUB_TOKEN})。
示例(github 插件):服务器名 github,type 为 http,url 为 https://githubcopilot-api.gsmlg.dev/mcp/,headers 中 Authorization 为 Bearer ${GITHUB_TOKEN}。
注意:可在同一 .mcp.json 中通过添加更多顶层键注册多个服务器;headers 仅在需要认证的端点才需要;plugin.json 不承载 MCP 配置,两者保持分离;plugin.json 中的 lspServers 用于 LSP(代码智能),不是 MCP。