Anysphere
向 Cursor 添加 MCP 服务器
Cursor 会读取项目中 .cursor/ 下的 mcp.json,也会读取 ~/.cursor/ 下供所有项目使用的配置。
- macOS
~/.cursor/mcp.json- Windows
~/.cursor/mcp.json- Linux
~/.cursor/mcp.json- 项目文件
.cursor/mcp.json- 顶层键
mcpServers- 格式
- json
- 远程服务器的 OAuth
- 是
配置示例
此示例按该客户端所需的格式,添加 GitHub 托管的服务器和作为本地服务器的 Playwright。
{
"mcpServers": {
"github": {
"url": "https://api.githubcopilot.com/mcp/"
},
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
}
}
}
注意事项和特殊情况
- 值可以使用 ${env:NAME}、${userHome} 和 ${workspaceFolder}。
- 远程条目需要 url,可选的 headers,以及包含 CLIENT_ID、CLIENT_SECRET 和 scopes 的 auth 配置块,供预先注册的 OAuth 应用使用。
- 如果服务提供方要求固定的重定向 URL,请注册 https://www.cursor.com/agents/mcp/oauth/callback 和 http://localhost:8787/callback。
- 官方文档未说明可使用命令行添加服务器。
其他客户端
Claude DesktopClaude CodeVS Code (GitHub Copilot)Windsurf / Devin DesktopZedOpenAI Codex CLIGemini CLIChatGPTOpenClawClineContinueJetBrains AI Assistant