為了使用 google 相關的服務, 這邊以 gmail 為例, 我們首先需要去 google clound console 新增一個專案, 這個專案是 for 我們個人利用 mcp server 使用, 點選 New project:


點選 apis & services:

搜尋 gmail:
接著點選 enable:
好了之後我們要來設定 Credentials, 讓我們點選左邊的面板, 在 Apis & Services 點選 Credentials:
我們需要先去設定畫面:
點選 get started:
按照步驟填寫資料後點選創建:
並且在 Google Cloud Console → OAuth 同意畫面 (Consent screen) 新增測試人員:

接著回到 Apis & Services 選擇 Credentials, 就會看到現在我們可以建立 oauth credentials 了:

接著下載 json 檔:
這樣我們就完成了, 之後跟 google 有關的 mcp server 所需要的 credentials 資料你就有了

以這個 gmail mcp server 為範例, 他會需要你在運行時指定 credential json 的檔案路徑作為 auth 方式:
docker run -i --rm \
--mount type=bind,source=/path/to/gcp-oauth.keys.json,target=/gcp-oauth.keys.json \
-v mcp-gmail:/gmail-server \
-e GMAIL_OAUTH_PATH=/gcp-oauth.keys.json \
-e "GMAIL_CREDENTIALS_PATH=/gmail-server/credentials.json" \
-p 3000:3000 \
mcp/gmail auth
為了要使用 google 的服務, 我們需要兩步驟: