Skip to main content
Glama
zalo-mcp
by nhminhhh

zalo-mcp

CI License: MIT Node.js >= 20 MCP

A production-ready Model Context Protocol (MCP) server for Zalo Official Account (OA) and Zalo Notification Service (ZNS). Built in TypeScript with strict Zod validation, automatic OAuth v4 token refresh, retry resilience, MCP resources, and prompt templates.


Features

  • 28 MCP Tools covering the full Zalo OA v2/v3 & ZNS lifecycle:

    • OA & Auth: Get OA profile, refresh OAuth v4 access tokens (plus automatic single-flight refresh on -216 expiry)

    • Messaging (v3.0): Send text, image, file, interactive list/button templates, transaction notifications, and promotion messages

    • Followers & CRM Tags: List followers, inspect follower profiles, update follower CRM info, create/list/assign/remove tags

    • Conversations: List recent chats and read message history with any user

    • Media Upload: Upload local images, documents/files, and GIFs via multipart/form-data

    • Articles: List, inspect, create, and delete OA articles

    • ZNS (Business API): Send template notifications, list templates, inspect template schemas, and check delivery status

  • 3 Live MCP Resources: zalo://oa/profile, zalo://oa/tags, zalo://zns/templates

  • 2 Built-in Prompts: zalo_draft_customer_reply, zalo_zns_campaign_check

  • Resilient HTTP Client: Automatic OAuth v4 token refresh with single-flight locking, 5xx retry with backoff, and configurable request timeouts


Related MCP server: LINE OA MCP Ultimate

Quick Start

1. Prerequisites

  • Node.js >= 20

  • A Zalo Official Account (OA) access token (and optionally OAuth v4 refresh credentials from the Zalo Developers Console)

2. Install & Build

git clone https://github.com/nhminhhh/zalo-mcp.git
cd zalo-mcp
npm install
npm run build

3. Configure Your MCP Client

Claude Desktop / Cursor / Antigravity (mcp_config.json)

{
  "mcpServers": {
    "zalo": {
      "command": "node",
      "args": ["/absolute/path/to/zalo-mcp/dist/index.js"],
      "env": {
        "ZALO_OA_ACCESS_TOKEN": "your_oa_access_token",
        "ZALO_OA_REFRESH_TOKEN": "your_oa_refresh_token",
        "ZALO_APP_ID": "your_zalo_app_id",
        "ZALO_APP_SECRET": "your_zalo_app_secret"
      }
    }
  }
}

Tip: If you provide ZALO_OA_REFRESH_TOKEN, ZALO_APP_ID, and ZALO_APP_SECRET, zalo-mcp will automatically refresh expired access tokens (error: -216) without manual intervention.


Environment Variables

Variable

Required

Default

Description

ZALO_OA_ACCESS_TOKEN

Yes*

—

Zalo OA v2/v3 & ZNS access token

ZALO_OA_REFRESH_TOKEN

Optional

—

OAuth v4 refresh token for auto-renewal

ZALO_APP_ID

Optional

—

Zalo App ID (required for OAuth v4 refresh)

ZALO_APP_SECRET

Optional

—

Zalo App Secret (required for OAuth v4 refresh)

ZALO_API_BASE_URL

Optional

https://openapi.zalo.me

OA API base URL

ZALO_BUSINESS_API_BASE_URL

Optional

https://business.openapi.zalo.me

ZNS Business API base URL

ZALO_OAUTH_BASE_URL

Optional

https://oauth.zaloapp.com

OAuth v4 base URL

ZALO_REQUEST_TIMEOUT_MS

Optional

15000

HTTP request timeout in milliseconds

*ZALO_OA_ACCESS_TOKEN can be omitted if all three OAuth v4 refresh variables are provided.


Complete Tool Reference

OA & Authentication

Tool

Description

zalo_get_oa_info

Get Official Account profile metadata

zalo_refresh_token

Manually refresh OAuth v4 access token

Messaging (OA v3.0)

Tool

Description

zalo_send_text_message

Send a CS text message (supports quote_message_id)

zalo_send_image_message

Send an image via attachment_id or public image_url

zalo_send_file_message

Send a file attachment using file_token

zalo_send_template_message

