zalo-mcp

zalo-mcp

Self-contained MCP server for Zalo that enables AI agents like Claude Code and Cursor to automate Zalo Personal and Official Accounts via a 1-click sandboxed deployment.

Category
访问服务器

README

<p align="center"> <img src="https://raw.githubusercontent.com/ardennguyen/zalo-agent-cli/main/assets/mascot.png" width="120" alt="zalo-mcp mascot" /> </p>

zalo-mcp

Gói cài đặt độc lập Model Context Protocol (MCP) server cho Zalo. Môi trường đóng gói (sandbox) 1-click giúp AI agents (Claude Code, Cursor) tự động hóa Zalo Personal & Official Account mà không làm rác máy tính của bạn.

Tiếng Việt | English

[!TIP] Sự khác biệt giữa zalo-mcpzalo-agent-cli?

  • zalo-agent-cli: Là bộ mã nguồn lõi (engine). Xử lý toàn bộ logic API, login, và chứa mã nguồn thật sự của MCP Server.
  • zalo-mcp (Repo này): Là vỏ bọc triển khai nhanh (deployment wrapper). Nó không chứa mã nguồn lõi. Thay vào đó, nó dùng lệnh tự động tạo ra một thư mục cục bộ an toàn, kéo engine về, tải Node/Python, cấu hình .env để Claude/Cursor có thể chạy ngay lập tức mà hệ thống của bạn hoàn toàn sạch sẽ.

📋 Yêu cầu hệ thống

Trước khi chạy trình cài đặt, hãy đảm bảo máy bạn đã có:

  • Node.js: Phiên bản 20 trở lên (Bắt buộc cho MCP server).
  • Python: Phiên bản 3.8 trở lên (Tùy chọn, cần thiết nếu muốn server tự render biểu đồ hoặc PDF report).
  • Git: Cần thiết để clone các bản cập nhật phụ thuộc.

🚀 Bắt đầu nhanh (Cài đặt 1 dòng lệnh)

Mọi phụ thuộc (dependencies) sẽ được tải vào một thư mục cách ly. Bạn có thể cài đặt server ở bất kỳ đâu trên máy tính chỉ với 1 lệnh duy nhất:

macOS / Linux:

curl -fsSL https://raw.githubusercontent.com/ardennguyen/zalo-mcp/main/zalo-mcp.sh | bash -s install

Windows (PowerShell):

Set-ExecutionPolicy Bypass -Scope Process -Force; irm https://raw.githubusercontent.com/ardennguyen/zalo-mcp/main/zalo-mcp.ps1 | Out-File $env:TEMP\zalo-mcp.ps1; & $env:TEMP\zalo-mcp.ps1 install

Trình cài đặt sẽ làm gì?

  1. Tạo thư mục zalo-mcp tại vị trí hiện tại.
  2. Tải các file wrapper và cấu hình.
  3. Cài đặt các gói Node.js vào thư mục node_modules/ cục bộ.
  4. Tạo môi trường ảo Python biệt lập (venv/).
  5. Tạo file cấu hình .env.

(Lưu ý: Bạn có thể được hỏi nhập Port nếu chạy ở chế độ tương tác, hoặc bạn có thể tự sửa .env sau).


🔑 Đăng nhập & Xác thực

Mọi thông tin xác thực đều được lưu cục bộ và an toàn trên máy của bạn.

A. Zalo Cá Nhân (API Không chính thức)

  1. Chạy lệnh đăng nhập:
    npx zalo-agent login
    
  2. Một mã QR sẽ hiển thị trên terminal. Mở app Zalo trên điện thoại > Quét mã QR (đừng dùng camera thường của điện thoại).

[!IMPORTANT] Vị trí lưu trữ Credentials: Lưu mã hóa tại ~/.zalo-agent-cli/ (quyền 0600). Cảnh báo: Đây là API không chính thức, tài khoản cá nhân của bạn có thể bị khóa (ban) nếu dùng để spam liên tục. Không nên dùng nick chính.

B. Zalo Official Account (API v3.0 Chính thức)

  1. Khởi tạo kết nối OA:
    npx zalo-agent oa init --app-id <YOUR_APP_ID> --secret <YOUR_APP_SECRET>
    
  2. Làm theo hướng dẫn trên trình duyệt để ủy quyền ứng dụng.

[!IMPORTANT] Vị trí lưu trữ Credentials: Lưu an toàn tại ~/.zalo-agent/oa-credentials.json. OA Access Tokens hết hạn sau 25 giờ. Refresh bất cứ lúc nào bằng lệnh: npx zalo-agent oa refresh


