WeCom Bot MCP Server
WeCom Bot MCP 서버
WeCom(WeChat Work) 봇을 위한 MCP(Model Context Protocol) 호환 서버 구현입니다.
특징
다양한 메시지 유형 지원:
문자 메시지
마크다운 메시지
이미지 메시지(base64)
파일 메시지
@멘션 지원(사용자 ID 또는 전화번호를 통해)
메시지 기록 추적
구성 가능한 로깅 시스템
전체 유형 주석
Pydantic 기반 데이터 검증
Related MCP server: EdgeOne MCP Pusher
요구 사항
파이썬 3.10+
WeCom Bot Webhook URL(WeCom 그룹 설정에서 가져옴)
설치
WeCom Bot MCP 서버를 설치하는 방법에는 여러 가지가 있습니다.
1. 자동 설치(권장)
Smithery 사용하기(Claude Desktop용):
지엑스피1
Cline Extension과 함께 VSCode 사용하기:
VSCode 마켓플레이스에서 Cline Extension 설치
명령 팔레트 열기(Ctrl+Shift+P / Cmd+Shift+P)
"Cline: 패키지 설치"를 검색하세요
"wecom-bot-mcp-server"를 입력하고 Enter를 누르세요.
2. 수동 설치
PyPI에서 설치:
pip install wecom-bot-mcp-serverMCP를 수동으로 구성하세요.
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-servermacOS:
~/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")개발
개발 환경 설정
저장소를 복제합니다.
git clone https://github.com/loonghao/wecom-bot-mcp-server.git
cd wecom-bot-mcp-server가상 환경을 만들고 종속성을 설치합니다.
# 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 라이선스에 따라 라이선스가 부여되었습니다. 자세한 내용은 라이선스 파일을 참조하세요.
연락하다
저자: 롱하오
이메일: hal.long@outlook.com
This server cannot be deployed
Maintenance
Related MCP Connectors
FastMCP server for posting formatted content to X (Twitter) — Tollbooth-monetized, DPYC-native
MCP server for Sendbird — chat users, channels, members, and messages from your AI client.
MCP server for Appcircle mobile CI/CD platform.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA WeChat robot server based on the Model Context Protocol that enables AI agents to send and receive messages and manage typing status. It provides tools for QR code login, long-polling message retrieval, and persistent state management across various MCP clients.29 npm108MIT
- AlicenseNot gradedqualityCmaintenanceFree self-hosted WeChat push notification service with a standard MCP Server, enabling message sending via Webhook or MCP tools.GPL 3.0
- AlicenseCqualityCmaintenanceMCP server for WeCom customer contact API, enabling LLMs to manage customers, tags, group chats, moments, and mass-send messages.13MIT
- FlicenseNot gradedqualityDmaintenanceMCP server for WeChat PC automation, enabling message sending, voice/video calls, and AI-powered listening through Cursor or WorkBuddy.2-