Send interactive list or button template messages

zalo_send_transaction_message

Send transaction notification (order, billing, booking, etc.)

zalo_send_promotion_message

Send promotional message to followers

Followers & Tags

Tool

Description

zalo_get_followers

List followers with pagination and optional tag_name filter

zalo_get_follower_profile

Get detailed follower profile by user_id

zalo_update_follower_info

Update follower CRM info (name, phone, address, city/district)

zalo_list_tags

List all tags configured on the OA

zalo_tag_follower

Assign a tag to a follower

zalo_untag_follower

Remove a tag from a follower

zalo_remove_tag

Delete a tag from the OA

Conversations

Tool

Description

zalo_list_recent_chats

List recent OA conversations

zalo_get_conversation

Get message history with a specific user_id

Media Upload

Tool

Description

zalo_upload_image

Upload a local image (JPG/PNG) to get attachment_id

zalo_upload_file

Upload a local file (PDF/DOC/DOCX) to get token

zalo_upload_gif

Upload a local GIF to get attachment_id

Articles

Tool

Description

zalo_get_articles

List normal or video articles

zalo_get_article_detail

Get full article details by id

zalo_create_article

Create a new OA article

zalo_remove_article

Delete an article by id

Zalo Notification Service (ZNS)

Tool

Description

zalo_zns_send_message

Send ZNS template message to 84xxxxxxxxx (supports development mode)

zalo_zns_list_templates

List ZNS templates with status filtering

zalo_zns_get_template_info

Inspect ZNS template parameters and pricing

zalo_zns_get_message_status

Check ZNS message delivery status


Development & Testing

# Typecheck
npm run typecheck

# Run unit & MCP InMemoryTransport integration tests
npm test

# Build dist/
npm run build

# CLI help & version
node dist/index.js --help
node dist/index.js --version

License

MIT © 2026 nhminhhh

Available Tools

28 tools
zalo_create_articleC

Create a new normal article on the Zalo Official Account.

Inputs: title (required), author (required), description (required), body_paragraphs (required), +3 more.

zalo_get_article_detailB

Get full details of a Zalo OA article by its article ID.

Inputs: id (required).

zalo_get_articlesB

List articles published or drafted on the Zalo Official Account.

Inputs: type, limit, offset.

zalo_get_conversationB

Retrieve message history between the Zalo Official Account and a specific user.

Inputs: user_id (required), count, offset.

zalo_get_follower_profileB

Get detailed profile information for a Zalo OA follower by user_id.

Inputs: user_id (required).

zalo_get_followersA

List followers of the Zalo Official Account with pagination and optional tag filtering.

Inputs: count, offset, tag_name.

zalo_get_oa_infoB

Retrieve profile information for the authenticated Zalo Official Account (OA), including OA ID, name, verification status, category, and follower count.

Inputs: no named parameters.

zalo_list_recent_chatsC

List recent conversations on the Zalo Official Account.

Inputs: count, offset.

zalo_list_tagsB

List all follower tags configured in the Zalo Official Account.

Inputs: no named parameters.

zalo_refresh_tokenA

Refresh the Zalo OA access token using OAuth v4. Uses ZALO_OA_REFRESH_TOKEN by default or an optional refresh_token override.

Inputs: refresh_token.

zalo_remove_articleC

Delete an article from the Zalo Official Account by ID.

Inputs: id (required).

zalo_remove_tagB

Delete a tag completely from the Zalo Official Account.

Inputs: tag_name (required).

zalo_send_file_messageA

Send a file attachment message to a Zalo user using a file token from zalo_upload_file.

Inputs: user_id (required), file_token (required).

zalo_send_image_messageB

Send an image message to a Zalo user using either an uploaded attachment_id or a public image URL.

Inputs: user_id (required), text, image_url, attachment_id.

zalo_send_promotion_messageC

Send a promotional message to a follower via OA v3.0.

Inputs: user_id (required), elements (required), buttons, attachment_id.

zalo_send_template_messageC

Send a structured interactive list or button template message to a Zalo user.

Inputs: user_id (required), template_type (required), text, buttons, +1 more.

zalo_send_text_messageC

Send a customer service (CS) text message to a Zalo user via Official Account v3.0.

