---
title: "Claude Desktop MCP 配置：文件路径、键和示例 · DotsAgent"
description: "从 Anthropic 向 Claude Desktop 添加 MCP 服务器：了解配置文件位置、顶层键和格式、远程 OAuth 支持，以及配置示例。"
url: https://dotsagent.io/zh/mcp/clients/claude-desktop
---

Anthropic

# 向 Claude Desktop 添加 MCP 服务器

Claude Desktop 从 claude_desktop_config.json 读取本地服务器；远程服务器则需在应用中添加为自定义连接器。

- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
- **顶层键**: `mcpServers`
- **格式**: json
- **远程服务器的 OAuth**: 

## 配置示例

此示例按该客户端所需的格式，添加 GitHub 托管的服务器和作为本地服务器的 Playwright。

`~/Library/Application Support/Claude/claude_desktop_config.json`

```
{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": [
        "@playwright/mcp@latest"
      ]
    }
  }
}
```

远程服务器无法添加到该文件中。请前往 Settings > Connectors > Add custom connector，粘贴 URL 并登录。

## 注意事项和特殊情况

- 编辑文件后，退出并重新打开应用。
- macOS 上的日志位于 ~/Library/Logs/Claude，Windows 上位于 %APPDATA%\Claude\logs。
- 在 Windows 上通过 cmd 运行 npx：将 command 设为 cmd，并将 /c、npx 和软件包名作为参数。生成器会自动完成配置。
- 没有官方 Linux 版本。

[生成 Claude Desktop 配置 →](https://dotsagent.io/zh/mcp/config#client=claude-desktop)

## 其他客户端

[Claude Code](https://dotsagent.io/zh/mcp/clients/claude-code)

[Cursor](https://dotsagent.io/zh/mcp/clients/cursor)

[VS Code (GitHub Copilot)](https://dotsagent.io/zh/mcp/clients/vscode-copilot)

[Windsurf / Devin Desktop](https://dotsagent.io/zh/mcp/clients/windsurf)

[Zed](https://dotsagent.io/zh/mcp/clients/zed)

[OpenAI Codex CLI](https://dotsagent.io/zh/mcp/clients/codex-cli)

[Gemini CLI](https://dotsagent.io/zh/mcp/clients/gemini-cli)

[ChatGPT](https://dotsagent.io/zh/mcp/clients/chatgpt)

[OpenClaw](https://dotsagent.io/zh/mcp/clients/openclaw)

[Cline](https://dotsagent.io/zh/mcp/clients/cline)

[Continue](https://dotsagent.io/zh/mcp/clients/continue)

[JetBrains AI Assistant](https://dotsagent.io/zh/mcp/clients/jetbrains-ai)

## 来源

1. [modelcontextprotocol.io](https://modelcontextprotocol.io/docs/develop/connect-local-servers)/docs/develop/connect-local-servers
2. [modelcontextprotocol.io](https://modelcontextprotocol.io/docs/develop/connect-remote-servers)/docs/develop/connect-remote-servers
3. [github.com](https://github.com/modelcontextprotocol/servers)/modelcontextprotocol/servers

为 AI agent 开发者提供的独立参考资料。与此处提及的任何厂商均无关联。

© 2026 DotsAgent · 事实核查日期：2026年10月1日
