/ 目錄 / 演練場 / LINE Bot
● 官方 line 🔑 需要你的金鑰

LINE Bot

作者 line · line/line-bot-mcp-server

Send LINE messages, rich Flex bubbles, and images to users or groups via the LINE Messaging API — ideal for JP/TW/TH notification flows.

LINE's official MCP wraps the LINE Messaging API. Push text, stickers, images, and Flex Message bubbles to a user by userId or to a group/room by their id. Includes broadcast (to all followers), narrowcast (segment), and profile lookups. Message costs apply beyond the free quota.

為什麼要用

核心特性

即時演示

實際使用效果

line-bot.replay ▶ 就緒
0/0

安裝

選擇你的客戶端

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "line-bot": {
      "command": "npx",
      "args": [
        "-y",
        "@line/line-bot-mcp-server"
      ]
    }
  }
}

開啟 Claude Desktop → Settings → Developer → Edit Config。儲存後重啟應用。

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "line-bot": {
      "command": "npx",
      "args": [
        "-y",
        "@line/line-bot-mcp-server"
      ]
    }
  }
}

Cursor 使用與 Claude Desktop 相同的 mcpServers 格式。專案級設定優先於全域。

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "line-bot": {
      "command": "npx",
      "args": [
        "-y",
        "@line/line-bot-mcp-server"
      ]
    }
  }
}

點擊 Cline 側欄中的 MCP Servers 圖示,然後選 "Edit Configuration"。

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "line-bot": {
      "command": "npx",
      "args": [
        "-y",
        "@line/line-bot-mcp-server"
      ]
    }
  }
}

格式與 Claude Desktop 相同。重啟 Windsurf 生效。

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "line-bot",
      "command": "npx",
      "args": [
        "-y",
        "@line/line-bot-mcp-server"
      ]
    }
  ]
}

Continue 使用伺服器物件陣列,而非映射。

~/.config/zed/settings.json
{
  "context_servers": {
    "line-bot": {
      "command": {
        "path": "npx",
        "args": [
          "-y",
          "@line/line-bot-mcp-server"
        ]
      }
    }
  }
}

加入 context_servers。Zed 儲存後熱重載。

claude mcp add line-bot -- npx -y @line/line-bot-mcp-server

一行命令搞定。用 claude mcp list 驗證,claude mcp remove 移除。

使用場景

實戰用法: LINE Bot

Send a formatted ops alert to an on-call engineer via LINE

👤 JP/TW-based SRE teams where LINE is the standard pager ⏱ ~25 min intermediate

何時使用: You want Sentry/Prometheus alerts to ping specific engineers on LINE with a tidy Flex card, not a wall of text.

前置條件
  • LINE Official Account + channel access token — developers.line.biz → Channel → Messaging API → Issue token
  • The engineer's userId (from your bot's webhook events) — Capture userId from a follow or message event; store in your user DB
步驟
  1. Design the Flex bubble
    Design a Flex Message bubble for a Sentry alert: header (issue title), body (event count, release, affected users), buttons (Open in Sentry, Ack).✓ 已複製
    → Valid Flex JSON Claude can validate
  2. Push to the on-call user
    Push this Flex message to userId U1234567890abcdef with altText 'Sentry alert: <title>'.✓ 已複製
    → messageId returned, no 400
  3. Handle fallback if user blocked the bot
    If the push fails with 400 (user blocked), multicast to the secondary on-call userIds instead and log the original failure.✓ 已複製
    → Graceful fallback path

結果: A polished, actionable alert in LINE within 2 seconds of the underlying event.

注意事項
  • altText required and capped at 400 chars — pushes fail silently without it — Always include altText; keep it under 400 chars summarizing the Flex
  • Pushing without the user being a friend of the bot fails 400 — Only push to userIds you captured from a real webhook event — you can't guess them
搭配使用: sentry

Broadcast a monthly product update to all followers

👤 Marketing teams with a LINE OA presence ⏱ ~20 min intermediate

何時使用: Once a month, you send a digest to all followers with 3 headline items and deep links.

前置條件
  • Sufficient messaging quota — Check current quota with getMessageQuota; LINE Push Messages are metered per plan
步驟
  1. Check quota before sending
    Get current message quota consumption and remaining. Confirm we have at least <follower_count> messages left.✓ 已複製
    → Remaining quota number
  2. Compose a Flex carousel
    Build a Flex carousel with 3 bubbles (title, image, CTA button). Inputs: [topic, image URL, link] × 3.✓ 已複製
    → Valid Flex carousel JSON
  3. Broadcast
    Broadcast this carousel to all followers with altText '<brand> monthly update'.✓ 已複製
    → 200 OK, requestId for audit

結果: A branded monthly broadcast to the whole follower base with click tracking via your redirect links.

注意事項
  • Broadcasts are expensive — a big list can blow through the free tier in one send — For non-urgent content consider narrowcast with a segment; or upgrade plan before sending

Let Claude post a standup summary to a team's LINE group

👤 Teams where daily standup lives in a LINE group ⏱ ~20 min intermediate

何時使用: Every morning at 9, summarize yesterday's Linear/Sentry activity and post a short digest.

前置條件
  • groupId of the target chat — Capture from a join or message event when the bot is added to the group
