---
title: 架構與元件
url: https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/concepts
description: MCP 通道部署中各組成部分的標準名稱、兩種憑證佈建模式，以及連線模型。
---

<Note>
  「MCP tunnels」（MCP 通道）目前處於研究預覽階段。[申請存取權限](https://claude.com/form/mcp-tunnels)即可試用。
</Note>

本頁定義了 [MCP 通道](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/overview)文件中所使用的術語。有幾個元件在設定檔、容器映像檔與說明文字中會以不同名稱出現；下列表格為每個元件提供一個標準名稱，並列出您可能會遇到的別名。

## 元件

| 術語                                  | 定義                                                                                                                                                  | 亦稱為                                                                                                                             |
| ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| **Tunnel stack（通道堆疊）**              | 您在自己的網路內執行、用以連接至通道的兩個容器：proxy 與 cloudflared。一個堆疊服務一個通道，並可跨主機複製以提高可用性。使用程式化存取時，setup 元件會與堆疊一同執行以佈建憑證。                                                | the stack、the MCP tunnel stack、the tunnel deployment、your deployment                                                            |
| **Proxy（代理）**                       | Anthropic 的路由元件。終止內層 TLS、驗證上游 IP 是否落在允許的範圍內，並依據主機名稱將每個請求路由至上游 MCP 伺服器。                                                                              | `mcp-proxy`（映像檔名稱、Compose 服務名稱及 Helm 容器名稱）、`mcp-gateway`（容器內部設定路徑 `/etc/mcp-gateway/config.yaml` 及 Helm `gateway.config.*` 值前綴） |
| **cloudflared**                     | Cloudflare 的開源通道連接器。從您的網路發起僅限出站（outbound-only）的連線至通道邊緣，並在邊緣與 proxy 之間傳輸加密流量。與 Managed Agent 無關。                                                     | the outbound connector、the tunnel connector                                                                                     |
| **Setup component（設定元件）**           | `setup` 二進位檔，隨附於 `mcp-proxy` 映像檔中。使用程式化存取時，它會透過 Workload Identity Federation 進行驗證、擷取通道權杖、產生 CA 與伺服器憑證，並向 Anthropic 註冊該 CA。亦提供 `renew-cert`。         | setup Job（Helm pre-install hook）、`setup` service（Compose profile）、setup hook、setup binary、setup CLI                             |
| **Tunnel edge（通道邊緣）**               | cloudflared 向外撥接的 Cloudflare 邊緣伺服器（IP 範圍 `198.41.192.0/19` 與 `2606:4700:a0::/44`，連接埠 7844 TCP 與 UDP）。在其上運行的通道由 Anthropic 佈建與控制；Cloudflare 負責營運底層網路。 | the edge、the Anthropic-operated tunnel edge                                                                                     |
| **Inner TLS（內層 TLS）**               | 在通道的明文 WebSocket 串流內部進行的第二次 TLS 交握，介於 Anthropic 的後端與您的 proxy 之間。proxy 會出示由您在通道上註冊之 CA 所簽署的伺服器憑證。由於只有您持有私鑰，傳輸供應商無法讀取請求或回應的內容。                        | the inner TLS handshake                                                                                                         |
| **Upstream MCP server（上游 MCP 伺服器）** | 在您的私有網路中執行、由 proxy 路由至的 MCP 伺服器。每個上游會以您通道網域下的一個子網域對外公開。                                                                                             | upstream、routed MCP server、tunneled MCP server                                                                                  |

## 憑證佈建

通道堆疊在執行期間需要兩項憑證：**tunnel token（通道權杖）**，用於驗證 cloudflared 的出站連線；以及由通道上已註冊之 CA 所簽署的 **server certificate（伺服器憑證）**，由 proxy 在內層 TLS 交握期間出示。提供這些憑證有兩種方式，在本指南中以一組分頁的形式呈現。

| 模式                             | 憑證如何送達堆疊                                                                                                                                                                                                                                | Helm chart 名稱                           | 分頁標籤         |
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- | ------------ |
| **Programmatic access（程式化存取）** | setup 元件透過 [Workload Identity Federation](https://platform.claude.com/docs/zh-TW/manage-claude/workload-identity-federation) 向 Tunnels API 進行驗證、擷取通道權杖、在本機產生 CA 與伺服器憑證，並註冊該 CA。無需手動複製任何長期有效的機密。需要具備 `workspace:manage_tunnels` 範圍的聯合規則。 | Managed mode（`setup.enabled: true`，預設值） | **使用程式化存取**  |
| **Manual（手動）**                 | 您從 Claude Console 複製通道權杖、自行產生 CA 與伺服器憑證（例如使用 `openssl`）、在 Console 中註冊該 CA，並將權杖與憑證以機密形式提供給堆疊。不會執行 setup 元件。                                                                                                                              | External mode（`setup.enabled: false`）   | **不使用程式化存取** |

這些模式在部署指南中亦稱為 **the programmatic flow（程式化流程）** 與 **the manual flow（手動流程）**。

## 連線模型

通道中有兩個方向在運作，且彼此指向相反：

* **連線方向：** cloudflared 從您的網路**向外（outbound）**&#x64A5;接至通道邊緣。您的防火牆只會看到連接埠 7844 上的出站流量；不會開啟任何入站連接埠。
* **請求方向：** 一旦該連線建立，MCP 請求便會透過它**從 Anthropic 朝您的網路**傳送，經由 cloudflared 到達 proxy，再送往上游 MCP 伺服器。

「outbound-only（僅限出站）」一詞描述的是連線本身，而非透過該連線傳輸的請求。

內層 TLS 橫跨 Anthropic 的後端與您的 proxy。cloudflared 與通道邊緣在線路上位於兩者之間，但只能看到密文；proxy 是您網路內部第一個能夠讀取 MCP 請求內容的位置。

```mermaid
sequenceDiagram
  accTitle: How a request reaches an MCP server through a tunnel
  accDescr: cloudflared, the proxy, and the upstream MCP server run inside your network. cloudflared opens an outbound connection on port 7844 to the tunnel edge on the Cloudflare network. The connection stays open, and no inbound port is opened. The Anthropic backend sends an MCP request to the tunnel edge over outer mTLS. The edge carries it over the open connection to cloudflared, which passes it to the proxy on localhost:8080. Inner TLS spans the Anthropic backend to the proxy and terminates at the proxy. The proxy routes the request by hostname to the upstream MCP server. The response returns along the same path, reversed.
  participant A as Anthropic<br/>backend
  participant E as Tunnel edge<br/>(Cloudflare network)
  participant C as cloudflared
  participant P as Proxy
  participant M as Upstream<br/>MCP server

  note over C,M: Inside your network

  C->>E: 1. Outbound connection (port 7844)
  note over C,E: Connection stays open.<br/>No inbound port is opened.

  A->>E: 2. MCP request (outer mTLS)
  E->>C: carried over the open connection
  C->>P: localhost:8080
  note over A,P: Inner TLS spans Anthropic backend to proxy.<br/>Terminates at the proxy.
  P->>M: 3. Route by hostname
  M-->>P: response
  P-->>A: response (same path, reversed)
```

## 另請參閱

* [MCP 通道](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/overview)：了解安全模型與共同責任表。
* [MCP 通道參考](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/reference)：了解 proxy 設定欄位、憑證需求與 setup 元件。
