> ## Documentation Index
> Fetch the complete documentation index at: https://ayakaleaf-pro.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP Server

每個專案都有一個 MCP Server，因此 Claude Code、Codex、Cursor、VS Code 或 Gemini CLI 等 AI 用戶端可以處理該專案：讀取與編輯其檔案、編譯專案、讀取 LaTeX 記錄、下載 PDF 並回覆留言。

<Info>
  此功能由 [ayaka-notes/ayakaleaf-pro](https://github.com/ayaka-notes/ayakaleaf-pro) 開發，自 v6.4.0 起推出。
</Info>

<Frame caption="整合 → MCP Server">
  <img src="https://mintcdn.com/ayakaleaf-pro/B2Wnor6d9VjuXpLy/images/on-premises/mcp-server-modal.png?fit=max&auto=format&n=B2Wnor6d9VjuXpLy&q=85&s=6551a9117957ff789f4d2180936e6edb" alt="編輯器中的 MCP Server 對話框" width="563" data-path="images/on-premises/mcp-server-modal.png" />
</Frame>

### 設定

MCP Server 隨 Git 整合一併提供：啟用 [git-bridge](/zh-TW/on-premises/configuration/overleaf-toolkit/git-integration) 後，MCP Server 也隨即可用。不需要其他任何設定。

### 連接 AI 用戶端

1. 在**帳號設定**中產生 Git 驗證權杖。MCP Server 與 Git 使用同一個權杖。
2. 在編輯器中開啟**整合**，然後點擊 **MCP Server**。它會顯示專案 MCP Server 的位址 `https://<your-overleaf>/project/<project_id>/mcp`，以及將其加入各 AI 用戶端的方式：複製指令，並將 `<token>` 替換為您的權杖。

### 使用方式

連接完成後，直接用日常語言向 AI 用戶端提出要求即可。例如：

| 您的要求 | AI 用戶端使用的工具 |
| - | - |
| *修正引言中的錯字。* | `read_file`、`edit_file`：編輯內容會即時顯示在編輯器中 |
| *編譯專案並修正 LaTeX 錯誤。* | `compile`、`get_compile_log`、`edit_file` |
| *回覆尚未解決的留言，然後將其標示為已解決。* | `list_comments`、`reply_to_comment`、`resolve_comment` |
| *切換至 XeLaTeX 並下載 PDF。* | `update_settings`、`compile`、`get_output_file_link` |

### 工具

| 分類 | 工具 |
| - | - |
| 專案 | `get_clone_info`、`get_settings`、`update_settings`、`list_versions` |
| 檔案 | `list_files`、`read_file`、`edit_file`、`write_file`、`delete_file` |
| 編譯 | `compile`、`get_compile_log`、`get_output_file_link`、`word_count` |
| 留言 | `list_comments`、`reply_to_comment`、`resolve_comment`、`reopen_comment` |

透過 `edit_file` 與 `write_file` 所做的編輯會即時顯示在編輯器中，並與協作者的編輯合併。若要一次處理大量檔案、二進位檔案或重新命名，AI 用戶端也可以使用 Git 複製專案並推送。

### 權限

MCP Server 與 Git 一樣，遵循專案的共用設定：

* 所有可以檢視專案的人，都可以讀取、編譯專案並下載其輸出。
* 只有擁有者與編輯者可以變更其檔案與設定。
* 審閱者也可以回覆留言，並將自己發起的留言標示為已解決或重新開啟。
* 透過連結加入的檢視者無法看到留言，與在編輯器中相同。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.