Skip to main content
Glama
blogger-mcp
by hhb01

blogger-mcp

讓 Claude 直接讀寫你的 Blogger 網誌:本機 stdio MCP server + 發文 skill

A local Model Context Protocol server for the Blogger API v3. It lets Claude (Desktop / Claude Code) list, read, draft, update, schedule and publish posts, with an image-loss guard and a custom-permalink workaround. Includes a Claude skill that uploads images via the Blogger editor and writes posts through this server.

Node TypeScript MCP License

特色

  • 6 個工具:列出、讀取、建立(一律草稿)、部分更新、發佈/預約發佈、改回草稿。刻意不提供刪除

  • 圖片保護:update_post 傳入新內文時,會比對原文裡的 Blogger 圖片。少了任何一張就拒絕寫入,避免 AI 改寫時把圖弄丟

  • 自訂永久連結:Blogger API 不能直接設定網址,但永久連結是「第一次發佈當下由標題產生」。publish_post 的 permalinkSlug 會暫時把標題換成英文代稱、發佈後再改回原標題

  • 預約發佈:publishDate 帶未來時間,文章狀態就會變成 SCHEDULED

  • 安全:OAuth 2.0 桌面應用程式流程(loopback + PKCE),refresh token 存在使用者設定資料夾,不進專案、不進 log、不出現在工具回傳

  • 好除錯:錯誤訊息直接帶 Google API 的 HTTP 狀態碼、message 和 reason

Related MCP server: Blogger MCP Server

架構

flowchart LR
  U[使用者] -->|自然語言| C[Claude Desktop / Claude Code]
  C -->|stdio / JSON-RPC| M[blogger-mcp<br/>Node.js + TypeScript]
  M -->|OAuth 2.0 + REST| B[(Blogger API v3)]
  C -->|Claude in Chrome| E[Blogger 編輯器]
  E -->|貼上圖片| G[(blogger.googleusercontent.com 圖床)]
  M -.讀取 refresh token.-> T[[%APPDATA%/blogger-mcp/token.json]]

Blogger API v3 沒有上傳媒體的端點,所以分成兩條路:

負責

做什麼

blogger-mcp(這個專案)

文字內容、標籤、草稿/發佈狀態、永久連結

blogger-post skill(plugin/)

用 Claude in Chrome 在編輯器貼上圖片取得圖床網址,再呼叫 MCP 組出完整文章

src/
  google.ts   OAuth 用戶端、token 儲存與自動刷新、錯誤格式化
  auth.ts     npm run auth:loopback + PKCE 授權,完成後列出你的網誌 ID
  index.ts    MCP server 與 6 個工具(zod 參數驗證)
plugin/       Claude plugin:blogger-post skill
examples/     Claude 桌面 App 設定範例

工具

工具

參數

說明

list_posts

status(live / draft / scheduled)、label、maxResults、pageToken

只回傳 id、title、url、labels、published、status,不含內文,省 token

get_post

postId

完整 HTML(使用 view=ADMIN,草稿也讀得到)

create_post

title、content、labels[]

一律存成草稿

update_post

postId,可選 title、content、labels[]、allowImageRemoval

posts.patch,只改有傳的欄位,有圖片保護。labels 是整組取代

publish_post

postId,可選 publishDate、permalinkSlug

發佈或預約發佈,可自訂網址

revert_post

postId

改回草稿

安裝

1. 建立 Google OAuth 用戶端

  1. 到 Google Cloud Console 建立專案,在「API 程式庫」啟用 Blogger API v3

  2. 「Google Auth Platform」→ 設定同意畫面(外部),在「目標對象」把自己的 Google 帳號加為測試使用者

  3. 「用戶端」→ 建立 OAuth 用戶端 ID,類型選電腦版應用程式,下載 JSON

  4. 把 JSON 存成 %APPDATA%\blogger-mcp\client_secret.json(macOS / Linux:~/.config/blogger-mcp/client_secret.json)

