webcake-landing-mcp 1.0.26 → 1.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,11 @@
1
1
  [
2
+ {
3
+ "v": "1.0.27",
4
+ "d": "08/06/2026",
5
+ "type": "Fixed",
6
+ "en": "The HTTP server's GET / route now serves the full HTML guide page to social and search crawlers (Facebook, Zalo, Twitter/X, LinkedIn, Slack,…",
7
+ "vi": "Route GET / của HTTP server nay phục vụ trang hướng dẫn HTML đầy đủ cho các crawler mạng xã hội và công cụ tìm kiếm (Facebook, Zalo, Twitter/X,…"
8
+ },
2
9
  {
3
10
  "v": "1.0.26",
4
11
  "d": "07/06/2026",
@@ -33,12 +40,5 @@
33
40
  "type": "Added",
34
41
  "en": "New WEBCAKE_BUILDER_BASE environment variable, x-webcake-builder-base HTTP header, and ?builder_base= query parameter set the page-builder host used…",
35
42
  "vi": "Biến môi trường WEBCAKE_BUILDER_BASE mới, HTTP header x-webcake-builder-base, và tham số truy vấn ?builder_base= cho phép đặt host của page-builder…"
36
- },
37
- {
38
- "v": "1.0.21",
39
- "d": "07/06/2026",
40
- "type": "Added",
41
- "en": "The HTTP server's GET / guide page is now bilingual (vi/en): append ?lang=en to the URL to switch to English (default is Vietnamese), a language…",
42
- "vi": "Trang hướng dẫn GET / của HTTP server nay hỗ trợ song ngữ (vi/en): thêm ?lang=en vào URL để chuyển sang tiếng Anh (mặc định là tiếng Việt), kèm nút…"
43
43
  }
44
44
  ]
package/dist/http.js CHANGED
@@ -20,6 +20,13 @@ import { createServer } from "./server.js";
20
20
  import { ICON_SVG, ICON_MIME } from "./branding.js";
21
21
  import { guideHtml, ogImageSvg, normalizeLang } from "./web-guide.js";
22
22
  const MCP_PATH = "/mcp";
23
+ // Social/search crawlers (Facebook, Zalo, Twitter/X, LinkedIn, Slack, Telegram,
24
+ // WhatsApp, Discord, Google, Bing…) fetch the root with `Accept: */*` rather than
25
+ // `text/html`, so they'd otherwise get the JSON health blob and never see the OG
26
+ // tags — links wouldn't unfurl and Facebook's debugger reports a missing og:image.
27
+ // Detect them by User-Agent so they get the full HTML <head>. (Programmatic MCP /
28
+ // healthcheck probes also send `*/*` but don't match, so they still get JSON.)
29
+ const BOT_UA = /facebookexternalhit|facebot|twitterbot|linkedinbot|slackbot|slack-imgproxy|telegrambot|whatsapp|discordbot|pinterest|redditbot|googlebot|bingbot|applebot|yandexbot|baiduspider|embedly|quora link preview|outbrain|vkshare|w3c_validator|skypeuripreview|zalo/i;
23
30
  // The raster social card (1200x630), pre-rendered and committed at src/og.png,
24
31
  // mirrored to dist/og.png by copy-assets. Served at GET /og.png as the og:image —
25
32
  // SVG OG images don't unfurl on Facebook/X/LinkedIn/Zalo. Read once, lazily.
@@ -113,7 +120,8 @@ export async function startHttpServer(port) {
113
120
  // page that links the favicon (helps icon discovery); programmatic probes
114
121
  // (the container healthcheck uses `Accept: */*`) still get the JSON health.
115
122
  const accept = String(req.headers["accept"] ?? "");
116
- if (path === "/" && accept.includes("text/html")) {
123
+ const ua = String(req.headers["user-agent"] ?? "");
124
+ if (path === "/" && (accept.includes("text/html") || BOT_UA.test(ua))) {
117
125
  // Public base URL, honoring the reverse proxy (Coolify/Traefik/Cloudflare).
118
126
  const fwdHost = req.headers["x-forwarded-host"];
119
127
  const host = (Array.isArray(fwdHost) ? fwdHost[0] : fwdHost) || req.headers.host || "localhost";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webcake-landing-mcp",
3
- "version": "1.0.26",
3
+ "version": "1.0.27",
4
4
  "description": "MCP server exposing Webcake landing-page element schemas + AI usage hints, and persisting LLM-generated page sources to a Webcake backend.",
5
5
  "type": "module",
6
6
  "bin": {