MCP Server WeChat logo

MCP Server WeChat

Community
panxingfeng

基于MCP技术,操作微信发送消息和获取历史记录

Publisherpanxingfeng
Repositorymcp_server_wechat
LanguagePython
Forks
26
Stars
99
Available tools
0
Transport typestdio
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    MCP Server WeChat exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    99 stars and 26 forks from the linked repository.

MCP Server WeChat

基于MCP技术的微信聊天记录获取和消息发送功能的服务器,使用pywechat工具实现微信自动化操作。

功能特点

此服务器提供以下主要功能:

  • 获取微信聊天记录(指定日期)
  • 发送单条消息给单个好友
  • 发送多条消息给单个好友
  • 发送消息给多个好友

可用工具

  • wechat_get_chat_history - 获取特定日期的微信聊天记录

    • 必需参数:
      • to_user (string): 好友或群聊备注或昵称
      • target_date (string): 目标日期,格式为YY/M/D,如25/3/22
  • wechat_send_message - 向单个微信好友发送单条消息

    • 必需参数:
      • to_user (string): 好友或群聊备注或昵称
      • message (string): 要发送的消息
  • wechat_send_multiple_messages - 向单个微信好友发送多条消息

    • 必需参数:
      • to_user (string): 好友或群聊备注或昵称
      • messages (array): 要发送的消息列表 (用英文逗号分隔的字符串输入)
  • wechat_send_to_multiple_friends - 向多个微信好友发送单条或者多条消息

    • 必需参数:
      • to_user (array): 好友或群聊备注或昵称列表 (用英文逗号分隔的字符串输入)
      • message (string/array): 要发送的消息 (单条消息会发给所有好友;多条消息用英文逗号分隔且数量与好友数相同时,将分别发送给对应好友)

安装方法

stdio版

bash
pip install mcp_server_wechat

获取最新
pip install --upgrade mcp_server_wechat

sse版/Streamable_HTTP版

bash
python -m venv venv  # 创建虚拟环境
venv/scripts/activate # 激活环境
pip install -r requirements.txt

使用示例

配置为 MCP 服务

在您的 MCP 配置中添加:

stdio版

json
{
    "mcpServers": {
        "wechat": {
            "command": "python",
            "args": ["-m", "mcp_server_wechat","--folder-path=存放历史记录的目录"]
        }
    }
}

sse版

启动命令

bash
python -m mcp_server_wechat_sse --folder-path=x:\xxxxx #默认文件夹可以在代码中修改
json
{
    "mcpServers": {
        "wechat": {
            "url": "http://localhost:3000/sse"
        }
    }
}

Streamable_HTTP版

启动命令

bash
python -m mcp_server_wechat_Streamable_HTTP --folder-path=x:\xxxxx #默认文件夹可以在代码中修改
json
{
    "mcpServers": {
        "wechat": {
            "url": "http://localhost:3000/mcp"
        }
    }
}

调用示例

  1. 获取聊天记录:
json
{
  "name": "wechat_get_chat_history",
  "arguments": {
    "to_user": "张三",
    "target_date": "25/3/22"
  }
}
  1. 发送单条消息:
json
{
  "name": "wechat_send_message",
  "arguments": {
    "to_user": "张三",
    "message": "你好,这是一条测试消息"
  }
}
  1. 发送多条消息:
json
{
  "name": "wechat_send_multiple_messages",
  "arguments": {
    "to_user": "张三",
    "messages": "你好","这是第一条消息","这是第二条消息"
  }
}
  1. 发送给多个好友(单条消息):
json
{
  "name": "wechat_send_to_multiple_friends",
  "arguments": {
    "to_user": ["张三", "李四", "王五"],
    "message": "大家好,这是一条群发消息"或者"你好,张三","你好,李四","你好,王五"
  }
}

调试

您可以使用 MCP inspector 来调试服务器:

bash
npx @modelcontextprotocol/inspector python -m mcp_server_wechat

实际效果展示

注意事项

  • 使用本工具需要保持微信桌面版处于登录状态
  • 获取聊天记录和发送消息需要确保微信窗口能够被正常操作
  • 在使用过程中,请勿手动操作微信窗口,以免干扰自动化操作
  • 请勿使用此工具进行任何违反微信服务协议的行为

许可证

mcp_server_wechat 使用 MIT 许可证。这意味着您可以自由使用、修改和分发此软件,但需遵守 MIT 许可证的条款和条件。详情请参阅项目仓库中的 LICENSE 文件。

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "panxingfeng-mcp_server_wechat": {
      "command": "uvx",
      "args": [
        "mcp_server_wechat"
      ]
    }
  }
}

Use MCP Server WeChat MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once MCP Server WeChat is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add MCP Server WeChat as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the MCP Server WeChat MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "panxingfeng-mcp_server_wechat": {
      "command": "npx",
      "args": [
        "-y",
        "mcp_server_wechat"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the MCP Server WeChat MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the MCP Server WeChat MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use MCP Server WeChat to help me with this task?
MCP Server WeChat
Sure. I read it.
Here is what I found using MCP Server WeChat.

Frequently asked questions

What is the MCP Server WeChat MCP server used for?

MCP Server WeChat is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use MCP Server WeChat MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use MCP Server WeChat with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use MCP Server WeChat MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With MCP Server WeChat connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect MCP Server WeChat MCP to TypingMind?

MCP Server WeChat runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does MCP Server WeChat MCP provide in TypingMind?

MCP Server WeChat exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use MCP Server WeChat MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If MCP Server WeChat requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