> For the complete documentation index, see [llms.txt](https://docs.goassay.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.goassay.ai/use-tools/zh/ru-men/connect-your-ai-app.md).

# 连接你的 AI 应用

将 Assay 添加到 AI 应用，并在浏览器中批准连接。

连接一次后，AI 应用就能查找和调用 Assay 工具。本地应用使用在你电脑上运行的 Assay 本地应用（`@goassay-ai/mcp`）。它们通过浏览器登录，无需在配置中填入 API 密钥。

{% hint style="info" %}
**开始前：**[创建账户](/use-tools/zh/ru-men/create-your-account.md)。使用本地应用时，请在运行应用的电脑上安装 Node.js 20 或更高版本。
{% endhint %}

\*\*要使用付费工具，请选择能付款的应用。\*\*Claude Code、Codex、Cursor、VS Code、Windsurf、Gemini CLI 和 Claude Desktop 都能通过 Assay 本地应用付款。claude.ai 和 ChatGPT 的托管连接器只能进行免费调用。**My own code** 使用 API 密钥，让你的程序调用工具。要付款，程序还必须签署支付，具体见开发者文档。按本指南的基本流程使用付费工具时，请选择本地应用。

## 操作步骤

{% stepper %}
{% step %}

### 打开 Connect

前往 **Controls → Connect**。选择 **Connect a tool set or only some tools**，确认已选中 **Everything**，然后关闭该面板，继续使用默认连接，让应用通过一个服务器访问 Assay 工具。

<figure><img src="https://1515942101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ3s1eCyfwYmPV4hcUtOZ%2Fuploads%2Fgit-blob-ea09dd28c5cb93f46dc13e93cf986a68a688409e%2Fconnect-your-ai-app-1.png?alt=media" alt="What should it use，已选中并标出 Everything"><figcaption><p>保持选中 Everything。</p></figcaption></figure>
{% endstep %}

{% step %}

### 将 Assay 添加到应用

在 **Which app do you use?** 下选择应用，再按下面对应标签页操作。要进行付费调用，请使用本地安装方式，而不是 **Free tools only, with no install**。

<figure><img src="https://1515942101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ3s1eCyfwYmPV4hcUtOZ%2Fuploads%2Fgit-blob-9fe2d8689ed09f3fd30043dfb2df12031f006c68%2Fconnect-your-ai-app-2.png?alt=media" alt="Which app do you use 选择器，已选中并标出 Claude Code"><figcaption><p>选择你的 AI 应用。</p></figcaption></figure>

本地安装使用已发布的包 `@goassay-ai/mcp`。

{% tabs %}
{% tab title="Claude Code" %}
在电脑的终端中运行以下命令：

```sh
claude mcp add --scope user assay -- npx -y @goassay-ai/mcp --name assay
```

新建一个 Claude Code 会话，让它加载 Assay。
{% endtab %}

{% tab title="Codex" %}
在电脑的终端中运行以下命令：

```sh
codex mcp add assay -- npx -y @goassay-ai/mcp --name assay
```

重启 Codex，让它加载 Assay。
{% endtab %}

{% tab title="Cursor" %}
选择 **Add to Cursor**，在 Cursor 中接受安装。重新加载 Cursor，让它加载 Assay。如果按钮没有反应，选择 **Copy the config instead**，将配置粘贴到 `~/.cursor/mcp.json`，再重新加载 Cursor。

<figure><img src="https://1515942101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ3s1eCyfwYmPV4hcUtOZ%2Fuploads%2Fgit-blob-d421a09ab2dd334b28f36d0d4363970de5fde9af%2Fconnect-your-ai-app-3.png?alt=media" alt="Cursor 安装控件，已标出 Add to Cursor"><figcaption><p>将 Assay 添加到 Cursor。</p></figcaption></figure>
{% endtab %}

{% tab title="VS Code" %}
选择 **Add to VS Code** 并接受安装，或在终端中运行 **Connect** 上显示的命令。如果 Assay 的工具没有出现，请重启 VS Code。
{% endtab %}

{% tab title="Windsurf" %}
将 **Connect** 上显示的配置复制到 `~/.config/devin/mcp_config.json`。如果文件中已有其他服务器，请保留它们并添加 Assay 条目。重启 Windsurf。
{% endtab %}

{% tab title="Gemini CLI" %}
在电脑的终端中运行以下命令：

```sh
gemini mcp add --scope user assay npx -y @goassay-ai/mcp --name assay
```

重启 Gemini CLI，让它加载 Assay。
{% endtab %}

{% tab title="Claude Desktop" %}
在 Claude Desktop 中打开 **Settings → Developer → Edit config**。添加 **Connect** 上显示的配置，保留文件中已有的其他服务器。重启 Claude Desktop。
{% endtab %}

{% tab title="claude.ai" %}
在 claude.ai 中打开 **Settings → Connectors → Add custom connector**。粘贴 Assay **Connect** 页面显示的 URL。不要勾选 **Show paid tools too (they will explain how to pay)**。选择 **Connect**，打开 Assay 的批准窗口。

这种托管连接只能进行免费调用。它无法保存付款所需的支付密钥。
{% endtab %}

{% tab title="ChatGPT" %}
在 ChatGPT 的设置中找到 **Connectors**，添加自定义连接器。粘贴 Assay **Connect** 页面显示的 URL。不要勾选 **Show paid tools too (they will explain how to pay)**。选择 **Connect**，打开 Assay 的批准窗口。

这种托管连接只能进行免费调用。它无法保存付款所需的支付密钥。
{% endtab %}

{% tab title="My own code" %}
此选项适用于你自己编写的程序。上面列出的已安装 AI 应用使用其他选项。选择 **Use an API key instead**，再选择 **Create**。完整密钥只显示一次，请在出现时保存。将页面显示的连接信息用于你的程序。

API 密钥让程序能够调用工具。要支付调用费用，程序必须自行签署支付，开发者文档介绍了具体做法。按本指南的基本流程使用付费工具时，请使用前面列出的本地应用。如果你在集成自己的程序，请使用其 API 密钥，无需执行下面的浏览器登录步骤。
{% endtab %}
{% endtabs %}
{% endstep %}

{% step %}

### 让本地应用登录

在本地应用中对 AI 说：

> Sign in to Assay.

应用提供 **assay\_sign\_in** 工具，用于在浏览器中打开登录页面。如果应用请求运行该工具，请允许。托管连接器已经打开了批准窗口，请在那里继续。

<figure><img src="https://1515942101-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FZ3s1eCyfwYmPV4hcUtOZ%2Fuploads%2Fgit-blob-cd2d9494dfc59d23c5a99f9febfc2f7e480e2e46%2Fconnect-your-ai-app-4.png?alt=media" alt="What happens next，已标出 assay_sign_in 说明"><figcaption><p>让应用登录 Assay。</p></figcaption></figure>
{% endstep %}

{% step %}

### 批准连接

在 **Connect an app to Assay** 页面确认登录的是正确账户，并确认 **Agent** 是你想使用的智能体。保留建议的 **Name**，然后选择 **Approve**。（**Approve and set limits** 还会打开该智能体的限额设置；可以跳过。）

返回 AI 应用。现在应能使用 Assay 工具了。批准连接不会开启付费调用；完成免费测试后，你会另行批准支出。
{% endstep %}
{% endstepper %}

## 确认是否成功

登录后，应用能看到 Assay 工具。**Connect → Is it working?** 可能仍显示 **Waiting for the first call… (updates by itself)**。调用工具前出现这个状态是正常的。

## 遇到问题时

| 你看到的情况                         | 处理方式                                         |
| ------------------------------ | -------------------------------------------- |
| 本地应用中没有 **assay\_sign\_in** 工具 | 确认已安装 Node.js 20 或更高版本，并在添加 Assay 后重启 AI 应用。 |
| 本地应用要求粘贴 Assay API 密钥          | 使用 **Connect** 上显示的本地安装方式，再让应用通过浏览器登录。       |
| 批准窗口显示了错误账户                    | 在批准窗口选择 **Sign out**，再登录你的 Assay 账户。         |
| 托管应用无法付款                       | 托管连接器只能免费调用。要使用付费工具，请从选择器中选择本地应用。            |

## 下一步

* [完成第一次免费调用](/use-tools/zh/ru-men/make-your-first-call.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.goassay.ai/use-tools/zh/ru-men/connect-your-ai-app.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
