WeCom MCP server

Integrates WeCom (WeChat Work) bot functionality for enterprise messaging, notifications, and interactive chatbots.
Back to servers
Provider
Hal
Release date
Jan 02, 2025
Language
Python
Package
Stats
6.9K downloads
44 stars

This MCP server provides a Model Context Protocol compliant implementation for integrating with WeCom (WeChat Work) bots, allowing you to send various message types through the WeCom platform.

Installation

Automated Installation

Using Smithery (For Claude Desktop)

npx -y @smithery/cli install wecom-bot-mcp-server --client claude

Using VSCode with Cline Extension

  1. Install Cline Extension from VSCode marketplace
  2. Open Command Palette (Ctrl+Shift+P / Cmd+Shift+P)
  3. Search for "Cline: Install Package"
  4. Type "wecom-bot-mcp-server" and press Enter

Manual Installation

Install from PyPI:

pip install wecom-bot-mcp-server

Configure MCP manually by creating or updating your MCP configuration file:

// For Windsurf: ~/.windsurf/config.json
{
  "mcpServers": {
    "wecom": {
      "command": "uvx",
      "args": [
        "wecom-bot-mcp-server"
      ],
      "env": {
        "WECOM_WEBHOOK_URL": "your-webhook-url"
      }
    }
  }
}

Configuration

Setting Environment Variables

# Windows PowerShell
$env:WECOM_WEBHOOK_URL = "your-webhook-url"

# Optional configurations
$env:MCP_LOG_LEVEL = "DEBUG"  # Log levels: DEBUG, INFO, WARNING, ERROR, CRITICAL
$env:MCP_LOG_FILE = "path/to/custom/log/file.log"  # Custom log file path

Log Management

The logging system stores logs in platform-specific directories:

  • Windows: C:\Users\<username>\AppData\Local\hal\wecom-bot-mcp-server
  • Linux: ~/.local/share/hal/wecom-bot-mcp-server
  • macOS: ~/Library/Application Support/hal/wecom-bot-mcp-server

The log file is named mcp_wecom.log.

Usage

Starting the Server

wecom-bot-mcp-server

Using with MCP

# Send weather information
await mcp.send_message(
    content="Shenzhen Weather:\n- Temperature: 25°C\n- Weather: Sunny\n- Air Quality: Good",
    msg_type="markdown"
)

# Send meeting reminder with @mentions
await mcp.send_message(
    content="## Project Review Meeting Reminder\n\nTime: Today 3:00 PM\nLocation: Meeting Room A\n\nPlease be on time!",
    msg_type="markdown",
    mentioned_list=["zhangsan", "lisi"]
)

# Send a file
await mcp.send_message(
    content=Path("weekly_report.docx"),
    msg_type="file"
)

Direct API Usage

Sending Messages

from wecom_bot_mcp_server import mcp

# Send markdown message
await mcp.send_message(
    content="**Hello World!**", 
    msg_type="markdown"
)

# Send text message and mention users
await mcp.send_message(
    content="Hello @user1 @user2",
    msg_type="text",
    mentioned_list=["user1", "user2"]
)

Sending Files

from wecom_bot_mcp_server import send_wecom_file

# Send file
await send_wecom_file("/path/to/file.txt")

Sending Images

from wecom_bot_mcp_server import send_wecom_image

# Send local image
await send_wecom_image("/path/to/image.png")

# Send URL image
await send_wecom_image("https://example.com/image.png")

Supported Features

  • Multiple message types: Text, Markdown, Images (base64), and Files
  • @mention support: Mention users via user ID or phone number
  • Message history tracking
  • Configurable logging system
  • Full type annotations
  • Pydantic-based data validation

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later