> ## Documentation index
> Fetch the complete documentation index at: https://tgcloud.docs7.io/llms.txt
> Ask it with GET https://tgcloud.docs7.io/ask?q=<keywords or question>. Short keywords rank best.
> Use these to discover all available pages before exploring further.

# 安装

> 安装 tgcloud-mcp 并连接 MCP 客户端

# 安装

需要 **Node.js 20+**。平台 CLI 本身需要 Node.js 18+。

<CardGroup cols={2}>
  <Card title="npm" icon="box" href="#npm">
    npm install -g tgcloud-mcp，然后 tgcloud-mcp setup
  </Card>
  <Card title="一条命令" icon="terminal" href="#curl-bash">
    curl | bash — 先选语言，再横幅和向导
  </Card>
  <Card title="Docker" icon="layers" href="#docker">
    ghcr.io/sdamarketing/tgcloud-mcp，stdio，主机不必装 Node
  </Card>
  <Card title="客户端配置" icon="plug" href="#clients">
    opencode、Claude Code、Cursor、VS Code
  </Card>
</CardGroup>

## 从 npm 安装 {#npm}

```bash
npm install -g tgcloud-mcp
tgcloud-mcp setup
```

向导会写入 MCP 配置，并询问是否安装 [Agent Plugin](https://agent-plugins.org)（仓库中的 `agent-plugin/`）。副本放在 `~/.tgcloud-mcp/agent-plugin`。Cursor 使用 `~/.cursor/plugins/local/tgcloud`。VS Code 会增加一条 `chat.pluginLocations`。Codex、Copilot 和 Kiro 通过各自的插件界面加载同一目录。

Claude Code 和 opencode 继续使用 MCP 配置。Skill 用下面的命令安装：

```bash
npx skills add sdamarketing/tgcloud_mcp
```

## 一条命令 {#curl-bash}

```bash
curl -fsSL https://raw.githubusercontent.com/sdamarketing/tgcloud_mcp/main/install.sh | bash
```

克隆到 `~/.tgcloud-mcp`，构建，然后运行向导。再次运行即更新。
脚本先询问语言（English、Русский、中文、العربية、Deutsch、Français；
直接回车是英语，也可以设置 `TGCLOUD_MCP_LANG`）。然后打印带框横幅
（真彩色终端上为蓝色渐变），并在克隆、安装和构建时显示进度。
向导使用同一语言，并从 `/dev/tty` 读取，因此 `curl | bash` 时仍会提问。

## Docker {#docker}

```bash
docker run -i --rm ghcr.io/sdamarketing/tgcloud-mcp
```

## 手动配置 {#clients}

**opencode**（`~/.config/opencode/opencode.json`）：

```json
{ "mcp": { "tgcloud": { "type": "local", "command": ["npx", "-y", "tgcloud-mcp"], "enabled": true } } }
```

**Claude Code / Cursor：**

```json
{ "mcpServers": { "tgcloud": { "command": "npx", "args": ["-y", "tgcloud-mcp"] } } }
```

**VS Code**（`mcp.json`）：

```json
{ "servers": { "tgcloud": { "type": "stdio", "command": "npx", "args": ["-y", "tgcloud-mcp"] } } }
```

## 环境变量

| 变量 | 默认值 | 作用 |
|---|---|---|
| `TGCLOUD_CLI` | `npx` | 启动 CLI 的命令（可以是代理包装） |
| `TGCLOUD_CLI_ARGS` | `tgcloud` | 子命令前面的参数 |
| `TGCLOUD_TIMEOUT_MS` | `120000` | 单条命令超时。`deploy` 为 `npm run build` 至少留 300000 毫秒 |
| `TGCLOUD_TOKEN` | — | CLI access token，用来代替 `tgcloud login` |
