setup-mcp
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSetting up MCP in a Plugin
在插件中配置MCP
MCP servers are configured via a file (dotfile) at the plugin root — not inside , and not without the dot.
.mcp.json.claude-plugin/mcp.jsonMCP服务器通过插件根目录下的文件(点文件)进行配置——不要放在目录内,也不要使用不带点的。
.mcp.json.claude-plugin/mcp.jsonFile location
文件位置
plugins/<name>/
├── .claude-plugin/
│ └── plugin.json
├── .mcp.json ← here
├── commands/
└── ...plugins/<name>/
├── .claude-plugin/
│ └── plugin.json
├── .mcp.json ← 在此处
├── commands/
└── ...Schema
模式
json
{
"<server-name>": {
"type": "http",
"url": "https://<endpoint>/mcp/",
"headers": {
"Authorization": "Bearer ${ENV_VAR}"
}
}
}- Top-level keys are the server names (used as identifiers in Claude Code)
- : transport type — use
typefor HTTP/SSE endpoints"http" - : the MCP server endpoint URL
url - : optional; use
headerssyntax for environment variable interpolation (e.g.,${VAR})${GITHUB_TOKEN}
json
{
"<server-name>": {
"type": "http",
"url": "https://<endpoint>/mcp/",
"headers": {
"Authorization": "Bearer ${ENV_VAR}"
}
}
}- 顶级键为服务器名称(在Claude Code中用作标识符)
- :传输类型——对于HTTP/SSE端点使用
type"http" - :MCP服务器端点URL
url - :可选;使用
headers语法进行环境变量插值(例如${VAR})${GITHUB_TOKEN}
Example (github plugin)
示例(github插件)
json
{
"github": {
"type": "http",
"url": "https://githubcopilot-api.gsmlg.dev/mcp/",
"headers": {
"Authorization": "Bearer ${GITHUB_TOKEN}"
}
}
}json
{
"github": {
"type": "http",
"url": "https://githubcopilot-api.gsmlg.dev/mcp/",
"headers": {
"Authorization": "Bearer ${GITHUB_TOKEN}"
}
}
}Notes
注意事项
- Multiple servers can be registered in the same by adding more top-level keys
.mcp.json - is only needed for authenticated endpoints
headers - does not carry MCP config — keep them separate
plugin.json - in
lspServersis for LSP (code intelligence), not MCPplugin.json
- 通过添加更多顶级键,可以在同一个中注册多个服务器
.mcp.json - 仅在需要认证的端点时才需要
headers - 不包含MCP配置——请将它们分开存放
plugin.json - 中的
plugin.json用于LSP(代码智能),而非MCPlspServers