weixin-mcp 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +69 -0
- package/README.md +25 -25
- package/package.json +1 -1
package/README.en.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# weixin-mcp
|
|
2
|
+
|
|
3
|
+
Standalone MCP server for WeChat — expose WeChat messaging as MCP tools for Claude Desktop and other MCP clients.
|
|
4
|
+
|
|
5
|
+
Reuses the token from [OpenClaw weixin plugin](https://www.npmjs.com/package/@tencent-weixin/openclaw-weixin) if already installed, or supports independent QR login.
|
|
6
|
+
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
### Step 1 — Login (first time only)
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx weixin-login
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
A QR code will appear in your terminal. Scan it with WeChat and confirm. Token is saved locally.
|
|
16
|
+
|
|
17
|
+
### Step 2 — Start the MCP server
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx weixin-mcp
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Claude Desktop Integration
|
|
24
|
+
|
|
25
|
+
Add to your `claude_desktop_config.json`:
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"mcpServers": {
|
|
30
|
+
"weixin": {
|
|
31
|
+
"command": "npx",
|
|
32
|
+
"args": ["weixin-mcp"]
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Restart Claude Desktop. You can now ask Claude to send WeChat messages or poll for new ones.
|
|
39
|
+
|
|
40
|
+
## Tools
|
|
41
|
+
|
|
42
|
+
| Tool | Description | Parameters |
|
|
43
|
+
|------|-------------|------------|
|
|
44
|
+
| `weixin_send` | Send a text message | `to` (user ID), `text`, `context_token` (optional — link reply to a conversation) |
|
|
45
|
+
| `weixin_poll` | Poll for new messages (cursor-based, no duplicates) | `reset_cursor` (optional boolean) |
|
|
46
|
+
| `weixin_get_config` | Get user config (typing ticket, etc.) | `user_id`, `context_token` (optional) |
|
|
47
|
+
|
|
48
|
+
## Already using OpenClaw weixin plugin?
|
|
49
|
+
|
|
50
|
+
If you've already logged in via OpenClaw, no login needed — `npx weixin-mcp` will pick up the existing token automatically.
|
|
51
|
+
|
|
52
|
+
## Environment Variables
|
|
53
|
+
|
|
54
|
+
| Variable | Default | Description |
|
|
55
|
+
|----------|---------|-------------|
|
|
56
|
+
| `OPENCLAW_STATE_DIR` | `~/.openclaw` | State directory; accounts are read from `$OPENCLAW_STATE_DIR/openclaw-weixin/accounts/` |
|
|
57
|
+
| `WEIXIN_ACCOUNT_ID` | first account found | Specify which account to use (filename without `.json`) |
|
|
58
|
+
|
|
59
|
+
## Re-login
|
|
60
|
+
|
|
61
|
+
If your token expires:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npx weixin-login
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
MIT
|
package/README.md
CHANGED
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
# weixin-mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
基于 MCP 协议的微信消息服务端——将微信能力暴露为 MCP 工具,供 Claude Desktop 及其他 MCP 客户端使用。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
支持复用 [OpenClaw weixin 插件](https://www.npmjs.com/package/@tencent-weixin/openclaw-weixin) 的已有登录态,或独立扫码登录。
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
[English](./README.en.md)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## 快速开始
|
|
10
|
+
|
|
11
|
+
### 第一步 — 登录(首次使用)
|
|
10
12
|
|
|
11
13
|
```bash
|
|
12
14
|
npx weixin-login
|
|
13
15
|
```
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
终端会显示二维码,微信扫码确认后 token 自动保存到本地。
|
|
16
18
|
|
|
17
|
-
###
|
|
19
|
+
### 第二步 — 启动 MCP 服务
|
|
18
20
|
|
|
19
21
|
```bash
|
|
20
22
|
npx weixin-mcp
|
|
21
23
|
```
|
|
22
24
|
|
|
23
|
-
## Claude Desktop
|
|
25
|
+
## Claude Desktop 集成
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
在 `claude_desktop_config.json` 中添加:
|
|
26
28
|
|
|
27
29
|
```json
|
|
28
30
|
{
|
|
@@ -35,30 +37,28 @@ Add to your `claude_desktop_config.json`:
|
|
|
35
37
|
}
|
|
36
38
|
```
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
## Tools
|
|
40
|
+
重启 Claude Desktop 后,即可让 Claude 直接发送微信消息或拉取新消息。
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|------|-------------|------------|
|
|
44
|
-
| `weixin_send` | Send a text message | `to` (user ID), `text`, `context_token` (optional — link reply to a conversation) |
|
|
45
|
-
| `weixin_poll` | Poll for new messages (cursor-based, no duplicates) | `reset_cursor` (optional boolean) |
|
|
46
|
-
| `weixin_get_config` | Get user config (typing ticket, etc.) | `user_id`, `context_token` (optional) |
|
|
42
|
+
## 工具列表
|
|
47
43
|
|
|
48
|
-
|
|
44
|
+
| 工具名 | 说明 | 参数 |
|
|
45
|
+
|--------|------|------|
|
|
46
|
+
| `weixin_send` | 发送文本消息 | `to`(用户 ID)、`text`、`context_token`(可选,关联会话) |
|
|
47
|
+
| `weixin_poll` | 拉取新消息(基于游标,不重复) | `reset_cursor`(可选布尔值) |
|
|
48
|
+
| `weixin_get_config` | 获取用户配置(typing ticket 等) | `user_id`、`context_token`(可选) |
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
## 已有 OpenClaw weixin 插件?
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
如果已通过 OpenClaw 完成微信登录,无需重新登录——`npx weixin-mcp` 会自动复用已有 token。
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|----------|---------|-------------|
|
|
56
|
-
| `OPENCLAW_STATE_DIR` | `~/.openclaw` | State directory; accounts are read from `$OPENCLAW_STATE_DIR/openclaw-weixin/accounts/` |
|
|
57
|
-
| `WEIXIN_ACCOUNT_ID` | first account found | Specify which account to use (filename without `.json`) |
|
|
54
|
+
## 环境变量
|
|
58
55
|
|
|
59
|
-
|
|
56
|
+
| 变量名 | 默认值 | 说明 |
|
|
57
|
+
|--------|--------|------|
|
|
58
|
+
| `OPENCLAW_STATE_DIR` | `~/.openclaw` | 状态目录,账号文件读取路径为 `$OPENCLAW_STATE_DIR/openclaw-weixin/accounts/` |
|
|
59
|
+
| `WEIXIN_ACCOUNT_ID` | 目录中第一个账号 | 指定使用哪个账号(对应文件名去掉 `.json`) |
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
## Token 过期重新登录
|
|
62
62
|
|
|
63
63
|
```bash
|
|
64
64
|
npx weixin-login
|