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

# 在 Grok Build 中使用 AIsa

> 几行配置，把 AIsa 添加为 xAI Grok Build CLI 的远程 MCP server。

Grok Build（`grok` CLI）原生支持远程 MCP server。把 AIsa 加入 `~/.grok/config.toml`，Grok 就能发现并调用 AIsa 能力——网页研究、金融、社交、SEO、销售等。

AIsa MCP endpoint：

```txt theme={null}
https://mcp.aisa.one/mcp
```

## 前置条件

开始前，请确认你已经具备：

* AIsa API key（[console.aisa.one/api-keys](https://console.aisa.one/api-keys)）
* macOS、Linux 或 Windows 上的 terminal

## 1. 安装 Grok Build

```bash theme={null}
# macOS / Linux / Git Bash
curl -fsSL https://x.ai/cli/install.sh | bash

# Windows (PowerShell)
irm https://x.ai/cli/install.ps1 | iex
```

验证安装：

```bash theme={null}
grok --version
```

## 2. 导出 AIsa key

Grok 从环境变量读取 key，不会写进配置文件。把这一行加入 `~/.zshrc` 或 `~/.bashrc`：

```bash theme={null}
export AISA_API_KEY="sk-aisa-..."
```

启动 Grok 前，打开新的 terminal 或 `source` 该文件。

## 3. 让 Grok 连接 AIsa

启动 `grok` 并发送：

```txt theme={null}
Read https://aisa.one/llms.txt and help me connect to AIsa.
```

Grok 会读取 AIsa 面向 agent 的说明，并把 AIsa MCP server 添加到 `~/.grok/config.toml`。

<Tip>
  想自己动手？把这段加入 `~/.grok/config.toml`：

  ```toml theme={null}
  [mcp_servers.aisa]
  url = "https://mcp.aisa.one/mcp"
  enabled = true
  bearer_token_env_var = "AISA_API_KEY"
  ```
</Tip>

## 4. 验证连接

```bash theme={null}
grok mcp doctor aisa
```

应当看到：

```txt theme={null}
aisa (http: https://mcp.aisa.one/mcp)
  ✓ server started
  ✓ handshake OK
  ✓ 5 tools discovered
```

如果是在 Grok 运行时修改的配置，输入 `/mcps` 并按 `r` 刷新 server 列表。

## 5. 使用 AIsa 能力

让 Grok 获取任何 AIsa 能提供的数据，例如：

```txt theme={null}
Use AIsa to check the recent posts of Sam Altman.
```

Grok 会搜索 AIsa 目录、读取匹配操作的 schema，然后在 `max_price_usd` 上限内执行。发现类工具（`list_categories`、`search`、`get_details`）免费；`use` 和 `batch_use` 按次计费。

## 快速参考

| 项目 | 值 |
| - | - |
| 配置文件 | `~/.grok/config.toml`（或项目内的 `.grok/config.toml`） |
| 配置段 | `[mcp_servers.aisa]` |
| `url` | `https://mcp.aisa.one/mcp` |
| 认证 | `bearer_token_env_var = "AISA_API_KEY"` |
| 验证 | `grok mcp doctor aisa` |
| 在运行中的会话里刷新 | `/mcps` → `r` |

## 故障排查

| 问题 | 解决方法 |
| - | - |
| `grok mcp doctor aisa` 报 401 | 在启动 Grok 的 shell 中确认 `echo $AISA_API_KEY` 能打印出 key，并在[控制台](https://console.aisa.one)确认 key 有效 |
| server 显示 `folder untrusted` | 项目级 server 需要受信任的目录——把配置移到 `~/.grok/config.toml`，或在 Grok 询问时信任该目录 |
| 出现了另一个 `aisa` server | Grok 也会加载 `.mcp.json` 以及 Claude / Cursor 的 MCP 配置；Grok 自己配置里的 `[mcp_servers.aisa]` 优先 |
| 当前会话里没有 AIsa 工具 | 输入 `/mcps` 并按 `r`，或开启新的 Grok 会话 |

## 相关页面

<CardGroup cols={3}>
  <Card title="在 Pi 中使用 AIsa" icon="terminal" href="/docs/zh/guides/tutorials/use-aisa-in-pi">
    在 Pi coding agent 中完成同样的 MCP 设置。
  </Card>

  <Card title="认证" icon="key" href="/docs/zh/guides/authentication">
    API key 创建、轮换和存储最佳实践。
  </Card>

  <Card title="Agent Skills" icon="puzzle-piece" href="/docs/zh/agent-skills">
    浏览 AIsa 向 agent 开放的能力。
  </Card>
</CardGroup>


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