wecom-bot-mcp-server


Namewecom-bot-mcp-server JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryWeCom Bot MCP Server - A Python server for WeCom (WeChat Work) bot following the Model Context Protocol (MCP)
upload_time2025-01-02 17:02:26
maintainerNone
docs_urlNone
authorlonghao
requires_python<4.0,>=3.10
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # WeCom Bot MCP Server

[![Python Package](https://github.com/loonghao/wecom-bot-mcp-server/actions/workflows/python-package.yml/badge.svg)](https://github.com/loonghao/wecom-bot-mcp-server/actions/workflows/python-package.yml)
[![codecov](https://codecov.io/gh/loonghao/wecom-bot-mcp-server/branch/main/graph/badge.svg)](https://codecov.io/gh/loonghao/wecom-bot-mcp-server)
[![PyPI version](https://badge.fury.io/py/wecom-bot-mcp-server.svg)](https://badge.fury.io/py/wecom-bot-mcp-server)
[![Python Version](https://img.shields.io/pypi/pyversions/wecom-bot-mcp-server.svg)](https://pypi.org/project/wecom-bot-mcp-server/)

A WeCom (WeChat Work) bot server implemented with FastMCP, supporting message sending via webhook.

[中文文档](README_zh.md) | English

## Features

- Built on FastMCP framework
- Markdown message format support
- Asynchronous message sending
- Message history tracking
- Complete type hints
- Comprehensive unit tests

## Installation

Using pip:

```bash
pip install wecom-bot-mcp-server
```

Or using poetry (recommended):

```bash
poetry add wecom-bot-mcp-server
```

## Usage

1. Set environment variable:

```bash
# Windows PowerShell
$env:WECOM_WEBHOOK_URL="your WeCom bot webhook URL"

# Linux/macOS
export WECOM_WEBHOOK_URL="your WeCom bot webhook URL"
```

2. Run the server:

```bash
# Run directly after installation
wecom-bot-mcp-server
```

Or use in code:

```python
from wecom_bot_mcp_server.server import main

# Start server
if __name__ == "__main__":
    main()
```

3. Send messages:

```python
from wecom_bot_mcp_server.server import send_message, get_message_history

# Send a message
await send_message("Hello, WeCom!")

# Get message history
history = get_message_history()
```

## Cline Configuration

1. Install dependency:

```bash
poetry add wecom-bot-mcp-server
```

2. Configure Cline MCP settings:

Configure the Cline MCP settings file in VSCode. File location:
- Windows: `%APPDATA%\Code\User\globalStorage\rooveterinaryinc.roo-cline\settings\cline_mcp_settings.json`
- Linux: `~/.config/Code/User/globalStorage\rooveterinaryinc.roo-cline\settings\cline_mcp_settings.json`
- macOS: `~/Library/Application Support/Code/User/globalStorage\rooveterinaryinc.roo-cline\settings\cline_mcp_settings.json`

Add the following configuration:

```json
{
  "mcpServers": {
    "wecom-bot-server": {
      "command": "wecom-bot-mcp-server",
      "args": [],
      "env": {
        "WECOM_WEBHOOK_URL": "<your WeCom bot webhook URL>"
      },
      "alwaysAllow": [
        "send_message"
      ],
      "disabled": false
    }
  }
}
```

Configuration notes:
- `command`: Uses the installed command-line tool
- `env.WECOM_WEBHOOK_URL`: Replace with your actual WeCom bot webhook URL

## Development

1. Clone repository:

```bash
git clone https://github.com/loonghao/wecom-bot-mcp-server.git
cd wecom-bot-mcp-server
```

2. Install poetry and dependencies:

```bash
pip install poetry
poetry install --with dev
```

3. Run tests:

```bash
poetry run pytest tests/ --cov=wecom_bot_mcp_server
```

4. Code checks:

```bash
poetry run ruff check .
poetry run ruff format .
poetry run mypy src/wecom_bot_mcp_server --strict
```

## Requirements

- Python >= 3.10
- FastMCP >= 0.4.1
- httpx >= 0.24.1

## License

[MIT License](LICENSE)

## Contributing

Issues and Pull Requests are welcome!

---

# WeCom Bot MCP Server (中文)

[English](#wecom-bot-mcp-server) | 中文

## 特性

- 基于 FastMCP 框架实现
- 支持 Markdown 格式消息
- 异步消息发送
- 消息历史记录
- 完整的类型提示
- 全面的单元测试

## 安装

使用 pip 安装:

```bash
pip install wecom-bot-mcp-server
```

或者使用 poetry 安装(推荐):

```bash
poetry add wecom-bot-mcp-server
```

## 使用方法

1. 设置环境变量:

```bash
# Windows PowerShell
$env:WECOM_WEBHOOK_URL="你的企业微信机器人 Webhook URL"

# Linux/macOS
export WECOM_WEBHOOK_URL="你的企业微信机器人 Webhook URL"
```

2. 运行服务器:

```bash
# 安装后可以直接运行命令
wecom-bot-mcp-server
```

或者在代码中使用:

```python
from wecom_bot_mcp_server.server import main

# 启动服务器
if __name__ == "__main__":
    main()
```

3. 发送消息:

```python
from wecom_bot_mcp_server.server import send_message, get_message_history

# 发送消息
await send_message("Hello, WeCom!")

# 获取消息历史
history = get_message_history()
```

## 在 Cline 中配置

1. 安装依赖:

```bash
poetry add wecom-bot-mcp-server
```

2. 配置 Cline MCP 设置:

在 VSCode 中,需要配置 Cline MCP 设置文件。文件位置:
- Windows: `%APPDATA%\Code\User\globalStorage\rooveterinaryinc.roo-cline\settings\cline_mcp_settings.json`
- Linux: `~/.config/Code/User/globalStorage\rooveterinaryinc.roo-cline\settings\cline_mcp_settings.json`
- macOS: `~/Library/Application Support/Code/User/globalStorage\rooveterinaryinc.roo-cline\settings\cline_mcp_settings.json`

添加以下配置:

```json
{
  "mcpServers": {
    "wecom-bot-server": {
      "command": "wecom-bot-mcp-server",
      "args": [],
      "env": {
        "WECOM_WEBHOOK_URL": "<你的企业微信机器人Webhook URL>"
      },
      "alwaysAllow": [
        "send_message"
      ],
      "disabled": false
    }
  }
}
```

配置说明:
- `command`: 使用安装后的命令行工具
- `env.WECOM_WEBHOOK_URL`: 替换为你的企业微信机器人实际的 Webhook URL

## 开发

1. 克隆仓库:

```bash
git clone https://github.com/loonghao/wecom-bot-mcp-server.git
cd wecom-bot-mcp-server
```

2. 安装 poetry 和依赖:

```bash
pip install poetry
poetry install --with dev
```

3. 运行测试:

```bash
poetry run pytest tests/ --cov=wecom_bot_mcp_server
```

4. 代码检查:

```bash
poetry run ruff check .
poetry run ruff format .
poetry run mypy src/wecom_bot_mcp_server --strict
```

## 要求

- Python >= 3.10
- FastMCP >= 0.4.1
- httpx >= 0.24.1

## 许可证

[MIT License](LICENSE)

## 贡献

欢迎提交 Issue 和 Pull Request!


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "wecom-bot-mcp-server",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "longhao",
    "author_email": "hal.long@outlook.com",
    "download_url": "https://files.pythonhosted.org/packages/9e/e5/a11f93b49fbbe6387976a270e56acd989ab89d50b27755fe3b55036df0af/wecom_bot_mcp_server-0.1.0.tar.gz",
    "platform": null,
    "description": "# WeCom Bot MCP Server\n\n[![Python Package](https://github.com/loonghao/wecom-bot-mcp-server/actions/workflows/python-package.yml/badge.svg)](https://github.com/loonghao/wecom-bot-mcp-server/actions/workflows/python-package.yml)\n[![codecov](https://codecov.io/gh/loonghao/wecom-bot-mcp-server/branch/main/graph/badge.svg)](https://codecov.io/gh/loonghao/wecom-bot-mcp-server)\n[![PyPI version](https://badge.fury.io/py/wecom-bot-mcp-server.svg)](https://badge.fury.io/py/wecom-bot-mcp-server)\n[![Python Version](https://img.shields.io/pypi/pyversions/wecom-bot-mcp-server.svg)](https://pypi.org/project/wecom-bot-mcp-server/)\n\nA WeCom (WeChat Work) bot server implemented with FastMCP, supporting message sending via webhook.\n\n[\u4e2d\u6587\u6587\u6863](README_zh.md) | English\n\n## Features\n\n- Built on FastMCP framework\n- Markdown message format support\n- Asynchronous message sending\n- Message history tracking\n- Complete type hints\n- Comprehensive unit tests\n\n## Installation\n\nUsing pip:\n\n```bash\npip install wecom-bot-mcp-server\n```\n\nOr using poetry (recommended):\n\n```bash\npoetry add wecom-bot-mcp-server\n```\n\n## Usage\n\n1. Set environment variable:\n\n```bash\n# Windows PowerShell\n$env:WECOM_WEBHOOK_URL=\"your WeCom bot webhook URL\"\n\n# Linux/macOS\nexport WECOM_WEBHOOK_URL=\"your WeCom bot webhook URL\"\n```\n\n2. Run the server:\n\n```bash\n# Run directly after installation\nwecom-bot-mcp-server\n```\n\nOr use in code:\n\n```python\nfrom wecom_bot_mcp_server.server import main\n\n# Start server\nif __name__ == \"__main__\":\n    main()\n```\n\n3. Send messages:\n\n```python\nfrom wecom_bot_mcp_server.server import send_message, get_message_history\n\n# Send a message\nawait send_message(\"Hello, WeCom!\")\n\n# Get message history\nhistory = get_message_history()\n```\n\n## Cline Configuration\n\n1. Install dependency:\n\n```bash\npoetry add wecom-bot-mcp-server\n```\n\n2. Configure Cline MCP settings:\n\nConfigure the Cline MCP settings file in VSCode. File location:\n- Windows: `%APPDATA%\\Code\\User\\globalStorage\\rooveterinaryinc.roo-cline\\settings\\cline_mcp_settings.json`\n- Linux: `~/.config/Code/User/globalStorage\\rooveterinaryinc.roo-cline\\settings\\cline_mcp_settings.json`\n- macOS: `~/Library/Application Support/Code/User/globalStorage\\rooveterinaryinc.roo-cline\\settings\\cline_mcp_settings.json`\n\nAdd the following configuration:\n\n```json\n{\n  \"mcpServers\": {\n    \"wecom-bot-server\": {\n      \"command\": \"wecom-bot-mcp-server\",\n      \"args\": [],\n      \"env\": {\n        \"WECOM_WEBHOOK_URL\": \"<your WeCom bot webhook URL>\"\n      },\n      \"alwaysAllow\": [\n        \"send_message\"\n      ],\n      \"disabled\": false\n    }\n  }\n}\n```\n\nConfiguration notes:\n- `command`: Uses the installed command-line tool\n- `env.WECOM_WEBHOOK_URL`: Replace with your actual WeCom bot webhook URL\n\n## Development\n\n1. Clone repository:\n\n```bash\ngit clone https://github.com/loonghao/wecom-bot-mcp-server.git\ncd wecom-bot-mcp-server\n```\n\n2. Install poetry and dependencies:\n\n```bash\npip install poetry\npoetry install --with dev\n```\n\n3. Run tests:\n\n```bash\npoetry run pytest tests/ --cov=wecom_bot_mcp_server\n```\n\n4. Code checks:\n\n```bash\npoetry run ruff check .\npoetry run ruff format .\npoetry run mypy src/wecom_bot_mcp_server --strict\n```\n\n## Requirements\n\n- Python >= 3.10\n- FastMCP >= 0.4.1\n- httpx >= 0.24.1\n\n## License\n\n[MIT License](LICENSE)\n\n## Contributing\n\nIssues and Pull Requests are welcome!\n\n---\n\n# WeCom Bot MCP Server (\u4e2d\u6587)\n\n[English](#wecom-bot-mcp-server) | \u4e2d\u6587\n\n## \u7279\u6027\n\n- \u57fa\u4e8e FastMCP \u6846\u67b6\u5b9e\u73b0\n- \u652f\u6301 Markdown \u683c\u5f0f\u6d88\u606f\n- \u5f02\u6b65\u6d88\u606f\u53d1\u9001\n- \u6d88\u606f\u5386\u53f2\u8bb0\u5f55\n- \u5b8c\u6574\u7684\u7c7b\u578b\u63d0\u793a\n- \u5168\u9762\u7684\u5355\u5143\u6d4b\u8bd5\n\n## \u5b89\u88c5\n\n\u4f7f\u7528 pip \u5b89\u88c5\uff1a\n\n```bash\npip install wecom-bot-mcp-server\n```\n\n\u6216\u8005\u4f7f\u7528 poetry \u5b89\u88c5\uff08\u63a8\u8350\uff09\uff1a\n\n```bash\npoetry add wecom-bot-mcp-server\n```\n\n## \u4f7f\u7528\u65b9\u6cd5\n\n1. \u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\uff1a\n\n```bash\n# Windows PowerShell\n$env:WECOM_WEBHOOK_URL=\"\u4f60\u7684\u4f01\u4e1a\u5fae\u4fe1\u673a\u5668\u4eba Webhook URL\"\n\n# Linux/macOS\nexport WECOM_WEBHOOK_URL=\"\u4f60\u7684\u4f01\u4e1a\u5fae\u4fe1\u673a\u5668\u4eba Webhook URL\"\n```\n\n2. \u8fd0\u884c\u670d\u52a1\u5668\uff1a\n\n```bash\n# \u5b89\u88c5\u540e\u53ef\u4ee5\u76f4\u63a5\u8fd0\u884c\u547d\u4ee4\nwecom-bot-mcp-server\n```\n\n\u6216\u8005\u5728\u4ee3\u7801\u4e2d\u4f7f\u7528\uff1a\n\n```python\nfrom wecom_bot_mcp_server.server import main\n\n# \u542f\u52a8\u670d\u52a1\u5668\nif __name__ == \"__main__\":\n    main()\n```\n\n3. \u53d1\u9001\u6d88\u606f\uff1a\n\n```python\nfrom wecom_bot_mcp_server.server import send_message, get_message_history\n\n# \u53d1\u9001\u6d88\u606f\nawait send_message(\"Hello, WeCom!\")\n\n# \u83b7\u53d6\u6d88\u606f\u5386\u53f2\nhistory = get_message_history()\n```\n\n## \u5728 Cline \u4e2d\u914d\u7f6e\n\n1. \u5b89\u88c5\u4f9d\u8d56\uff1a\n\n```bash\npoetry add wecom-bot-mcp-server\n```\n\n2. \u914d\u7f6e Cline MCP \u8bbe\u7f6e\uff1a\n\n\u5728 VSCode \u4e2d\uff0c\u9700\u8981\u914d\u7f6e Cline MCP \u8bbe\u7f6e\u6587\u4ef6\u3002\u6587\u4ef6\u4f4d\u7f6e\uff1a\n- Windows: `%APPDATA%\\Code\\User\\globalStorage\\rooveterinaryinc.roo-cline\\settings\\cline_mcp_settings.json`\n- Linux: `~/.config/Code/User/globalStorage\\rooveterinaryinc.roo-cline\\settings\\cline_mcp_settings.json`\n- macOS: `~/Library/Application Support/Code/User/globalStorage\\rooveterinaryinc.roo-cline\\settings\\cline_mcp_settings.json`\n\n\u6dfb\u52a0\u4ee5\u4e0b\u914d\u7f6e\uff1a\n\n```json\n{\n  \"mcpServers\": {\n    \"wecom-bot-server\": {\n      \"command\": \"wecom-bot-mcp-server\",\n      \"args\": [],\n      \"env\": {\n        \"WECOM_WEBHOOK_URL\": \"<\u4f60\u7684\u4f01\u4e1a\u5fae\u4fe1\u673a\u5668\u4ebaWebhook URL>\"\n      },\n      \"alwaysAllow\": [\n        \"send_message\"\n      ],\n      \"disabled\": false\n    }\n  }\n}\n```\n\n\u914d\u7f6e\u8bf4\u660e\uff1a\n- `command`: \u4f7f\u7528\u5b89\u88c5\u540e\u7684\u547d\u4ee4\u884c\u5de5\u5177\n- `env.WECOM_WEBHOOK_URL`: \u66ff\u6362\u4e3a\u4f60\u7684\u4f01\u4e1a\u5fae\u4fe1\u673a\u5668\u4eba\u5b9e\u9645\u7684 Webhook URL\n\n## \u5f00\u53d1\n\n1. \u514b\u9686\u4ed3\u5e93\uff1a\n\n```bash\ngit clone https://github.com/loonghao/wecom-bot-mcp-server.git\ncd wecom-bot-mcp-server\n```\n\n2. \u5b89\u88c5 poetry \u548c\u4f9d\u8d56\uff1a\n\n```bash\npip install poetry\npoetry install --with dev\n```\n\n3. \u8fd0\u884c\u6d4b\u8bd5\uff1a\n\n```bash\npoetry run pytest tests/ --cov=wecom_bot_mcp_server\n```\n\n4. \u4ee3\u7801\u68c0\u67e5\uff1a\n\n```bash\npoetry run ruff check .\npoetry run ruff format .\npoetry run mypy src/wecom_bot_mcp_server --strict\n```\n\n## \u8981\u6c42\n\n- Python >= 3.10\n- FastMCP >= 0.4.1\n- httpx >= 0.24.1\n\n## \u8bb8\u53ef\u8bc1\n\n[MIT License](LICENSE)\n\n## \u8d21\u732e\n\n\u6b22\u8fce\u63d0\u4ea4 Issue \u548c Pull Request\uff01\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "WeCom Bot MCP Server - A Python server for WeCom (WeChat Work) bot following the Model Context Protocol (MCP)",
    "version": "0.1.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ebec48bfe885c3d26e32e22c2ee8c20bb7383c22600a2ca6de8028bf43041a4f",
                "md5": "0b6ff9f6470ab3351961cff9b243904b",
                "sha256": "1103a81e37f93c429a0058e4d8c64575dc0751576dca748efdf20b04e20f19ad"
            },
            "downloads": -1,
            "filename": "wecom_bot_mcp_server-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0b6ff9f6470ab3351961cff9b243904b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 7315,
            "upload_time": "2025-01-02T17:02:24",
            "upload_time_iso_8601": "2025-01-02T17:02:24.628666Z",
            "url": "https://files.pythonhosted.org/packages/eb/ec/48bfe885c3d26e32e22c2ee8c20bb7383c22600a2ca6de8028bf43041a4f/wecom_bot_mcp_server-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9ee5a11f93b49fbbe6387976a270e56acd989ab89d50b27755fe3b55036df0af",
                "md5": "ee09fbc2c83a1d7e396eda839951d76a",
                "sha256": "5b95950b2d5c68afd916ee84c91b5e6a6ee2b0c5b83ec8740b79b820511fe540"
            },
            "downloads": -1,
            "filename": "wecom_bot_mcp_server-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ee09fbc2c83a1d7e396eda839951d76a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 6919,
            "upload_time": "2025-01-02T17:02:26",
            "upload_time_iso_8601": "2025-01-02T17:02:26.071689Z",
            "url": "https://files.pythonhosted.org/packages/9e/e5/a11f93b49fbbe6387976a270e56acd989ab89d50b27755fe3b55036df0af/wecom_bot_mcp_server-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-02 17:02:26",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "wecom-bot-mcp-server"
}
        
Elapsed time: 1.31259s