> ## Documentation Index
> Fetch the complete documentation index at: https://docs.didit.me/llms.txt
> Use this file to discover all available pages before exploring further.

# VS Code 与 Copilot 连接 Didit MCP 服务器

> 通过一键安装链接、mcp.json 或 code 命令行，将 Didit MCP 服务器添加到 VS Code，用于 GitHub Copilot 代理模式。使用 Didit 登录，无需 API 密钥。

VS Code 通过安装链接、`mcp.json` 条目或一条 `code` 命令，将 GitHub Copilot 的代理模式连接到托管的 Didit MCP 服务器（`https://mcp.didit.me/mcp`）。随后 VS Code 会要求您登录，您需要在浏览器中使用 **Log in with Didit** 登录；无需复制任何 API 密钥。

> [card] [在 VS Code 中添加 Didit](https://vscode.dev/redirect/mcp/install?name=didit\&config=%7B%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fmcp.didit.me%2Fmcp%22%7D)
>
> 打开 VS Code 的安装流程，以安装服务器 `didit`（HTTP，mcp.didit.me/mcp）。点击 Install，然后使用 Didit 登录。

用于您自己的按钮或 README 的安装链接：

```text theme={null}
https://vscode.dev/redirect/mcp/install?name=didit&config=%7B%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fmcp.didit.me%2Fmcp%22%7D
```

该链接会跳转到 `vscode:mcp/install?{"type":"http","url":"https://mcp.didit.me/mcp","name":"didit"}`。对于 VS Code Insiders，请使用 `https://insiders.vscode.dev/redirect/mcp/install?…`，并保留相同的查询字符串。

***

## 按方法设置

> [tab] 安装链接
>
> 1. 点击 [**Add Didit to VS Code →**](https://vscode.dev/redirect/mcp/install?name=didit\&config=%7B%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fmcp.didit.me%2Fmcp%22%7D)，让浏览器打开 VS Code。
> 2. VS Code 会显示 `didit` 服务器。点击 **Install**。
> 3. 当 VS Code 请求登录时，请允许，并在浏览器中完成 **Log in with Didit**。

> [tab] mcp.json
>
> 若仅针对一个工作区，请添加 `.vscode/mcp.json`：
>
> ```json theme={null}
> {
>   "servers": {
>     "didit": {
>       "type": "http",
>       "url": "https://mcp.didit.me/mcp"
>     }
>   }
> }
> ```
>
> VS Code 使用 `servers`，而不是其他客户端使用的 `mcpServers` 键。请将其指向完整的 `/mcp` URL：服务器为该路径发布其 OAuth 元数据。

> [tab] 命令面板
>
> 1. 从命令面板运行 **MCP: Add Server**。
> 2. 选择 **HTTP**，粘贴 `https://mcp.didit.me/mcp`，并将其命名为 `didit`。
> 3. 选择保存位置（您的用户配置文件或工作区），然后在提示时登录。

> [tab] 命令行
>
> 使用 `code` 命令将服务器添加到您的用户配置文件：
>
> ```bash theme={null}
> code --add-mcp '{"name":"didit","type":"http","url":"https://mcp.didit.me/mcp"}'
> ```
>
> 它会输出 `Added MCP servers: didit`，并将该条目写入您的用户 `mcp.json`。

> [!NOTE]
>
> **配置中不含 API 密钥。** 该服务器使用 OAuth 2.1 与 PKCE，并以**您**的身份行事：仅限您在登录时批准的组织内，并具有您角色的权限。请参阅[身份验证](https://docs.didit.me/zh/integration/mcp/authentication.md)。

***

## 验证是否正常工作

打开 Copilot Chat，切换到 **Agent** 模式，然后提问：

```text theme={null}
Use the Didit MCP server to call didit_context_get and list my organizations and applications.
```

Copilot 会请您允许调用 `didit_context_get`，然后列出您的组织及其应用。

> [!TIP]
>
> **启用的工具过多？** 登录 Didit 的用户可以使用 100 多个工具。如果 Copilot 提示工具数量过多，请打开聊天输入框中的工具选择器，只保留任务所需的 Didit 工具组，例如与会话和工作流相关的工具组。

***

## 故障排除

* **安装链接没有打开任何内容。** 请改用 **mcp.json** 或 **命令行** 标签页。
* **登录循环或失败。** 请先在默认浏览器中登录 [business.didit.me](https://business.didit.me)，然后运行 **MCP: List Servers**，选择 `didit` 并重新启动。
* **某个工具返回 `missing_scope`。** 您在该组织中的角色缺少相应权限。请参阅 [角色与权限](https://docs.didit.me/zh/integration/mcp/authentication.md#角色与权限)。

***

## 后续步骤

> [card] [连接 Cursor](https://docs.didit.me/zh/integration/mcp/cursor.md)
>
> Cursor 的一键安装链接和 mcp.json 配置。

> [card] [连接 OpenAI Codex](https://docs.didit.me/zh/integration/mcp/codex.md)
>
> 适用于 Codex CLI 和 IDE 扩展的一条命令。

> [card] [工具参考](https://docs.didit.me/zh/integration/mcp/tools.md)
>
> 智能体可以调用的全部工具，逐一说明。

> [card] [其他客户端](https://docs.didit.me/zh/integration/mcp/installation.md)
>
> Windsurf、Zed、任意 MCP 客户端，以及自托管。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.