Inputs: text (required), user_id (required), quote_message_id.

zalo_send_transaction_messageB

Send an official transaction notification message (order, billing, shipping, etc.) via OA v3.0.

Inputs: user_id (required), elements (required), template_type (required), buttons, +1 more.

zalo_tag_followerC

Assign a tag to a Zalo OA follower.

Inputs: user_id (required), tag_name (required).

zalo_untag_followerC

Remove a tag from a Zalo OA follower.

Inputs: user_id (required), tag_name (required).

zalo_update_follower_infoC

Update CRM/contact metadata for a Zalo OA follower (name, phone, address, city, district).

Inputs: user_id (required), name, phone, address, +2 more.

zalo_upload_fileB

Upload a local document/file (PDF, DOC, DOCX, max 5MB) to Zalo OA and receive a file token.

Inputs: file_path (required).

zalo_upload_gifA

Upload a local GIF file (max 5MB) to Zalo OA and receive an attachment_id.

Inputs: file_path (required).

zalo_upload_imageA

Upload a local image file (JPG/PNG, max 1MB) to Zalo OA and receive an attachment_id.

Inputs: file_path (required).

zalo_zns_get_message_statusB

Check delivery status of a previously sent ZNS message.

Inputs: phone (required), message_id (required).

zalo_zns_get_template_infoB

Get detailed schema, required parameters, and pricing for a specific ZNS template.

Inputs: template_id (required).

zalo_zns_list_templatesA

List available Zalo Notification Service (ZNS) templates with pagination and status filtering.

Inputs: limit, offset, status.

zalo_zns_send_messageC

Send a Zalo Notification Service (ZNS) template message to a recipient phone number (format: 84xxxxxxxxx).

Inputs: phone (required), template_id (required), template_data (required), mode, +1 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 28 tools

    Disambiguation4/5

    Most tools map to a distinct resource and action, such as articles, followers, tags, chats, uploads, and OA info. The main ambiguity is among the six send_* OA message tools and ZNS vs OA template messaging, where an agent must read descriptions to choose correctly.

    Naming Consistency4/5

    All names are snake_case with a zalo_ prefix and generally follow verb_noun order. Minor deviations include collection retrieval using both get_* (get_followers, get_articles) and list_* (list_tags, list_recent_chats), plus the zalo_zns_ sub-prefix.

    Tool Count2/5

    28 tools is above the comfortable range and creates noticeable selection overhead for an agent. The set is logically grouped by OA subdomain, so most tools earn their place, but the raw count is still heavy.

    Completeness4/5

    The surface covers article creation/listing/detail/deletion, ZNS messaging, CS messaging, follower management, tags, chats, uploads, and token refresh. Minor gaps remain: no article update/edit operation and no tag creation endpoint, though agents can work around these.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      Not graded
      maintenance
      Enables AI agents to operate LINE Official Accounts through natural language, including messaging, rich menus and messages, coupons, audiences, insights, webhooks, LIFF, multi-OA management, and LINE Shopping workflows. It provides pre-flight validation, quota safety, Thai-localized templates, and zero-setup rich image handling for real-world OA operations.
      206 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents to operate one or many LINE Official Accounts through natural language — sending broadcasts, Flex/Rich/card messages, building rich menus, coupons, audiences, insights, and LINE Shopping operations, with pre-flight quota checks and quiet-hour guardrails.
      206 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI agents to run one or many LINE Official Accounts by natural conversation, covering broadcasts, Flex and tappable Rich Messages, rich menus, coupons, audiences, insights, webhooks, LIFF apps, and LINE Shopping through 51 tools. It handles image hosting, pre-flight quota validation, quiet-hour warnings, and Thai-localized templates, so routine account operations and storefront management happen without leaving the AI host.
      206 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Lets AI agents run one or many LINE Official Accounts through natural conversation, covering broadcasts, Flex and tappable Rich Messages, Thai-ready rich menus, coupons, audiences, insights, and LINE Shopping via 51 tools. It adds pre-flight quota and quiet-hour guardrails, multi-OA switching and fan-out, and delivers assets like images and rich-menu graphics without external hosting or setup.
      206 npm
      MIT