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

# 安装

> 将 LI.FI Intents MCP Server 连接到你的 AI 工具的设置说明

最快的上手方式是连接到 **托管服务器**。无需安装。下面是每种受支持 AI 工具的设置说明。

## Claude Desktop

添加到你的 Claude Desktop 配置：

* **macOS**：`~/Library/Application Support/Claude/claude_desktop_config.json`
* **Windows**：`%APPDATA%\Claude\claude_desktop_config.json`
* **Linux**：`~/.config/Claude/claude_desktop_config.json`

```json theme={"system"}
{
  "mcpServers": {
    "lifi-intents": {
      "type": "http",
      "url": "https://intents-mcp.li.fi/mcp"
    }
  }
}
```

使用解算器 API 密钥以获得完整访问权限：

```json theme={"system"}
{
  "mcpServers": {
    "lifi-intents": {
      "type": "http",
      "url": "https://intents-mcp.li.fi/mcp",
      "headers": {
        "x-api-key": "your-solver-api-key"
      }
    }
  }
}
```

保存后重启 Claude Desktop。

## Claude Code

通过 CLI 添加：

```bash theme={"system"}
claude mcp add lifi-intents --transport http --url https://intents-mcp.li.fi/mcp
```

或在项目根目录添加一个 `.mcp.json` 文件（可通过 git 共享）：

```json theme={"system"}
{
  "mcpServers": {
    "lifi-intents": {
      "type": "http",
      "url": "https://intents-mcp.li.fi/mcp",
      "headers": {
        "x-api-key": "your-solver-api-key"
      }
    }
  }
}
```

测试网使用 `https://intents-mcp-testnet.li.fi/mcp`。运行 `/mcp` 进行连接。

## Cursor

添加到 `.cursor/mcp.json`（项目级）或 `~/.cursor/mcp.json`（全局）：

```json theme={"system"}
{
  "mcpServers": {
    "lifi-intents": {
      "url": "https://intents-mcp.li.fi/mcp",
      "headers": {
        "x-api-key": "your-solver-api-key"
      }
    }
  }
}
```

## Windsurf

添加到 `~/.codeium/windsurf/mcp_config.json`：

```json theme={"system"}
{
  "mcpServers": {
    "lifi-intents": {
      "serverUrl": "https://intents-mcp.li.fi/mcp",
      "headers": {
        "x-api-key": "your-solver-api-key"
      }
    }
  }
}
```

<Note>
  Windsurf 使用 `serverUrl` 而非 `url`。
</Note>

## VS Code（GitHub Copilot）

在你的项目中添加到 `.vscode/mcp.json`：

```json theme={"system"}
{
  "inputs": [
    {
      "id": "solver-api-key",
      "type": "promptString",
      "description": "LI.FI Solver API Key",
      "password": true
    }
  ],
  "servers": {
    "lifi-intents": {
      "type": "http",
      "url": "https://intents-mcp.li.fi/mcp",
      "headers": {
        "x-api-key": "${input:solver-api-key}"
      }
    }
  }
}
```

## 签署订单

**托管服务器从不持有私钥。** 你必须自行签署订单。

1. `request-quote` — 获取一份跨链交换的报价
2. `prepare-order` — 返回一个**未签名**的订单结构
3. **签署订单**：使用 EIP-712 类型化数据签名和你的钱包（例如 viem、ethers.js）
4. `submit-order` — 将已签名的订单提交到订单服务器

<Note>
  所有订单都需要 gas。签署方在源链上支付 gas 以发起跨链托管。
</Note>

## 自动签名（本地服务器）

如果你希望服务器代表你签署订单，可以带上签名密钥在本地运行 MCP 服务器：

1. 设置一个包含你私钥的 `.env` 文件：
   ```
   SIGNER_PRIVATE_KEY=0xYourPrivateKeyHere
   ```
2. 启动本地服务器——它会在 `prepare-order` 期间使用该密钥自动签署订单
3. 将你的 MCP 客户端连接到 `http://localhost:3000/mcp`，而不是托管 URL

<Warning>
  切勿分享你的私钥或将其提交到版本控制。本地服务器只应在受信任的环境中使用。
</Warning>

## 测试你的设置

你可以通过向你的 AI 工具提出一个简单问题来验证设置，例如：

> "LI.FI Intents 上有哪些可用的跨链路由？"

如果 MCP 服务器已正确连接，该工具会调用 `get-supported-routes` 并返回可用的链 + 代币对列表。

若要验证解算器工具已启用，可尝试：

> "显示我已注册的解算器身份"

如果你的 API 密钥配置正确，该工具会调用 `get-solver-identities` 并返回你已注册的地址。
