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

# 快速开始

> 完整的 Unla(MCP Gateway) 部署和配置指南

## 一键启动 MCP Gateway

> 所有的服务的配置项都可以通过环境变量注入的方式来改变

这边需要注意几个环境变量的内容要改一下（其他的环境变量请根据实际情况自行判断是否调整）：

```bash theme={null}
export APISERVER_JWT_SECRET_KEY="changeme-please-generate-a-random-secret"
export SUPER_ADMIN_USERNAME="admin"
export SUPER_ADMIN_PASSWORD="changeme-please-use-a-secure-password"
```

## GHCR镜像

使用 GitHub Container Registry 镜像：

```bash theme={null}
docker run -d \
  --name unla \
  -p 8080:80 \
  -p 5234:5234 \
  -p 5235:5235 \
  -p 5335:5335 \
  -p 5236:5236 \
  -e ENV=production \
  -e TZ=Asia/Shanghai \
  -e APISERVER_JWT_SECRET_KEY=${APISERVER_JWT_SECRET_KEY} \
  -e SUPER_ADMIN_USERNAME=${SUPER_ADMIN_USERNAME} \
  -e SUPER_ADMIN_PASSWORD=${SUPER_ADMIN_PASSWORD} \
  --restart unless-stopped \
  ghcr.io/amoylab/unla/allinone:latest
```

## ALIYUN镜像

中国境内的设备可以拉阿里云仓库的镜像：

```bash theme={null}
export APISERVER_JWT_SECRET_KEY="changeme-please-generate-a-random-secret"
export SUPER_ADMIN_USERNAME="admin"
export SUPER_ADMIN_PASSWORD="changeme-please-use-a-secure-password"
```

使用阿里云镜像启动：

```bash theme={null}
docker run -d \
  --name unla \
  -p 8080:80 \
  -p 5234:5234 \
  -p 5235:5235 \
  -p 5335:5335 \
  -p 5236:5236 \
  -e ENV=production \
  -e TZ=Asia/Shanghai \
  -e APISERVER_JWT_SECRET_KEY=${APISERVER_JWT_SECRET_KEY} \
  -e SUPER_ADMIN_USERNAME=${SUPER_ADMIN_USERNAME} \
  -e SUPER_ADMIN_PASSWORD=${SUPER_ADMIN_PASSWORD} \
  --restart unless-stopped \
  registry.ap-southeast-1.aliyuncs.com/amoylab/unla-allinone:latest
```

## 访问和配置

<Steps>
  <Step title="访问 Web 界面">
    在浏览器中打开 [http://localhost:8080/](http://localhost:8080/) 使用配置的管理员账号密码登录
  </Step>

  <Step title="添加 MCP Server">
    1. 复制配置文件：[https://github.com/AmoyLab/Unla/blob/main/configs/proxy-mock-server.yaml](https://github.com/AmoyLab/Unla/blob/main/configs/proxy-mock-server.yaml)
    2. 在 Web 界面上点击 "Add MCP Server"
    3. 粘贴配置并保存
  </Step>
</Steps>

## 可用端点

配置完成后，服务将在以下端点可用：

<CardGroup cols={1}>
  <Card title="MCP 端点" icon="link">
    * **MCP SSE**: `http://localhost:5235/gateway/user/sse`
    * **MCP SSE Message**: `http://localhost:5235/gateway/user/message`
    * **MCP Streamable HTTP**: `http://localhost:5235/gateway/user/mcp`
  </Card>
</CardGroup>

在 MCP Client 中配置 `/sse` 或 `/mcp` 后缀的 URL 即可开始使用。

## 测试

您可以通过以下两种方式测试服务：

<CardGroup cols={2}>
  <Card title="Web 界面测试" icon="globe">
    使用 Web 界面中的 MCP Chat 页面进行测试
  </Card>

  <Card title="MCP Client 测试" icon="terminal">
    使用您自己的 MCP Client（**推荐**）
  </Card>
</CardGroup>

## 高级配置（可选）

如果您需要更细粒度的配置控制，可以通过挂载配置文件的方式启动：

<Steps>
  <Step title="创建目录并下载配置">
    ```bash theme={null}
    mkdir -p unla/{configs,data}
    cd unla/
    curl -sL https://raw.githubusercontent.com/amoylab/unla/refs/heads/main/configs/apiserver.yaml -o configs/apiserver.yaml
    curl -sL https://raw.githubusercontent.com/amoylab/unla/refs/heads/main/configs/mcp-gateway.yaml -o configs/mcp-gateway.yaml
    curl -sL https://raw.githubusercontent.com/amoylab/unla/refs/heads/main/.env.example -o .env.allinone
    ```
  </Step>

  <Step title="使用配置文件启动">
    ```bash theme={null}
    docker run -d \
               --name unla \
               -p 8080:80 \
               -p 5234:5234 \
               -p 5235:5235 \
               -p 5335:5335 \
               -p 5236:5236 \
               -e ENV=production \
               -v $(pwd)/configs:/app/configs \
               -v $(pwd)/data:/app/data \
               -v $(pwd)/.env.allinone:/app/.env \
               --restart unless-stopped \
               ghcr.io/amoylab/unla/allinone:latest
    ```
  </Step>
</Steps>

<Tip>
  通过挂载配置文件，您可以更精确地控制各个服务的配置参数。详细配置说明请参考[配置文档](/configuration/apiserver)。
</Tip>
