Skip to main content
Glama

WeCom Bot MCP 서버

WeCom(WeChat Work) 봇을 위한 MCP(Model Context Protocol) 호환 서버 구현입니다.

PyPI 버전 파이썬 버전 코드코브 코드 스타일: ruff 대장간 배지

영어 | 중문

특징

  • 다양한 메시지 유형 지원:

    • 문자 메시지

    • 마크다운 메시지

    • 이미지 메시지(base64)

    • 파일 메시지

  • @멘션 지원(사용자 ID 또는 전화번호를 통해)

  • 메시지 기록 추적

  • 구성 가능한 로깅 시스템

  • 전체 유형 주석

  • Pydantic 기반 데이터 검증

Related MCP server: MCP Webhook Server

요구 사항

  • 파이썬 3.10+

  • WeCom Bot Webhook URL(WeCom 그룹 설정에서 가져옴)

설치

WeCom Bot MCP 서버를 설치하는 방법에는 여러 가지가 있습니다.

1. 자동 설치(권장)

Smithery 사용하기(Claude Desktop용):

지엑스피1

Cline Extension과 함께 VSCode 사용하기:

  1. VSCode 마켓플레이스에서 Cline Extension 설치

  2. 명령 팔레트 열기(Ctrl+Shift+P / Cmd+Shift+P)

  3. "Cline: 패키지 설치"를 검색하세요

  4. "wecom-bot-mcp-server"를 입력하고 Enter를 누르세요.

2. 수동 설치

PyPI에서 설치:

pip install wecom-bot-mcp-server

MCP를 수동으로 구성하세요.

MCP 구성 파일을 만들거나 업데이트하세요.

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

구성

환경 변수 설정

# 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

로그 관리

로깅 시스템은 크로스 플랫폼 로그 파일 관리를 위해 platformdirs.user_log_dir() 사용합니다.

  • Windows: C:\Users\<username>\AppData\Local\hal\wecom-bot-mcp-server

  • 리눅스: ~/.local/share/hal/wecom-bot-mcp-server

  • macOS: ~/Library/Application Support/hal/wecom-bot-mcp-server

로그 파일의 이름은 mcp_wecom.log 이고 위 디렉토리에 저장됩니다.

용법

서버 시작

wecom-bot-mcp-server

사용 예(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"
)

직접 API 사용

메시지 보내기

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"]
)

파일 보내기

from wecom_bot_mcp_server import send_wecom_file

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

이미지 보내기

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")

개발

개발 환경 설정

  1. 저장소를 복제합니다.

git clone https://github.com/loonghao/wecom-bot-mcp-server.git
cd wecom-bot-mcp-server
  1. 가상 환경을 만들고 종속성을 설치합니다.

# 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]"

테스트

# Using uv (recommended)
uvx nox -s pytest

# Or using traditional method
nox -s pytest

코드 스타일

# Check code
uvx nox -s lint

# Automatically fix code style issues
uvx nox -s lint_fix

건축 및 출판

# Build the package
uv build

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

프로젝트 구조

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

특허

이 프로젝트는 MIT 라이선스에 따라 라이선스가 부여되었습니다. 자세한 내용은 라이선스 파일을 참조하세요.

연락하다

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

Latest Blog Posts

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