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

# 內建 MCP server

> bricks-ctor 內建的 MCP server

bricks-ctor 包含一個內建 MCP server，在執行 `bun install` 期間會自動完成設定。postinstall 指令碼會在您的 `.mcp.json` 中加入 `bricks-ctor` 項目：

```json theme={null}
{
  "mcpServers": {
    "bricks-ctor": {
      "command": "bun",
      "args": ["./node_modules/@fugood/bricks-ctor/tools/mcp-server.ts"]
    }
  }
}
```

此 server 提供專案專屬工具，供 AI 編碼代理（Claude Code、Codex、CTOR 等）與其內建工具搭配使用。

<Info>
  請參閱 [CTOR MCP 參考文件](/zh-Hant/ctor/reference/mcp)，深入了解 MCP server 的設定與管理方式。
</Info>

## 可用工具

<AccordionGroup>
  <Accordion title="compile" icon="hammer">
    執行型別檢查並編譯專案。

    在專案目錄中執行 `bun compile` 並回傳建置輸出。
  </Accordion>

  <Accordion title="preview" icon="eye">
    編譯並以無頭模式啟動應用程式預覽，然後截圖。

    | 參數              | 預設值   | 說明                |
    | --------------- | ----- | ----------------- |
    | `delay`         | 3000  | 截圖前的等待毫秒數         |
    | `width`         | 600   | 截圖寬度              |
    | `height`        | 480   | 截圖高度              |
    | `responseImage` | false | 以 base64 圖片內容回傳截圖 |
    | `testId`        | —     | 要觸發的自動化測試 ID      |
    | `testTitleLike` | —     | 以部分標題比對尋找自動化測試    |

    <Info>
      此伺服器在 [CTOR](/zh-Hant/ctor) 內執行時會停用此工具——CTOR 的代理直接驅動內嵌的[預覽面板](/zh-Hant/ctor/reference/preview)，截圖會與您在面板中看到的內容一致。
    </Info>
  </Accordion>

  <Accordion title="icon_search" icon="icons">
    以關鍵字搜尋內建的 FontAwesome 6 Pro 圖示集。

    | 參數      | 預設值 | 說明                                                        |
    | ------- | --- | --------------------------------------------------------- |
    | `query` | —   | 搜尋關鍵字                                                     |
    | `limit` | 10  | 最大結果數                                                     |
    | `style` | —   | 依樣式篩選：`brands`、`duotone`、`light`、`regular`、`solid`、`thin` |

    回傳符合的圖示名稱、Unicode 代碼及可用樣式。
  </Accordion>

  <Accordion title="lottie_search / lottie_popular / lottie_get_details" icon="film">
    從 LottieFiles 搜尋與瀏覽 Lottie 動畫。

    * **lottie\_search** — 以關鍵字搜尋，支援分頁
    * **lottie\_popular** — 瀏覽本週熱門動畫
    * **lottie\_get\_details** — 依 ID 取得特定動畫的完整詳細資訊
  </Accordion>

  <Accordion title="huggingface_search / huggingface_select" icon="microchip">
    從 Hugging Face 搜尋並選取 AI 模型，用於 BRICKS 產生器。

    **huggingface\_search** — 依產生器類型篩選搜尋模型。

    | 參數              | 預設值            | 說明                                                                                                                                                                 |
    | --------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
    | `generatorType` | `GeneratorLLM` | 產生器類型（`GeneratorLLM`、`GeneratorVectorStore`、`GeneratorReranker`、`GeneratorGGMLTTS`、`GeneratorGGMLTTSVocoder`、`GeneratorOnnxLLM`、`GeneratorOnnxSTT`、`GeneratorTTS`） |
    | `query`         | —              | 搜尋關鍵字                                                                                                                                                              |
    | `limit`         | 20             | 最大結果數                                                                                                                                                              |
    | `includeFiles`  | false          | 包含模型檔案清單                                                                                                                                                           |

    **huggingface\_select** — 取得特定模型檔案的下載 URL 與中繼資料。支援 GGUF 和 ONNX 模型、分割檔案、多模態投影檔案，以及語者嵌入。

    <Tip>
      設定 `HF_TOKEN` 環境變數以存取 Hugging Face 上的受限模型。
    </Tip>
  </Accordion>

  <Accordion title="media_boxes / media_files / media_file / media_get_box / media_upload_files" icon="photo-film">
    透過 CLI 管理您 [BRICKS](https://bricks.tools) 工作區中的媒體資產。

    * **media\_boxes** — 列出所有 media box
    * **media\_get\_box** — 取得特定 media box 的詳細資訊
    * **media\_files** — 列出 box 中的檔案（可依類型、標籤篩選，支援分頁）
    * **media\_file** — 取得特定檔案的詳細資訊
    * **media\_upload\_files** — 上傳檔案至 box，支援選用的圖片縮放、AI 分析和標籤功能
  </Accordion>
</AccordionGroup>
