Skip to main content
Glama

WeCom Bot MCP Server

WeCom Bot MCP Server

Eine Model Context Protocol (MCP)-kompatible Serverimplementierung für den WeCom (WeChat Work)-Bot.

Englisch |中文

Merkmale

  • Unterstützung für mehrere Nachrichtentypen:
    • Textnachrichten
    • Markdown-Nachrichten
    • Bildnachrichten (base64)
    • Dateinachrichten
  • @mention-Support (über Benutzer-ID oder Telefonnummer)
  • Nachrichtenverlaufsverfolgung
  • Konfigurierbares Protokollierungssystem
  • Vollständige Typanmerkungen
  • Pydantic-basierte Datenvalidierung

Anforderungen

  • Python 3.10+
  • WeCom Bot Webhook-URL (aus den WeCom-Gruppeneinstellungen abgerufen)

Installation

Es gibt mehrere Möglichkeiten, den WeCom Bot MCP-Server zu installieren:

1. Automatisierte Installation (empfohlen)

Smithery verwenden (für Claude Desktop):
npx -y @smithery/cli install wecom-bot-mcp-server --client claude
Verwenden von VSCode mit Cline-Erweiterung:
  1. Installieren Sie die Cline-Erweiterung vom VSCode-Marktplatz
  2. Befehlspalette öffnen (Strg+Umschalt+P / Cmd+Umschalt+P)
  3. Suche nach „Cline: Install Package“
  4. Geben Sie „wecom-bot-mcp-server“ ein und drücken Sie die Eingabetaste

2. Manuelle Installation

Von PyPI installieren:
pip install wecom-bot-mcp-server
MCP manuell konfigurieren:

Erstellen oder aktualisieren Sie Ihre MCP-Konfigurationsdatei:

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

Konfiguration

Festlegen von Umgebungsvariablen

# 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

Protokollverwaltung

Das Protokollierungssystem verwendet platformdirs.user_log_dir() für die plattformübergreifende Verwaltung von Protokolldateien:

  • 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

Die Protokolldatei heißt mcp_wecom.log und wird im oben genannten Verzeichnis gespeichert.

Verwendung

Starten des Servers

wecom-bot-mcp-server

Anwendungsbeispiele (mit MCP)

# Scenario 1: Send weather information to WeCom USER: "How's the weather in Shenzhen today? Send it to WeCom" ASSISTANT: "I'll check Shenzhen's weather and send it to WeCom" await mcp.send_message( content="Shenzhen Weather:\n- Temperature: 25°C\n- Weather: Sunny\n- Air Quality: Good", msg_type="markdown" ) # Scenario 2: Send meeting reminder and @mention relevant people USER: "Send a reminder for the 3 PM project review meeting, remind Zhang San and Li Si to attend" ASSISTANT: "I'll send the meeting reminder" 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"] ) # Scenario 3: Send a file USER: "Send this weekly report to the WeCom group" ASSISTANT: "I'll send the weekly report" await mcp.send_message( content=Path("weekly_report.docx"), msg_type="file" )

Direkte API-Nutzung

Nachrichten senden
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"] )
Dateien senden
from wecom_bot_mcp_server import send_wecom_file # Send file await send_wecom_file("/path/to/file.txt")
Bilder senden
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")

Entwicklung

Einrichten der Entwicklungsumgebung

  1. Klonen Sie das Repository:
git clone https://github.com/loonghao/wecom-bot-mcp-server.git cd wecom-bot-mcp-server
  1. Erstellen Sie eine virtuelle Umgebung und installieren Sie Abhängigkeiten:
# Using uv (recommended) pip install uv uv venv uv pip install -e ".[dev]" # Or using traditional method python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -e ".[dev]"

Testen

# Using uv (recommended) uvx nox -s pytest # Or using traditional method nox -s pytest

Codestil

# Check code uvx nox -s lint # Automatically fix code style issues uvx nox -s lint_fix

Erstellen und Veröffentlichen

# Build the package uv build # Build and publish to PyPI uv build && twine upload dist/*

Projektstruktur

wecom-bot-mcp-server/ ├── src/ │ └── wecom_bot_mcp_server/ │ ├── __init__.py │ ├── server.py │ ├── message.py │ ├── file.py │ ├── image.py │ ├── utils.py │ └── errors.py ├── tests/ │ ├── test_server.py │ ├── test_message.py │ ├── test_file.py │ └── test_image.py ├── docs/ ├── pyproject.toml ├── noxfile.py └── README.md

Lizenz

Dieses Projekt ist unter der MIT-Lizenz lizenziert – Einzelheiten finden Sie in der Datei LICENSE .

Kontakt

-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Ein Server zum Senden von Nachrichten über WeCom-Bots mit FastMCP, der asynchrone Kommunikation und Nachrichtenverfolgung über Webhooks unterstützt.

  1. Merkmale
    1. Anforderungen
      1. Installation
        1. Automatisierte Installation (empfohlen)
        2. Manuelle Installation
      2. Konfiguration
        1. Festlegen von Umgebungsvariablen
        2. Protokollverwaltung
      3. Verwendung
        1. Starten des Servers
        2. Anwendungsbeispiele (mit MCP)
        3. Direkte API-Nutzung
      4. Entwicklung
        1. Einrichten der Entwicklungsumgebung
        2. Testen
        3. Codestil
        4. Erstellen und Veröffentlichen
      5. Projektstruktur
        1. Lizenz
          1. Kontakt

            Related MCP Servers

            • -
              security
              F
              license
              -
              quality
              An MCP server that enables communication with users through Telegram. This server provides a tool to ask questions to users and receive their responses via a Telegram bot.
              Last updated -
              1
              16
              JavaScript
            • A
              security
              A
              license
              A
              quality
              Enables sending messages to webhook endpoints through the MCP protocol, supporting custom content, display names, and avatar URLs.
              Last updated -
              1
              31
              13
              JavaScript
              MIT License
            • A
              security
              A
              license
              A
              quality
              An MCP server that enables posting messages to Discord webhooks, allowing customization of content, username, and avatar URL.
              Last updated -
              1
              0
              JavaScript
              MIT License
            • A
              security
              F
              license
              A
              quality
              An MCP server that enables interaction with Telegram messaging platform, allowing users to retrieve unread messages, fetch entity information, and send messages through natural language interfaces.
              Last updated -
              6
              8
              Python

            View all related MCP servers

            MCP directory API

            We provide all the information about MCP servers via our MCP API.

            curl -X GET 'https://glama.ai/api/mcp/v1/servers/loonghao/wecom-bot-mcp-server'

            If you have feedback or need assistance with the MCP directory API, please join our Discord server