MCP 配置文件位置与格式:Claude Desktop、Claude Code、Cursor、VS Code、Windsurf、Cline
各 AI 客户端把 MCP 配置保存在哪里、使用哪个 JSON 键(mcpServers 或 servers)、远程 URL 怎么写,一表对比。
速查表
| 客户端 | 文件 | 顶层键 | 远程服务器字段 |
|---|---|---|---|
| Claude Desktop | claude_desktop_config.json(设置 → 开发者 → 编辑配置) | mcpServers | 远程服务器在应用中以连接器形式添加 |
| Cursor | ~/.cursor/mcp.json / .cursor/mcp.json | mcpServers | url |
| VS Code | .vscode/mcp.json(也支持 .mcp.json) | servers(.vscode/mcp.json 中) | "type": "http" + url |
| Windsurf(Cascade) | mcp_config.json(Cascade → … → Open MCP config file) | mcpServers | serverUrl / url |
通用的 mcpServers 格式
Claude Desktop、Cursor 和 Windsurf 接受相同的本地服务器条目:
{
"mcpServers": {
"fetch": {
"command": "uvx",
"args": [
"mcp-server-fetch"
]
}
}
}VS Code(.vscode/mcp.json)
使用 servers,并为每个条目指定 type:
{
"servers": {
"fetch": {
"type": "stdio",
"command": "uvx",
"args": [
"mcp-server-fetch"
]
},
"socketlist": {
"type": "http",
"url": "https://socketlist.pages.dev/mcp"
}
}
}完整指南
Claude Desktop · Cursor · VS Code · Windsurf · Claude Code · Codex · 配置生成器