wechat-robot-mcp-server
by hp0912
Overview
This server acts as a Model Context Protocol (MCP) intermediary for a WeChat robot, offering various AI-powered tools such as image recognition, drawing, text-to-speech, group chat summary, personality analysis, song requests, and video generation, integrating with multiple AI providers.
Installation
go run .Environment Variables
- MCP_SERVER_PORT
- MYSQL_HOST
- MYSQL_PORT
- MYSQL_USER
- MYSQL_PASSWORD
- GO_ENV
Security Notes
CRITICAL security risks identified: 1. **SQL Injection Vulnerability (Database Name):** The `config.buildDSNForRobot` function constructs the database connection string using `robotCode` directly as the database name. If `robotCode` is derived from user-controlled metadata (`mcp.CallToolRequest.Params.Meta`) without proper sanitization, a malicious actor could inject arbitrary SQL into the database name, potentially leading to database compromise (e.g., `malicious_db_name'; DROP DATABASE evil;`). This is a severe vulnerability. 2. **XML External Entity (XXE) Injection:** The `repository/message.go` `GetMessagesByTimeRange` function uses MySQL's `EXTRACTVALUE` (an XPath function for XML) on the `messages.content` field. If `messages.content` can contain user-controlled XML (e.g., from WeChat messages parsed into XML format), this creates a classic XXE vulnerability. An attacker could craft a malicious XML message to read local files, initiate server-side request forgery (SSRF), or cause denial of service. 3. **Logging of Error Messages:** `utils.CallToolResultError` logs raw error messages (`errmsg`) directly. If these error messages contain sensitive information from upstream APIs or internal system details, they could be exposed in server logs.
Similar Servers
wecom-bot-mcp-server
Facilitates sending messages, images, and files to WeCom (WeChat Work) groups via the Model Context Protocol (MCP).
soulshack
An IRC chatbot powered by LLMs, designed to bridge traditional chat with modern AI capabilities, supporting multi-provider LLMs and a unified tool system.
mcp-notify
A Model Context Protocol (MCP) server designed to send messages and notifications across various platforms like WeWork, DingTalk, Telegram, Lark, Home Assistant, Bark, Ntfy, and PushPlus.
wechat-official-account-mcp
Provides a Model Context Protocol (MCP) service to enable AI applications to interact with WeChat Official Account APIs, managing features like authentication, media, drafts, and publishing.