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

# MCP Server 快速入门

> 将 Tenderly MCP Server 连接到 Claude Code、Claude.ai、Claude Desktop 及其他 MCP 客户端。

在一分钟内让 Tenderly MCP Server 在您的 AI 助手中运行起来。

## 前置条件

* 一个 [Tenderly 账户](https://dashboard.tenderly.co/register)
* 至少一个 Tenderly 项目

## 连接到 MCP Server

<Tabs>
  <Tab title="Shell">
    在终端中运行以下命令：

    ```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
    claude mcp add tenderly --transport http https://mcp.tenderly.co/mcp
    ```

    验证服务器已连接：

    ```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
    claude mcp list
    ```

    在 Claude Code 中运行 `/mcp`，选择 **tenderly**，并按提示在浏览器中完成登录以进行身份验证。
  </Tab>

  <Tab title="1. Open [claude.ai](https://claude.ai) a">
    1. 打开 [claude.ai](https://claude.ai) 并进入 **Settings → Connectors**。
    2. 点击底部的 **Add custom connector**。
    3. 输入 URL：`https://mcp.tenderly.co/mcp`
    4. 点击 **Add** 并完成 OAuth 登录。

    连接完成后，Tenderly 工具将在任何对话中可用。

    > **注意：** 自定义连接器需要 Pro 或更高级别的 Claude 套餐。在 Enterprise 套餐中，只有工作区管理员可以添加连接器。
  </Tab>

  <Tab title="1. Open Claude Desktop and go to Setting">
    1. 打开 Claude Desktop 并进入 **Settings → Connectors**。
    2. 点击 **Add custom connector**。
    3. 输入 URL：`https://mcp.tenderly.co/mcp`
    4. 点击 **Add** 并完成 OAuth 登录。

    > **注意：** 自定义连接器需要 Pro 或更高级别的 Claude 套餐。在 Enterprise 套餐中，只有工作区管理员可以添加连接器。
  </Tab>

  <Tab title="JSON">
    将以下内容添加到您的 MCP 配置文件中（`.cursor/mcp.json`、`.vscode/mcp.json` 或等效文件）：

    ```json theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
    {
      "mcpServers": {
        "tenderly": {
          "type": "streamable-http",
          "url": "https://mcp.tenderly.co/mcp"
        }
      }
    }
    ```

    首次使用 Tenderly 工具时，您的编辑器将提示您进行身份验证。
  </Tab>
</Tabs>

## 第一次工具调用

连接完成后，尝试一个简单的提示以验证是否一切正常：

> "What is my account name and currently active project?"

Claude 将调用 `get_user_info`，返回您的账户信息以及当前激活的项目（如果已设置）。如果这有效，则一切就绪。

## 设置激活的项目

大多数工具需要项目上下文。每个会话设置一次即可：

> "Set my active project to my-project under my-account"

Claude 将调用 `set_active_project`。所有后续工具调用（模拟、Virtual Environments、追踪）都将使用此项目。

<Note>
  您也可以让 Claude 自动确定项目，只需让它执行某项操作，如有需要它会先调用 `list_projects`。
</Note>

## 故障排查

### 身份验证失败或连接器无法登录

如果 OAuth 登录进入循环或出错，请在 Claude 客户端中断开 Tenderly 连接器（Settings → Connectors）并重新添加。在 Claude Code 中，运行 `/mcp`，选择 **tenderly**，并重新完成浏览器登录。Claude.ai 和 Claude Desktop 上的自定义连接器需要 Pro 或更高级别套餐；在 Enterprise 套餐中，只有工作区管理员可以添加。

### "No active project" 错误

大多数工具需要项目上下文。请让 Claude 设置一个：

> "Set my active project to my-project under my-account"

或者让 Claude 通过先列出项目自动选择。

### "No active Virtual Environment" 错误

Virtual Environment 工具在激活的 Virtual Environment 上运行。可以创建/fork 一个 Virtual Environment（这会自动将其激活），或让 Claude 使用已有的 Virtual Environment ID 调用 `set_active_vnet`。

### 调用追踪或事件被截断

`get_simulation_call_trace` 的上限为 256 条，`get_simulation_events` 为 100 条。对于大型交易，请使用[高级追踪导航](/ai-tools/tools#advanced-trace-navigation)工具：先使用 `get_trace_stats` 查看大小，然后使用 `get_trace_skeleton` 查看树结构，再使用 `get_call_trace_node`、`get_subtree_events` 或 `search_call_trace` 钻取到具体部分。对于 revert，`find_failures` 和 `get_error_path` 通常是定位根本原因的最快路径。

### Claude 选错了网络、项目或 Virtual Environment

请在提示中明确指定，写明网络、项目 slug 或 Virtual Environment 名称。您也可以让 Claude 在执行任务前通过 `get_user_info` 确认激活的上下文。

### 工具调用返回过时或错误的数据

激活的项目和 Virtual Environment 状态是按会话保存的。如果您在对话中途切换项目或 Virtual Environment，请在运行后续工具前通过 `get_user_info` 确认激活的上下文。

## 后续步骤

* [工具参考](/ai-tools/tools)：查看全部 59 个工具及其功能
* [示例](/ai-tools/examples)：常见工作流的演示
* [Virtual Environments](/virtual-environments/overview)：了解可以创建的环境
* [Simulations](/simulations/overview)：理解交易模拟的工作方式
