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

# 在 Replit Agent 中接入 Didit MCP 服务器

> 通过一键链接或在集成中添加自定义 MCP 服务器，将 Didit MCP 服务器添加到 Replit Agent，然后登录 Didit 即可使用，无需 API 密钥。

Replit Agent 可通过一个链接连接到托管的 Didit MCP 服务器（`https://mcp.didit.me/mcp`），也可以在 **Integrations** 下将其添加为个人 MCP 服务器。保存后，Replit 会在浏览器中打开 **Log in with Didit**，您无需复制任何 API 密钥。

> [card] [将 Didit 添加到 Replit](https://replit.com/integrations?mcp=eyJkaXNwbGF5TmFtZSI6IkRpZGl0IiwiYmFzZVVybCI6Imh0dHBzOi8vbWNwLmRpZGl0Lm1lL21jcCJ9)
>
> 打开 Replit 的集成页面，其中已填入服务器 `Didit` 和 URL mcp.didit.me/mcp。保存后，使用 Didit 登录。

如果您想把安装链接放在自己的按钮上，或放入 README 中，请使用以下链接：

```text theme={null}
https://replit.com/integrations?mcp=eyJkaXNwbGF5TmFtZSI6IkRpZGl0IiwiYmFzZVVybCI6Imh0dHBzOi8vbWNwLmRpZGl0Lm1lL21jcCJ9
```

`mcp` 参数的值是 `{"displayName":"Didit","baseUrl":"https://mcp.didit.me/mcp"}` 的 base64 编码。它不包含任何请求头，Didit 登录由 Replit 自行完成。

***

## 按方法设置

> [tab] 安装链接
>
> 1. 登录 Replit，然后点击 [**将 Didit 添加到 Replit →**](https://replit.com/integrations?mcp=eyJkaXNwbGF5TmFtZSI6IkRpZGl0IiwiYmFzZVVybCI6Imh0dHBzOi8vbWNwLmRpZGl0Lm1lL21jcCJ9)。
> 2. Replit 会打开添加服务器对话框，名称为 `Didit`，URL 为 `https://mcp.didit.me/mcp`。点击 **Test & save**。
> 3. 在 Replit 打开的浏览器窗口中完成 **Log in with Didit**，并批准 Replit Agent 可以使用的组织。

> [tab] 集成页面
>
> 1. 在 Replit 中打开 **Settings → Integrations**，然后在 **Your integrations** 下点击 **Add custom**。
> 2. 选择 **Add personal MCP server**，或选择 **Add workspace MCP server** 以与工作区共享。
> 3. 将名称设为 `Didit`，并输入 URL `https://mcp.didit.me/mcp`。
> 4. 点击 **Test & save**，然后在浏览器中完成 **Log in with Didit**。
>
> 请使用完整的 `/mcp` URL：服务器在该路径下发布其 OAuth 元数据。

> [tab] API 密钥
>
> 对于在无人值守状态下运行的智能体，请使用应用 API 密钥进行连接，而不是登录：
>
> 1. 按照**集成页面**选项卡中的方法添加服务器，URL 为 `https://mcp.didit.me/mcp`。
> 2. 打开 **Advanced settings**，添加一个名为 `x-api-key` 的请求头，其值为您的应用 API 密钥。
> 3. 点击 **Test & save**。
>
> 此时，连接将以该应用的身份运行，而非以您本人的身份。关于其可执行和不可执行的操作，请参阅[使用 API 密钥连接](https://docs.didit.me/zh/integration/mcp/authentication.md#使用-api-密钥连接（无头智能体与-ci）)。

> [!NOTE]
>
> **默认设置无需 API 密钥。** 服务器使用带 PKCE 的 OAuth 2.1，并以**您本人**的身份操作：仅限于您在登录时批准的组织内，且受您角色权限的约束。Replit 会自动在 Didit 中完成注册。请参阅[身份验证](https://docs.didit.me/zh/integration/mcp/authentication.md)。

***

## 检查是否正常工作

在 Replit Agent 中询问：

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

智能体会调用 `didit_context_get`，并列出您的组织及其应用。

如果您使用 API 密钥连接，则无法显示组织列表：该连接仅覆盖一个应用。请改为询问：

```text theme={null}
Use the Didit MCP server to call didit_context_get and tell me which application this connection uses.
```

智能体会说明该密钥所属的应用，说明它是 `live` 还是 `sandbox`，并报告 `connection.type: "api_key"`。参见[什么是 API 密钥连接](https://docs.didit.me/zh/integration/mcp/authentication.md#api-密钥连接是什么)。

然后在您的应用中使用它：

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

***

## 故障排除

* **链接打开了 Replit 的登录页面。** 请登录 Replit，然后再次点击该链接。
* **测试并保存失败。** 请检查 URL 是否完全为 `https://mcp.didit.me/mcp`，末尾没有额外路径，并确认浏览器允许打开登录窗口。
* **登录陷入循环或失败。** 请先在默认浏览器中打开 [business.didit.me](https://business.didit.me) 并登录，然后重新连接。
* **某个工具返回 `missing_scope`。** 您在该组织中的角色缺少相应权限。请参阅 [角色与权限](https://docs.didit.me/zh/integration/mcp/authentication.md#角色与权限)。
* **智能体提示没有 Didit 工具。** 请检查 `Didit` 服务器是否列在 **Your integrations** 下，并且已完成登录。请参阅 [故障排除](https://docs.didit.me/zh/integration/mcp/advanced.md#故障排除)。

***

## 后续步骤

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

> [card] [连接 VS Code](https://docs.didit.me/zh/integration/mcp/vscode.md)
>
> 在 VS Code 中使用 GitHub Copilot 的安装链接和 mcp.json。

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