步驟
  1. Assemble the digest upstream
    Pull yesterday's Linear merged PRs and top new Sentry issues. Summarize in 5 bullets.✓ 已複製
    → Clean 5-bullet markdown
  2. Push to the group
    Push a text message (markdown-free; LINE doesn't render markdown) to groupId Cxxxxx with the 5 bullets as plain lines.✓ 已複製
    → 200 OK
  3. Ack failures loudly
    If push fails (bot was kicked from the group), write the failure to /logs/line-standup.log and notify me via email.✓ 已複製
    → Audit trail on failure

結果: A reliable daily standup digest that silently self-heals and alerts you if broken.

注意事項
  • Bot removed from group silently fails push — Subscribe to leave webhook events and mark the group inactive in your DB
  • LINE text messages don't render Markdown or HTML — Use plain text with emoji, or switch to a Flex message for rich formatting
搭配使用: sentry · linear

Narrowcast a campaign to a geographic or behavioral segment

👤 Growth teams running targeted pushes ⏱ ~20 min advanced

何時使用: You want to ping only Tokyo-area followers about an in-person event, not your whole list.

前置條件
  • Audience defined in LINE Official Account Manager — Create an audience (geo, tag, or uploaded userId list) in the OA Manager UI
步驟
  1. List audiences
    List all audiences on our LINE OA. Show name, size, last updated.✓ 已複製
    → Audience catalog
  2. Compose segment-specific message
    Build a Flex card for the Tokyo meetup — location, date, CTA. Tailor copy for Tokyo-area users.✓ 已複製
    → Targeted Flex JSON
  3. Narrowcast
    Narrowcast this Flex to audienceId <id>. Confirm the request was accepted.✓ 已複製
    → 202 Accepted + requestId

結果: Precision campaigns with lower cost per impression and higher click-through.

注意事項
  • Narrowcast to audience < 50 fails for privacy reasons — If segment is tiny, fall back to individual push to the user list instead

組合

與其他 MCP 搭配,撬動十倍槓桿

line-bot + sentry

Auto-push a Flex alert to on-call when a critical Sentry issue appears

When a new Sentry issue in project web-prod exceeds 100 events in 5 minutes, push a Flex alert to the on-call LINE user.✓ 已複製
line-bot + linear

Notify a LINE group when a P0 Linear issue is created

When a Linear issue is labeled P0, push a text message to groupId Cxxxx with the title and URL.✓ 已複製
line-bot + monday

Push a daily digest of monday.com items due today

Every morning at 9am, gather my monday.com items due today, format as a Flex carousel, push to my LINE user.✓ 已複製

工具

此 MCP 暴露的能力

工具輸入參數何時呼叫成本
push_message to: userId|groupId|roomId, messages: Message[] Send to a known recipient id 1 message charge
multicast to: userId[], messages: Message[] Same message to <=500 specific users 1 charge per recipient
broadcast messages: Message[] Blast to all followers; confirm quota first 1 charge per follower
narrowcast messages, recipient (audience object), filter? Targeted sends by audience 1 charge per recipient
get_profile userId Personalize a message with the user's display name free
get_message_quota Before any broadcast/narrowcast free

成本與限制

運行它的成本

API 配額
LINE API is metered in messages, not requests. Free tier: 500 free push messages/month (developer trial) or 200/month (light plan).
每次呼叫 Token 數
Text message: ~200 tokens request. Flex message: 500–2000 tokens depending on bubble complexity.
費用
Light plan free (200 msg/mo), Standard ¥5,000/mo (up to 30k msg), Pro ¥15,000/mo (45k+).
提示
Use reply_message whenever possible — replies are FREE. Only push when you don't have a replyToken.

安全

權限、密鑰、影響範圍

最小權限: Channel access token (long-lived, Messaging API)
憑證儲存: CHANNEL_ACCESS_TOKEN and CHANNEL_SECRET in env vars
資料出站: All calls to api.line.me and api-data.line.me
切勿授予: Channel secret to client-side code — it's for webhook signature verification only

故障排查

常見錯誤與修復

401 Invalid channel access token

Token expired or revoked. Re-issue at developers.line.biz → Channel → Messaging API.

驗證: curl -H 'Authorization: Bearer $CHANNEL_ACCESS_TOKEN' https://api.line.me/v2/bot/info
400 The property, altText, must be specified

Every non-text message (image, Flex) requires altText. Add it.

400 The user hasn't added the LINE Official Account as a friend

You can't push to arbitrary userIds — only ones that messaged/followed your bot. Use replyToken instead for this recipient.

429 Monthly limit reached

You hit your plan quota. Upgrade plan or wait until next month; replies remain free.

驗證: Call get_message_quota

替代方案

LINE Bot 對比其他方案

替代方案何時用它替代權衡
Slack MCPTeam is on Slack (most of Europe/NA)Different audience; LINE wins for JP/TW/TH consumers
Telegram MCPBot target is Telegram usersDifferent geo dominance; no OA/broadcast quotas
WhatsApp Cloud API MCPYou need to reach SEA/LATAM consumersHeavier BSP onboarding; stricter template approval

更多

資源

📖 閱讀 GitHub 上的官方 README

🐙 查看未解決的 issue

🔍 瀏覽全部 400+ MCP 伺服器和 Skills