HaoMeme MCP
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@HaoMeme MCP 用 teach 模板做一張「輪到你教育我了?」的紅底梗圖"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
HaoMeme MCP |豪老師迷因梗圖產生器(MCP Server)
把 HaoMeme 網頁版迷因產生器 包成一個 MCP server:AI 助理只要呼叫工具,就能批次產生 1280×720 的豪老師風格梗圖 PNG。它用 Playwright 驅動本機 headless Chrome/Chromium 載入隨附的原始網頁 App,因此字型、人像、筆刷、版式與網頁版完全一致。
給 AI 的快速上手:工具描述本身就內含完整教學(欄位限制、版式、範例)。呼叫
haomeme_catalog一次可取得即時人像 key 清單、所有枚舉值、預設台詞與同一份指南。不需要讀任何其他檔案就能開始產生圖片。
工具一覽
工具 | 用途 |
| 先查人像 key、模板、參數範圍、輸出路徑、完整指南(不產生圖片,最便宜的探索呼叫) |
| 產生單張, |
| 產生 1–50 張, |
spec 欄位(全部可選,省略沿用模板預設):
欄位 | 說明 |
| 標題,最多 300 字。換行寫成 JSON 參數裡的兩個字元 |
|
|
| 每行一個顏色( |
| 內建人像 key(如 |
|
|
| 人像在 |
| 數值微調(100 = 預設) |
| 紅刷痕 / 刷在前 / 斜體 / 鏡像 |
版式(實際渲染驗證):teach、crash = 人像在左、大字在右;nope = 人像在右、文字在左;sue = 律師函風格。
省略 text 時的預設台詞:teach → 輪到你\n教育我了?、crash → AI教育\n翻車了?、nope → 想玩GTA6?\n免談、sue → 你準備收\n律師傳票。
範例呼叫:
{
"tool": "haomeme_batch_generate",
"items": [
{ "text": "老黃說退就退\\n#OpenToWork", "lineColors": ["white", "yellow"], "template": "teach", "portrait": "A", "backdrop": "red" },
{ "text": "GTA6之前\\n最後的純潔", "template": "nope", "portrait": "I", "backdrop": "dark" }
]
}Related MCP server: memewright
給 AI 代理:快速部署指南
把下面這段交給任何 MCP-capable 的 AI(Claude Desktop、Cline、DeepSeek Harness、Cursor、Windsurf…),它就能自己裝好。
複製本 repo:
git clone https://github.com/liedwardtw/HaoMeme-mcp.git進入目錄執行
npm install(或用npm ci照 lock 檔 installation)。需要 Node.js 18+。確認有 Chrome / Edge / Chromium。沒有就執行
npx playwright install chromium,或設CHROME_PATH指向執行檔。把下面的 MCP host 設定加進你的 AI 用戶端,重開/重連後工具就會出現:
MCP host 設定(stdio)
Windows:
{
"mcpServers": {
"haomeme": {
"command": "node",
"args": ["C:\\path\\to\\HaoMeme-mcp\\server.mjs"],
"env": {}
}
}
}macOS / Linux:
{
"mcpServers": {
"haomeme": {
"command": "node",
"args": ["/absolute/path/to/HaoMeme-mcp/server.mjs"],
"env": { "CHROME_PATH": "/usr/bin/chromium" }
}
}
}若你的 host 需要绝对/规范化的
command路径,把node换成完整路径(Windows 上可用where node,macOS/Linux 用which node)。
環境變數(全部可選)
變數 | 用途 |
| 指定 Chrome/Chromium 執行檔;沒設就自動搜尋常見路徑或 playwright bundled browser |
| 指定原始 App 的 |
| 允許寫入的根目錄;預設 server 所在的 repo 目錄。產出預設在 |
| 讓 |
驗證
npm test # 記憶體傳輸端到端測試:列出工具、呼叫 catalog、產生兩張圖
npm run tools # 印出 host 實際看到的 tool name + description + schema第一次呼叫約 20–60 秒(啟動瀏覽器+載入字型);之後同一個分頁重複使用,很快。單張失敗回 { ok:false, error },批次中單項失敗回 { ok:false, index, error } 但其餘照常產生,不會丟例外。
目錄結構
HaoMeme-mcp/
├── server.mjs # MCP server(stdio),跨平台自動找 Chrome/App
├── package.json / package-lock.json
├── test-client.mjs # 端到端測試(in-memory transport)
├── list-tools.mjs # 印出工具描述/schema
├── gen-*.mjs # 離線批次渲染範例(繞開換行限制、自訂每行顏色)
├── HaoMeme-main/ # 原始純前端 App:index.html、人像、字型、背景、素材、工具腳本
│ ├── index.html # 可直接用瀏覽器開啟
│ ├── portraits.js / backgrounds.js
│ ├── portraits/ portraits_orig/ src_photos/ src_thumbs/
│ ├── fonts/ # Glow Sans / Outfit,SIL OFL 1.1
│ ├── tools/ # 重新去背、算座標、打包人像/背景、切字型的 Python 腳本
│ └── README.md / NOTICE.md / LICENSE
├── examples/ # 範例產出 PNG(4 張)
└── output/ # 預設輸出目錄(執行的時候自動建立)output/.gitkeep 讓空資料夾也能進版控;.gitignore 會忽略 output/*.png,所以你產出的圖片不會誤傳到 repo。
gen-*.mjs 是從原始工作區一并保留的離線批次渲染範例(含特定日期的梗圖資料與 Windows 路徑),MCP server 不需要它們,跨平台部署時可忽略或自行改寫。
HaoMeme-main/ 是必要依賴:server 會用 file:// 載入它的 index.html。原始 App 不需要架伺服器,人像已打包在 portraits.js 裡。
若把本 repo 放進 DSH 的 workspace,且原本的 HaoMeme-main/ 是它的兄弟目錄,server 會優先Find repo 內的 HaoMeme-main/index.html,找不到再退回兄弟目錄,因此舊工作區配置仍可直接用。
從原始素材重建(進階)
HaoMeme-main/tools/ 內有重新產生人像/背景/字型切片的腳本,詳見 HaoMeme-main/README.md:
pip install "rembg[cpu]" pillow numpy opencv-python
python HaoMeme-main/tools/cutout.py
python HaoMeme-main/tools/find_anchors.py
python HaoMeme-main/tools/build_portraits.py
python HaoMeme-main/tools/build_backgrounds.py
pip install fonttools brotli
python HaoMeme-main/tools/split_fonts.py授權與注意事項
程式碼:MIT(見
LICENSE)。影像不屬於 MIT:
HaoMeme-main/portraits/、portraits_orig/、src_photos/、src_thumbs/、portraits.js/backgrounds.js內嵌圖片,以及由它們做成的截圖/圖示,版權與肖像權屬原作者(YouTube 頻道「拆書人」)。僅供私下玩梗,不要冒充本人發文;商用或公開使用前請自行取得授權或替換素材。詳見NOTICE.md。字型:
HaoMeme-main/fonts/依 SIL Open Font License 1.1(見fonts/OFL.txt)。原始 App 專案頁:https://lanternko.github.io/HaoMeme/;MCP 封裝作者:liedwardtw。
Available Tools
3 toolshaomeme_batch_generateA
Generate 1..50 HaoMeme-style meme PNGs in ONE call, reusing a single headless-browser page — much faster than one haomeme_generate call per image (the browser and fonts load once). items = an array of spec objects, EACH accepting the same optional fields as haomeme_generate (full reference: FIELD_HELP below, or call haomeme_catalog once first for the live portrait keys). RULES THAT MATTER: (1) line breaks are written as the two characters backslash-n inside the JSON argument, e.g. "第一行\n第二行" — a literal newline can be dropped and your two captions will end up on one line; (2) lineColors is ONE colour per line (white|yellow|red), default white then yellow; (3) template teaches/crash put the portrait on the LEFT, nope puts it on the RIGHT. Example: [{"text":"第一行\n第二行","lineColors":["white","yellow"],"template":"teach","portrait":"A","backdrop":"red"},{"text":"A\nB","template":"nope","portrait":"I","backdrop":"dark"}]. A single bad item does NOT fail the batch: it returns {ok:false, index, error} and the rest still render. Returns {ok, count, succeeded, outputDir, results[]} where each result is {ok, path, bytes, width, height, template, text}. The first call may take ~20-60s while the browser starts; afterwards each item is fast. outputDir must stay inside the project folder (default ./output; override with HAOMEME_OUTPUT_ROOT).
FIELD REFERENCE (all optional, omitted = template default): HaoMeme spec fields — EVERY field is optional; an omitted field keeps that template's own default: text string, max 300 chars. The headline. To break a line write the two characters backslash-n ("\n") INSIDE the JSON argument, e.g. "第一行\n第二行". Do NOT rely on a literal line-break character in the JSON string: some clients drop it and the two captions collapse onto one line (and the filename loses the break too). Omit text to use the template preset listed below. template teach | crash | nope | sue (default: teach) lineColors array, max 8, ONE colour per line: white | yellow | red. Line 1 defaults to white, line 2 to yellow, any extra line to white. The colour is per LINE, not per character. portrait built-in portrait key (single letter, from haomeme_catalog's live list). Overrides portraitIndex. portraitIndex zero-based index into that portrait list (alternative to portrait). backdrop red | classroom | oldClassroom | room | grey | dark | smoke red = flat red with the paint stroke; the others are photo sets. side left | right — which side the portrait sits on. textSize 30..220 (100 = default, bigger = larger type) rotation -180..180 degrees of text rotation brushSize 30..250 (100 = default) — red paint-stroke thickness portraitSize 30..260 (100 = default) backgroundSize 10..300 (100 = default) backgroundBlur 0..30 px — blur on photo backdrops redBrush boolean — show the red paint stroke under the text brushInFront boolean — paint stroke in front of the portrait (still below the text) italic boolean — lean the text to the right flip boolean — mirror the portrait
LAYOUT (verified by actually rendering): teach and crash = portrait on the LEFT with the big headline on the right; nope = portrait on the RIGHT with the text on the left; sue = the lawyer-letter style. Use nope when you want the portrait and the text on opposite sides from teach/crash.
Preset text used when "text" is omitted: teach 輪到你\n教育我了? crash AI教育\n翻車了? nope 想玩GTA6?\n免談 sue 你準備收\n律師傳票
Inputs: items (required), outputDir.
haomeme_catalogA
HaoMeme meme generator — START HERE (call once before generating). Returns everything needed to write a correct haomeme_generate / haomeme_batch_generate call in one shot: the LIVE built-in portrait list (key / label / side, 11 portraits), the enum values for template / backdrop / colour / side, the per-template preset text, the output directory, the image size, plus the full field reference and workflow guide (field limits, layout notes, timing, error shape, copyright note). Cheapest discovery call: no image is rendered until you call haomeme_generate or haomeme_batch_generate.
Inputs: no named parameters.
haomeme_generateA
Generate ONE HaoMeme-style meme PNG (1280x720) into this project folder. Renders by driving the original HaoMeme web app in a local headless browser, so fonts, built-in portraits, paint stroke and layout match the web UI exactly. spec = one object of optional fields (full reference: FIELD_HELP below, or call haomeme_catalog). RULES THAT MATTER: (1) line breaks are written as the two characters backslash-n inside the JSON argument, e.g. "第一行\n第二行" — a literal newline can be dropped and your two captions will end up on one line; (2) lineColors is ONE colour per line (white|yellow|red), default white then yellow; (3) template teaches/crash put the portrait on the LEFT, nope puts it on the RIGHT. Example: {"template":"teach","portrait":"A","backdrop":"red","text":"老黃說退就退\n#OpenToWork","lineColors":["white","yellow"]}. outputDir must stay inside the project folder (default ./output; override with HAOMEME_OUTPUT_ROOT). Returns {ok, path, bytes, width, height, template, text}; a failure is returned as {ok:false, error}. For 2+ images prefer haomeme_batch_generate — one browser page is reused and it is much faster.
FIELD REFERENCE (all optional, omitted = template default): HaoMeme spec fields — EVERY field is optional; an omitted field keeps that template's own default: text string, max 300 chars. The headline. To break a line write the two characters backslash-n ("\n") INSIDE the JSON argument, e.g. "第一行\n第二行". Do NOT rely on a literal line-break character in the JSON string: some clients drop it and the two captions collapse onto one line (and the filename loses the break too). Omit text to use the template preset listed below. template teach | crash | nope | sue (default: teach) lineColors array, max 8, ONE colour per line: white | yellow | red. Line 1 defaults to white, line 2 to yellow, any extra line to white. The colour is per LINE, not per character. portrait built-in portrait key (single letter, from haomeme_catalog's live list). Overrides portraitIndex. portraitIndex zero-based index into that portrait list (alternative to portrait). backdrop red | classroom | oldClassroom | room | grey | dark | smoke red = flat red with the paint stroke; the others are photo sets. side left | right — which side the portrait sits on. textSize 30..220 (100 = default, bigger = larger type) rotation -180..180 degrees of text rotation brushSize 30..250 (100 = default) — red paint-stroke thickness portraitSize 30..260 (100 = default) backgroundSize 10..300 (100 = default) backgroundBlur 0..30 px — blur on photo backdrops redBrush boolean — show the red paint stroke under the text brushInFront boolean — paint stroke in front of the portrait (still below the text) italic boolean — lean the text to the right flip boolean — mirror the portrait
LAYOUT (verified by actually rendering): teach and crash = portrait on the LEFT with the big headline on the right; nope = portrait on the RIGHT with the text on the left; sue = the lawyer-letter style. Use nope when you want the portrait and the text on opposite sides from teach/crash.
Preset text used when "text" is omitted: teach 輪到你\n教育我了? crash AI教育\n翻車了? nope 想玩GTA6?\n免談 sue 你準備收\n律師傳票
Inputs: spec (required), outputDir.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
The three tools have clearly demarcated roles: catalog is pure discovery (no rendering), generate does one image, batch_generate does 1-50 with a shared browser page. The only overlap is that batch_generate with a single item duplicates generate, but descriptions explicitly route 2+ images to batch, so misselection risk is low.
All three names share the haomeme_ prefix and a predictable verb/noun pattern (catalog, generate, batch_generate). The batch qualifier is a natural modifier rather than a convention break.
Three tools map cleanly onto discover -> render one -> render many, with no filler. It is on the lean side, since catalog's enum/portrait data could arguably live in the generate descriptions, but nothing is redundant.
For a render-only domain the create path is fully covered plus discovery and batching, which is better than most generation servers. Minor gaps remain: no tool to list or clean up previously rendered files, and results return a file path rather than image bytes, though agents can work around both.
Maintenance
Related MCP Connectors
Find memes and Chinese 表情包, auto-place them into articles, or draw custom memes with AI.
Generate branded images at scale: design templates and render them to PNGs by prompt.
AI meme video templates: how-tos, recommended settings, example prompts and FAQ. Free, no key.
Deterministic image rendering for agents: JSON template in, on-brand PNG out.
Related MCP Servers
- AlicenseBqualityDmaintenanceGenerates custom memes with text overlays using pre-configured templates. Supports multiple meme formats with customizable text positioning, fonts, and automatic word wrapping.2MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to create memes by selecting from a library of templates and rendering captions with proper typesetting.AGPL 3.0
- AlicenseNot gradedqualityDmaintenanceLets users describe a situation and get five captioned memes in an editable editor, with optional server-side PNG rendering for hosts that cannot display the editor.2MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to create memes by searching 400+ classic templates, inspecting their caption slots, and rendering captioned images with permanent PNG URLs. Also surfaces trending templates and supports adjustable aspect ratios.MIT