🤖 Tích hợp AI Agent (MCP)

Đảm bảo cấu hình AI client của bạn trỏ tới file mcp-server.js trong thư mục cài đặt zalo-mcp.

1. Claude Code

Thêm đoạn sau vào mcpServers trong ~/.claude/settings.json:

{
  "mcpServers": {
    "zalo": {
      "command": "node",
      "args": ["/đường/dẫn/tuyệt/đối/zalo-mcp/mcp-server.js"],
      "cwd": "/đường/dẫn/tuyệt/đối/zalo-mcp"
    }
  }
}

2. Cursor

Thêm MCP server mới trong settings của Cursor:

  • Name: zalo
  • Type: stdio
  • Command: node /đường/dẫn/tuyệt/đối/zalo-mcp/mcp-server.js

🛠️ Quản lý & Cập nhật

Cập nhật bản mới nhất: (Cập nhật engine, node_modules, python deps)

  • Windows: .\zalo-mcp.ps1 update
  • macOS / Linux: ./zalo-mcp.sh update

Dọn dẹp môi trường: (Xóa sạch mọi deps để cài lại từ đầu)

  • Windows: .\zalo-mcp.ps1 clean
  • macOS / Linux: ./zalo-mcp.sh clean

📖 Tài liệu đầy đủ

Wiki → github.com/ardennguyen/zalo-agent-cli/wiki

Hướng dẫn chi tiết cho tất cả lệnh, thiết lập MCP, cache cục bộ, Official Account API và nhiều hơn nữa — cả tiếng Việt lẫn tiếng Anh.



English

Self-contained Model Context Protocol (MCP) server installer for Zalo. A 1-click sandboxed deployment that enables AI agents (Claude Code, Cursor) to automate Zalo Personal & Official Accounts without cluttering your host system.

[!TIP] What is the difference between zalo-mcp and zalo-agent-cli?

  • zalo-agent-cli: The core automation engine. It does all the heavy lifting, API logic, auth, and contains the actual MCP server source code.
  • zalo-mcp (This Repo): The lightweight deployment wrapper. It contains no core code. Instead, its 1-click script safely pulls the engine into a local sandboxed folder, sets up Node/Python, and configures .env so Claude/Cursor can run instantly while keeping your global system pristine.

📋 Prerequisites

  • Node.js: v20 or higher.
  • Python: v3.8 or higher (Optional, for rendering charts and PDFs).
  • Git: Required to pull dependencies.

🚀 Quick Start (One-Line Installation)

macOS / Linux:

curl -fsSL https://raw.githubusercontent.com/ardennguyen/zalo-mcp/main/zalo-mcp.sh | bash -s install

Windows (PowerShell):

Set-ExecutionPolicy Bypass -Scope Process -Force; irm https://raw.githubusercontent.com/ardennguyen/zalo-mcp/main/zalo-mcp.ps1 | Out-File $env:TEMP\zalo-mcp.ps1; & $env:TEMP\zalo-mcp.ps1 install

🔑 Authentication

A. Personal Zalo Account (Unofficial API)

  1. Run the login command:
    npx zalo-agent login
    
  2. Scan the printed QR code using the Zalo app on your phone.

[!IMPORTANT] Safety Notice: This uses an unofficial API. Your personal account can get banned if heavily abused for spam.

B. Zalo Official Account (Official API v3.0)

  1. Initialize OA credentials:
    npx zalo-agent oa init --app-id <YOUR_APP_ID> --secret <YOUR_APP_SECRET>
    
  2. Follow the browser prompt. Refresh tokens anytime with: npx zalo-agent oa refresh

🤖 AI Agent Integration (MCP)

Configure your AI clients to run the server in stdio mode:

Claude Code (~/.claude/settings.json):

{
  "mcpServers": {
    "zalo": {
      "command": "node",
      "args": ["/absolute/path/to/zalo-mcp/mcp-server.js"],
      "cwd": "/absolute/path/to/zalo-mcp"
    }
  }
}

Cursor: Add new MCP server: stdio -> node /absolute/path/to/zalo-mcp/mcp-server.js

🛠️ Management Commands

  • Update Deps: .\zalo-mcp.ps1 update or ./zalo-mcp.sh update
  • Clean Env: .\zalo-mcp.ps1 clean or ./zalo-mcp.sh clean

📖 Documentation

Full Wiki → github.com/ardennguyen/zalo-agent-cli/wiki

Detailed guides for all commands, MCP setup, local cache, Official Account API, and more — available in both English and Tiếng Việt.


License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选