> ## 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.

# 在 Cursor 中连接 Didit MCP 服务器

> 通过一键安装链接或三行 mcp.json 将 Didit MCP 服务器添加到 Cursor，然后使用 Didit 账号登录。无需 API 密钥，可在 Cursor 的 agent 中使用。

Cursor 通过一个安装链接或三行 `mcp.json` 配置，连接到托管的 Didit MCP 服务器（`https://mcp.didit.me/mcp`）。首次使用时，Cursor 会在浏览器中打开 **Log in with Didit**，您无需复制任何 API 密钥。

> [card] [将 Didit 添加到 Cursor](https://cursor.com/install-mcp?name=didit\&config=eyJ1cmwiOiJodHRwczovL21jcC5kaWRpdC5tZS9tY3AifQ%3D%3D)
>
> 打开 Cursor 的安装页面，该页面会启动 Cursor，并添加名为 `didit`、URL 为 mcp.didit.me/mcp 的服务器。请确认安装，然后使用 Didit 登录。

如果您想将安装链接放在自己的按钮后面或 README 中，可以使用以下链接：

```text theme={null}
https://cursor.com/install-mcp?name=didit&config=eyJ1cmwiOiJodHRwczovL21jcC5kaWRpdC5tZS9tY3AifQ%3D%3D
```

该链接封装了 Cursor 的深度链接，您也可以直接使用它：

```text theme={null}
cursor://anysphere.cursor-deeplink/mcp/install?name=didit&config=eyJ1cmwiOiJodHRwczovL21jcC5kaWRpdC5tZS9tY3AifQ==
```

`config` 的值是 `{"url":"https://mcp.didit.me/mcp"}` 的 base64 编码。

***

## 按方法设置

> [tab] 安装链接
>
> 1. 点击 [**Add Didit to Cursor →**](https://cursor.com/install-mcp?name=didit\&config=eyJ1cmwiOiJodHRwczovL21jcC5kaWRpdC5tZS9tY3AifQ%3D%3D)。浏览器会询问是否打开 Cursor，请允许。
> 2. Cursor 会显示名为 `didit` 的服务器，URL 为 `https://mcp.didit.me/mcp`。请确认安装。
> 3. 当 Cursor 将 `didit` 列为需要登录时，点击连接，并在浏览器中完成 **Log in with Didit**。
>
> 如果 Cursor 没有打开，安装页面会输出配置内容，供您手动粘贴到 `mcp.json` 中。

> [tab] mcp.json
>
> 将 Didit 添加到 `~/.cursor/mcp.json`（适用于所有项目）或 `.cursor/mcp.json`（仅适用于一个项目）：
>
> ```json theme={null}
> {
>   "mcpServers": {
>     "didit": {
>       "url": "https://mcp.didit.me/mcp"
>     }
>   }
> }
> ```
>
> 请将您已有的其他服务器保留在 `mcpServers` 中。首次使用时，Cursor 会自动向 Didit 注册，并打开浏览器以完成 **Log in with Didit**。

> [tab] 命令行
>
> `cursor` 命令可以将服务器添加到您的用户配置文件中：
>
> ```bash theme={null}
> cursor --add-mcp '{"name":"didit","type":"http","url":"https://mcp.didit.me/mcp"}'
> ```
>
> 命令会输出 `Added MCP servers: didit`。打开 Cursor，并在提示时登录。

> [!NOTE]
>
> **配置中不包含 API 密钥。** 该服务器使用 OAuth 2.1 和 PKCE，并代表**您**行事：仅限于您在登录时批准的组织，并且只能使用您角色所拥有的权限。参见 [身份认证](https://docs.didit.me/zh/integration/mcp/authentication.md)。

***

## 检查是否正常工作

在 Cursor 的 Agent 对话中，输入：

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

Agent 会调用 `didit_context_get`，并列出您的组织及其下的应用。然后让它在您的代码库中开展工作：

* “创建一个沙盒 KYC 工作流，包含身份证件验证和活体检测，然后使用该工作流将 Didit Web SDK 添加到此应用中。”
* “为会话状态更新注册一个 Webhook 目标，指向我的 `/api/didit/webhook` 路由，并编写验证签名的处理程序。”
* “为 `user_123` 创建一个测试会话，并把验证链接发给我。”

***

## 故障排除

* **Cursor 没有从链接打开。** 请改为粘贴 **mcp.json** 标签页中的 JSON。
* **登录循环或失败。** 请先在默认浏览器中登录 [business.didit.me](https://business.didit.me)，然后重新连接。
* **某个工具返回 `missing_scope`。** 您在该组织中的角色缺少相应权限。请参阅[角色与权限](https://docs.didit.me/zh/integration/mcp/authentication.md#角色与权限)。
* **智能体提示没有 Didit 工具。** 请检查 Cursor 的 MCP 设置中是否已启用 `didit` 服务器，并且已完成登录。请参阅[故障排除](https://docs.didit.me/zh/integration/mcp/advanced.md#故障排查)。

***

## 后续步骤

> [card] [连接 VS Code](https://docs.didit.me/zh/integration/mcp/vscode.md)
>
> 用于在 VS Code 中安装 GitHub Copilot 的链接和 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/examples.md)
>
> 智能体构建 Didit 集成的完整示例。


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