應用程式在「測試」狀態時,refresh token 7 天會過期,屆時重新執行 npm run auth。發布成正式版就不會過期。

2. 安裝與授權

git clone https://github.com/hhb01/blogger-mcp.git
cd blogger-mcp
npm install
npm run auth

npm run auth 會開瀏覽器授權,token 存到 %APPDATA%\blogger-mcp\token.json,最後列出你帳號下的網誌與 Blog ID。

3. 加到 Claude 桌面 App

打開「設定 → 開發人員 → 編輯設定」,加入(參考 examples/claude_desktop_config.example.json):

{
  "mcpServers": {
    "blogger": {
      "command": "C:\\Program Files\\nodejs\\node.exe",
      "args": ["C:\\path\\to\\blogger-mcp\\dist\\index.js"],
      "env": {
        "BLOGGER_BLOG_ID": "你的 Blog ID",
        "BLOGGER_CLIENT_SECRET_PATH": "C:\\Users\\<你>\\AppData\\Roaming\\blogger-mcp\\client_secret.json"
      }
    }
  }
}

存檔後完全結束 App(含系統匣圖示)再重開。一般對話和 Code 分頁都會載入這個 MCP。

Claude Code CLI 也可以:

claude mcp add blogger -e BLOGGER_BLOG_ID=你的ID -- node C:\path\to\blogger-mcp\dist\index.js

4.(選用)安裝 blogger-post skill

plugin/ 是一個 Claude plugin。可以把 plugin/skills/blogger-post/ 複製到 ~/.claude/skills/,或打包成 plugin 上傳到 claude.ai。使用前先把 SKILL.md 開頭的 {BLOG_ID}、{SITE_URL} 換成自己的。

環境變數

變數

必填

預設

BLOGGER_BLOG_ID

✅

—

BLOGGER_CLIENT_SECRET_PATH

%APPDATA%\blogger-mcp\client_secret.json

使用範例

直接跟 Claude 說:

  • 「列出我的 Blogger 草稿」

  • 「把草稿 1234567890 的內文改寫得更口語,標籤改成 教學、Python,圖片保留」

  • 「把這篇預約在 12/1 早上 9 點發佈,網址用 python-venv-guide」

實測發現(Blogger API v3 的眉角)

項目

結果

posts.patch 更新內文與標籤

✅ 只改有傳的欄位,只傳 labels 時內文不受影響

搜尋說明(meta description)

❌ customMetaData、searchDescription 會被靜默忽略,要到後台手動設定(需先在「設定 → 中繼標記」啟用)

直接設定 url

❌ 靜默忽略

永久連結產生時機

⚠️ 第一次發佈/預約的當下用當時的標題產生,年月取自 publishDate。之後改標題、revert 都不會變 → 所以做了 permalinkSlug

預約發佈

✅ publish 帶未來的 publishDate → SCHEDULED,可用 revert 取消

草稿讀取

必須帶 view=ADMIN

安全設計

  • refresh token 存在 %APPDATA%\blogger-mcp\(macOS / Linux 為 ~/.config/blogger-mcp/,權限 0600),不在專案資料夾,.gitignore 也排除了 token.json、client_secret*.json

  • token 與 client secret 不會出現在 log 或任何工具回傳內容

  • OAuth 使用 PKCE + state 驗證,loopback 只綁 127.0.0.1

  • stdout 只給 MCP 協定使用,log 一律寫到 stderr

  • 不提供刪除工具;publish_post 的說明要求 AI 只在使用者明確要求時呼叫

License

MIT © 王祥宇 (hhb01)

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables LLMs to automate Google Blogger content management by providing tools for single and batch post creation via the Blogger API. It supports secure OAuth2 authentication and allows for seamless blog integration through the Model Context Protocol.
      1
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to interact with the Google Blogger API v3 to manage blog posts and metadata. It supports the full post lifecycle including creating, updating, publishing, and deleting content through natural language.
      10
      8 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI models to interact with Google Blogger blogs, manage posts, labels, and retrieve blog information via API key or OAuth2.
      9 npm
      MIT