---
title: 使用 Helm 部署 MCP 通道
url: https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/deploy-helm
description: 使用 Anthropic Helm chart 在 Kubernetes 叢集上安裝通道堆疊。
---

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

Anthropic Helm chart 會將[通道堆疊（tunnel stack）](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/concepts#components)安裝為單一 Deployment，並將其附加到您的通道：可以是 chart 的 setup hook 為您建立的通道，也可以是您在 [Console](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/console#create-a-tunnel) 中建立的既有通道。

## 開始之前

您需要：

* **一個通道。** 使用程式化存取時，若您未提供通道 ID，chart 的 setup hook 會為您建立一個；若要改為附加到既有通道，請[在 Console 中建立它](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/console#create-a-tunnel)並記下通道 ID（`tnl_...`）。手動佈建一律從 Console 建立的通道開始；您還需要它的通道權杖（tunnel token）與通道網域（tunnel domain）。

* **讓 chart 向 Tunnels API 進行驗證的方式。**

  * **[程式化存取（Programmatic access）](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/concepts#credential-provisioning)（建議）。** [setup 元件](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/concepts#components)透過 Workload Identity Federation 進行驗證、擷取通道權杖、產生 CA、向 Anthropic 註冊該 CA，並將所有內容儲存在一個 Secret 中。您需要一條範圍限定為 `workspace:manage_tunnels` 的 federation rule。
  * **[手動（Manual）](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/concepts#credential-provisioning)。** 略過程式化存取。您將[從 Console 取得通道權杖](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/console#get-the-connection-details)、自行產生 CA 與伺服器憑證、[在 Console 中註冊 CA](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/console#add-a-ca-certificate)，並以 Secret 的形式將憑證提供給叢集。

* **一個 Kubernetes 叢集**，您可以使用 `helm` 與 `kubectl` 部署至該叢集。**不使用程式化存取**分頁還會用到 `openssl`（1.1.1 或更新版本）。

* **對外網路連線能力**，從叢集連至 `api.anthropic.com`（443 TCP）以及[通道邊緣（tunnel edge）](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/concepts#components)（7844 TCP 與 UDP）。請參閱完整的[網路需求](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/overview#network-requirements)。

* **一個或多個 MCP 伺服器**，正在執行中，且可從叢集透過您將在 `gateway.config.routes` 下設定的位址連線。如果您還沒有，請[使用範例伺服器](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/deploy-helm#optional-use-a-sample-mcp-server)。

## 選用：使用範例 MCP 伺服器

如果您沒有可供測試的 MCP 伺服器，請使用這個最精簡的版本：

```bash
kubectl create namespace mcp-tunnel --dry-run=client -o yaml | kubectl apply -f -
kubectl -n mcp-tunnel apply -f - <<'EOF'
apiVersion: v1
kind: ConfigMap
metadata:
  name: hello-mcp-src
data:
  hello_server.py: |
    from mcp.server.fastmcp import FastMCP

    mcp = FastMCP("hello-server", host="0.0.0.0", port=9000)


    @mcp.tool()
    def hello(name: str = "world") -> str:
        """Say hello to someone."""
        return f"Hello, {name}!"


    if __name__ == "__main__":
        mcp.run(transport="streamable-http")
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello-mcp
spec:
  replicas: 1
  selector:
    matchLabels: { app: hello-mcp }
  template:
    metadata:
      labels: { app: hello-mcp }
    spec:
      containers:
        - name: hello-mcp
          image: python:3.13-slim
          command: ["sh", "-c", "pip install --quiet mcp && python /app/hello_server.py"]
          volumeMounts:
            - { name: src, mountPath: /app }
          ports:
            - { containerPort: 9000 }
      volumes:
        - name: src
          configMap: { name: hello-mcp-src }
---
apiVersion: v1
kind: Service
metadata:
  name: hello-mcp
spec:
  selector: { app: hello-mcp }
  ports:
    - { port: 9000, targetPort: 9000 }
EOF
```

接下來的安裝步驟會註明應在何處加入對應的路由。

## 安裝

<Tabs>
  <Tab title="使用程式化存取">
    setup 元件會透過您的 federation rule 交換叢集投射的 ServiceAccount 權杖、擷取通道權杖、產生 CA 與伺服器憑證，並向 Anthropic 註冊該 CA。每日執行的 CronJob 會視需要更新伺服器憑證，因此您無需手動處理任何機密資料。

    <Steps>
      <Step title="為叢集設定 Workload Identity Federation">
        請依照[搭配 Kubernetes 使用 WIF](https://platform.claude.com/docs/zh-TW/manage-claude/wif-providers/kubernetes) 註冊叢集的 OIDC issuer 並建立 federation rule。setup 元件在 release 命名空間中以其專屬的 ServiceAccount 執行；確切名稱遵循 Helm 的 `fullname` 慣例，因此對於 `mcp-tunnel` 以外的任何 release 名稱，請在建立規則前執行 `helm template <release> ... | grep -A2 'kind: ServiceAccount'` 加以確認。本指南其餘部分假設 release 名稱為 `mcp-tunnel`、命名空間為 `mcp-tunnel`，此時 ServiceAccount 為 `mcp-tunnel-setup`。

        | 欄位       | 值                                                   |
        | -------- | --------------------------------------------------- |
        | Subject  | `system:serviceaccount:mcp-tunnel:mcp-tunnel-setup` |
        | Audience | `api.anthropic.com`（chart 的預設值；不含 scheme）           |
        | Scope    | `workspace:manage_tunnels`                          |

        <Note>
          chart 的預設 audience 為不含 scheme 的 `api.anthropic.com`，但 Console 的 federation-rule 表單建議的是 `https://api.anthropic.com`。兩者必須逐位元組完全相符，否則驗證會失敗。請將規則的 audience 設為 `api.anthropic.com`，或將 `values.yaml` 中的 `api.wif.audience` 設為 `https://api.anthropic.com`。
        </Note>

        如果通道位於組織預設工作區以外的工作區，還需[將規則的服務帳戶新增到該工作區](https://platform.claude.com/docs/zh-TW/manage-claude/workspaces#role-inheritance)（Tunnels API 會依據服務帳戶的工作區成員資格進行授權）。

        記下規則的 ID（`fdrl_...`）；您將把它設為 `api.wif.federationRuleId`。

        <Note>
          每日憑證更新 CronJob 使用另一個 ServiceAccount（同樣衍生自 Helm `fullname`），但不會呼叫 Tunnels API；它在本機更新憑證，只需要 chart 所授予的 Kubernetes RBAC。federation rule 不需要涵蓋它。
        </Note>
      </Step>

      <Step title="擷取預設值">
        ```bash
        helm show values \
          oci://us-docker.pkg.dev/anthropic-public-registry/charts/mcp-tunnel \
          --version 2.0.2 > values.yaml
        ```
      </Step>

      <Step title="設定通道附加與路由">
        編輯 `values.yaml`，以 federation rule ID 與組織 ID 設定 `api.wif.*` 鍵，並為每個[上游 MCP 伺服器](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/concepts#components)加入一個 `routes` 項目：

        ```yaml values.yaml
        api:
          wif:
            federationRuleId: "fdrl_..."
            organizationId: "00000000-0000-0000-0000-000000000000"
            # Set when the tunnel is in a non-default workspace and the
            # rule's service account is a member of that workspace.
            # workspaceId: "wrkspc_..."

        tunnel:
          # Leave empty to have the setup hook create a tunnel during install.
          # Set to attach to an existing tunnel from the Console.
          id: ""
          # Increment to rotate the tunnel token on the next upgrade.
          # See the "Rotate the tunnel token" section.
          tokenVersion: "1"

        gateway:
          config:
            routes:
              docs: http://docs-mcp.internal:8080
              search: http://search-mcp.internal:8080
        ```

        有了這些路由，Claude 會透過 `docs.<your-tunnel-domain>` 與 `search.<your-tunnel-domain>` 連線至這些伺服器。部分受管 Kubernetes 發行版會將 Service CIDR 配置在標準私有範圍之外；如果您的路由目標是叢集內的 Service，請依照[上游 IP 驗證](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/troubleshooting#upstream-ip-validation)在此加入 `gateway.config.upstream.allowed_ips`。

        <Note>
          如果您使用的是[範例 MCP 伺服器](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/deploy-helm#optional-use-a-sample-mcp-server)，請改將 `routes` 設為 `echo: http://hello-mcp:9000`。
        </Note>
      </Step>

      <Step title="檢視轉譯後的資訊清單">
        轉譯 chart，並依照您組織的審查慣例檢視輸出：

        ```bash
        helm template mcp-tunnel \
          oci://us-docker.pkg.dev/anthropic-public-registry/charts/mcp-tunnel \
          --version 2.0.2 \
          -n mcp-tunnel \
          -f values.yaml > rendered.yaml
        ```
      </Step>

      <Step title="安裝">
        ```bash
        helm install mcp-tunnel \
          oci://us-docker.pkg.dev/anthropic-public-registry/charts/mcp-tunnel \
          --version 2.0.2 \
          --namespace mcp-tunnel --create-namespace \
          -f values.yaml
        ```

        setup 元件以 Helm pre-install hook Job 的形式執行，因此 `helm install` 會阻塞直到它完成。成功時 Helm 會自動刪除該 Job。如果 `helm install` 因 hook 錯誤而失敗，請參閱 [setup 元件驗證失敗](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/troubleshooting#setup-component-authentication-failures)。

        當 `tunnel.id` 為空時，setup 元件會在您的 federation rule 所指向的工作區中建立通道（除非您設定了 `api.wif.workspaceId`，否則為組織的預設工作區），並將其 ID 和網域儲存在 `mcp-tunnel` Secret 中。您可以在通道的詳細資料頁面上找到[驗證](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/deploy-helm#verify-the-deployment)所需的網域，該頁面可從 Console 中的 [MCP tunnels](https://platform.claude.com/settings/workspaces/default/mcp-tunnels) 頁面（`platform.claude.com/settings/workspaces/default/mcp-tunnels`）開啟。在側邊欄的工作區選擇器中，選取包含該通道的工作區。您也可以從 Secret 讀取網域：

        ```bash
        kubectl -n mcp-tunnel get secret mcp-tunnel \
          -o jsonpath='{.data.tunnel-domain}' | base64 -d
        ```

        重新執行 setup 元件（在[升級](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/deploy-helm#upgrades)或[權杖輪替](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/deploy-helm#rotate-the-tunnel-token)期間）會重複使用儲存在此 Secret 中的通道 ID；它絕不會建立第二個通道。

        <Warning>
          `api.wif.*` 值是識別碼而非機密，因此將它們儲存在 Helm release 歷史 Secret 中並無風險。靜態儲存的敏感資料是 setup 元件建立的 `mcp-tunnel` Secret，其中保存通道權杖與 TLS 私密金鑰。請對此命名空間套用您組織保護 Kubernetes Secret 的標準做法。
        </Warning>
      </Step>
    </Steps>
  </Tab>

  <Tab title="不使用程式化存取">
    在此模式下（`setup.enabled: false`），chart 不會進行任何 API 呼叫；setup 元件不會執行，也沒有 cert-renew CronJob。如果您不想設定 Workload Identity Federation，請使用此途徑。

    <Steps>
      <Step title="取得通道權杖與網域">
        [建立通道](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/console#create-a-tunnel)並[從 Console 取得通道權杖](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/console#get-the-connection-details)。

        <Note>
          記下詳細資料頁面上的通道網域。您將把它設為 `gateway.config.tunnel_domain`。
        </Note>
      </Step>

      <Step title="產生 CA 與伺服器憑證">
        proxy 監聽純 WebSocket，[內層 TLS（inner TLS）](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/concepts#components)則使用您在此產生的憑證承載於該串流之中。依照[憑證需求](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/reference#certificate-requirements)，伺服器憑證的 SAN 必須包含 `*.<tunnel-domain>`。

        ```bash
        export TUNNEL_DOMAIN=YOUR_TUNNEL_DOMAIN_HERE
        mkdir -p mcp-tunnel/data
        cd mcp-tunnel

        # 自簽 CA。明確指定擴充欄位，使其無論發行版的 openssl.cnf 預設值為何，
        # 皆能符合憑證要求。
        openssl req -x509 -newkey rsa:2048 -nodes \
          -keyout data/ca.key -out data/ca.crt \
          -days 3650 -subj "/CN=mcp-tunnel-ca" \
          -addext "basicConstraints=critical,CA:TRUE" \
          -addext "keyUsage=critical,keyCertSign,cRLSign" \
          -addext "subjectKeyIdentifier=hash"

        # 伺服器憑證的擴充設定檔。使用 -extfile（而非僅限 OpenSSL 3.0+ 的
        # -copy_extensions），可讓此流程在
        # OpenSSL 1.1.x 上持續運作。
        cat > data/tls.ext <<EOF
        subjectAltName = DNS:${TUNNEL_DOMAIN},DNS:*.${TUNNEL_DOMAIN}
        authorityKeyIdentifier = keyid,issuer
        extendedKeyUsage = serverAuth
        EOF

        # 由 CA 簽署的伺服器憑證
        openssl req -newkey rsa:2048 -nodes \
          -keyout data/tls.key -out /tmp/server.csr \
          -subj "/CN=${TUNNEL_DOMAIN}"
        openssl x509 -req -in /tmp/server.csr \
          -CA data/ca.crt -CAkey data/ca.key -CAcreateserial \
          -out data/tls.crt -days 90 \
          -extfile data/tls.ext
        ```

        [在 Console 中註冊 `data/ca.crt`](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/console#add-a-ca-certificate)。請將 `data/ca.key` 保存在持久且安全的地方；更新時您需要用它來簽署新的伺服器憑證。
      </Step>

      <Step title="建立兩個 Secret">
        chart 會讀取特定的鍵；Secret 名稱可設定，但鍵不可。如果命名空間已存在（例如來自[範例 MCP 伺服器](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/deploy-helm#optional-use-a-sample-mcp-server)步驟），下列建立命名空間的指令不會有任何作用。

        ```bash
        kubectl create namespace mcp-tunnel --dry-run=client -o yaml | kubectl apply -f -
        kubectl -n mcp-tunnel create secret generic mcp-tunnel-token \
          --from-literal=tunnel-token='eyJ...'
        kubectl -n mcp-tunnel create secret generic mcp-tunnel-cert \
          --from-file=tls.crt=data/tls.crt \
          --from-file=tls.key=data/tls.key
        ```
      </Step>

      <Step title="擷取預設值">
        ```bash
        helm show values \
          oci://us-docker.pkg.dev/anthropic-public-registry/charts/mcp-tunnel \
          --version 2.0.2 > values.yaml
        ```
      </Step>

      <Step title="設定手動佈建的值">
        編輯 `values.yaml` 並設定下列鍵：

        ```yaml values.yaml
        setup:
          enabled: false

        external:
          tunnelTokenSecretName: mcp-tunnel-token   # must contain key: tunnel-token
          serverCertSecretName: mcp-tunnel-cert     # must contain keys: tls.crt, tls.key

        gateway:
          config:
            # Required when setup.enabled is false. Replace the placeholder with
            # the $TUNNEL_DOMAIN value you exported earlier. When setup.enabled
            # is true the chart injects this from the Secret as a -tunnel-domain
            # flag instead.
            tunnel_domain: YOUR_TUNNEL_DOMAIN_HERE
            routes:
              docs: http://docs-mcp.internal:8080
              search: http://search-mcp.internal:8080
        ```

        部分受管 Kubernetes 發行版會將 Service CIDR 配置在標準私有範圍之外；如果您的路由目標是叢集內的 Service，請依照[上游 IP 驗證](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/troubleshooting#upstream-ip-validation)在此加入 `gateway.config.upstream.allowed_ips`。

        <Note>
          如果您使用的是[範例 MCP 伺服器](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/deploy-helm#optional-use-a-sample-mcp-server)，請改將 `routes` 設為 `echo: http://hello-mcp:9000`。
        </Note>
      </Step>

      <Step title="檢視轉譯後的資訊清單">
        ```bash
        helm template mcp-tunnel \
          oci://us-docker.pkg.dev/anthropic-public-registry/charts/mcp-tunnel \
          --version 2.0.2 \
          -n mcp-tunnel \
          -f values.yaml > rendered.yaml
        ```
      </Step>

      <Step title="安裝">
        ```bash
        helm install mcp-tunnel \
          oci://us-docker.pkg.dev/anthropic-public-registry/charts/mcp-tunnel \
          --version 2.0.2 \
          --namespace mcp-tunnel --create-namespace \
          -f values.yaml
        ```
      </Step>
    </Steps>
  </Tab>
</Tabs>

## 驗證部署

從 Anthropic 端進行端對端驗證：在 Managed Agent 工作階段或 Messages API 請求中使用 `https://<route>.<your-tunnel-domain>/<path>`，其中 `<route>` 是 `gateway.config.routes` 中的一個鍵，`<path>` 則是上游 MCP 伺服器提供服務的路徑。使用[範例 MCP 伺服器](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/deploy-helm#optional-use-a-sample-mcp-server)時，即為 `https://echo.<your-tunnel-domain>/mcp`。請參閱[使用通道化的 MCP 伺服器](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/overview#use-the-tunneled-mcp-servers)以了解請求格式。

如果失敗，請檢查 pod 日誌（`kubectl -n mcp-tunnel logs deploy/mcp-tunnel -c mcp-proxy` 與 `-c cloudflared`），並參閱[疑難排解](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/troubleshooting)。

## 選用設定

### 使用 NetworkPolicy 限制對外流量

預設會拒絕進入 proxy pod 的流量（`networkPolicy.ingress.enabled: true`）。若要進一步限制 pod 的對外流量，請設定 `networkPolicy.egress.enabled: true`，並在 `networkPolicy.egress.mcpServers` 中填入涵蓋您上游 MCP 伺服器的 pod 標籤選擇器或 CIDR 範圍。從 cloudflared 到通道邊緣的對外流量則透過 `networkPolicy.egress.cloudflaredEgressCIDRs` 另行允許。

### 調整 proxy

`gateway.config.*` 下的欄位會直接傳遞至 proxy 設定檔。常見的調整包括 `upstream.allowed_ips`、`log_level` 與 `upstream.tls`。完整欄位清單請參閱 [proxy 設定](https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/reference#proxy-configuration)參考文件。chart 一律會設定 `listen_addr`、`tls.cert_file` 與 `tls.key_file`；在 `gateway.config` 中設定它們不會有任何效果。

### 提供您自己的 OIDC 權杖

預設情況下，chart 會為 setup 元件投射一個 Kubernetes ServiceAccount 權杖。若要使用來自其他身分提供者（例如 [SPIFFE](https://platform.claude.com/docs/zh-TW/manage-claude/wif-providers/spiffe)、Vault 或雲端 SDK sidecar）的權杖，請使用 `setup.extraVolumes` 與 `setup.extraVolumeMounts` 掛載它。接著將 `api.wif.tokenFile` 指向掛載路徑。chart 會將 `ANTHROPIC_IDENTITY_TOKEN_FILE` 設為該路徑，setup 元件會從該處讀取權杖。

## 升級

請一律將 `--version` 傳遞給 `helm upgrade`，以免意外拉取較新的 chart。

### 從 chart 1.x 升級

Chart 2.0.0 將通道 ID 從 `api.wif.tunnelId` 移至 `tunnel.id`。升級前，請編輯您的 `values.yaml`：將 `tnl_...` 值移至 `tunnel.id` 並移除 `api.wif.tunnelId`。不設定 `tunnel.id` 是安全的（setup 元件重新執行時會重複使用已儲存在 `mcp-tunnel` Secret 中的通道 ID），但明確搬移可讓您的 `values.yaml` 保持準確。也請在 Console 中將 federation rule 的範圍從 `org:manage_tunnels` 更新為 `workspace:manage_tunnels`。

### 變更設定

對於路由、副本數量或 NetworkPolicy 等例行變更：

```bash
helm upgrade mcp-tunnel \
  oci://us-docker.pkg.dev/anthropic-public-registry/charts/mcp-tunnel \
  --version 2.0.2 \
  -n mcp-tunnel \
  -f values.yaml
```

<Warning>
  請維護一份完整的 `values.yaml`，而非依賴 `--reuse-values`。Helm 的深度合併行為可能會在無聲無息中未能移除已刪除的路由。
</Warning>

### 輪替通道權杖

使用程式化存取時，請遞增 `values.yaml` 中的 `tunnel.tokenVersion`，並以 `--set setup.force=true` 進行升級。setup 元件只有在強制時才會於升級期間重新執行：

```bash
helm upgrade mcp-tunnel \
  oci://us-docker.pkg.dev/anthropic-public-registry/charts/mcp-tunnel \
  --version 2.0.2 \
  -n mcp-tunnel \
  -f values.yaml \
  --set setup.force=true
```

setup 元件以 Workload Identity Federation 進行驗證；沒有需要撤銷的 API 權杖。

不使用程式化存取時，請在 Console 的通道詳細資料頁面按一下 **Rotate token**，然後更新 `mcp-tunnel-token` Secret：

```bash
kubectl -n mcp-tunnel create secret generic mcp-tunnel-token \
  --from-literal=tunnel-token='eyJ...' --dry-run=client -o yaml | kubectl apply -f -
kubectl -n mcp-tunnel rollout restart deploy/mcp-tunnel
```

<Warning>
  按一下 **Rotate token** 會立即使目前的權杖失效。在 Secret 更新且 rollout 完成之前，任何以舊權杖重新啟動的 pod（驅逐、節點排空、OOM）都無法重新連線。輪替後請儘速更新 Secret；若有更嚴格的可用性需求，請使用程式化存取，讓 chart 以原子方式處理輪替。
</Warning>

### 憑證更新

chart 提供自動化機制，但您仍須負責監控到期時間並確認更新完成。

使用程式化存取時，憑證更新是自動的。chart 會部署一個 CronJob（以 Helm `fullname` 命名，後綴為 `-cert-renew`），每日執行 `setup renew-cert`（於 `serverCert.cronSchedule`，預設為 `0 0 * * *` UTC）。除非憑證距離到期已在 `serverCert.renewBefore` 之內（預設 30 天），否則該工作不會有任何作用。更新在本機進行：該工作以已儲存在 Secret 中的 CA 簽署新憑證，不進行任何 API 呼叫，且只需要 chart 所授予的 Kubernetes RBAC。proxy 會從 Secret 掛載熱重新載入憑證，因此不需要重新啟動 Deployment。

不使用程式化存取時沒有 CronJob。請在安裝後保留的 `mcp-tunnel/` 目錄內，以既有的 CA 簽署新的伺服器憑證（請勿重新產生 CA）：

```bash
export TUNNEL_DOMAIN=YOUR_TUNNEL_DOMAIN_HERE
openssl req -new -key data/tls.key -out /tmp/server.csr \
  -subj "/CN=${TUNNEL_DOMAIN}"
openssl x509 -req -in /tmp/server.csr \
  -CA data/ca.crt -CAkey data/ca.key -CAcreateserial \
  -out data/tls.crt -days 90 -extfile data/tls.ext

kubectl -n mcp-tunnel create secret generic mcp-tunnel-cert \
  --from-file=tls.crt=data/tls.crt --from-file=tls.key=data/tls.key \
  --dry-run=client -o yaml | kubectl apply -f -
```

proxy 會從 Secret 掛載熱重新載入憑證。

## 後續步驟

<CardGroup cols={2}>
  <Card title="使用通道化的 MCP 伺服器" icon="link" href="https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/overview#use-the-tunneled-mcp-servers">
    將上游 MCP 伺服器附加到 Managed Agent 或 Messages API。
  </Card>

  <Card title="安全性" icon="lock" href="https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/security">
    強化指引、憑證輪替與入侵應變。
  </Card>

  <Card title="疑難排解" icon="wrench" href="https://platform.claude.com/docs/zh-TW/agents-and-tools/mcp-tunnels/troubleshooting">
    診斷連線、TLS 與路由問題。
  </Card>
</CardGroup>
