redfox-wechat-mcp 0.1.0__tar.gz
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.
- redfox_wechat_mcp-0.1.0/.gitignore +6 -0
- redfox_wechat_mcp-0.1.0/PKG-INFO +120 -0
- redfox_wechat_mcp-0.1.0/README.md +108 -0
- redfox_wechat_mcp-0.1.0/pyproject.toml +31 -0
- redfox_wechat_mcp-0.1.0/src/redfox_wechat_mcp/__init__.py +3 -0
- redfox_wechat_mcp-0.1.0/src/redfox_wechat_mcp/__main__.py +6 -0
- redfox_wechat_mcp-0.1.0/src/redfox_wechat_mcp/server.py +86 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: redfox-wechat-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: RedFoxHub WeChat MCP server: official account article/account search, account info, article list and detail, AI articles search
|
|
5
|
+
Project-URL: Homepage, https://github.com/redfox-data/redfox-mcp
|
|
6
|
+
Project-URL: Website, https://redfox.hk/apis/?source=mcp
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Keywords: gzh,mcp,redfox,wechat
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
|
+
Requires-Dist: redfox-mcp-core>=0.1.0
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
|
|
13
|
+
# redfox-wechat-mcp
|
|
14
|
+
|
|
15
|
+
RedFoxHub 公众号数据 MCP Server — 将公众号数据 API 封装为 7 个 MCP 工具,适用于 dsh、Claude Code、Cursor 等任意 MCP 客户端。
|
|
16
|
+
|
|
17
|
+
## 工具(7)
|
|
18
|
+
|
|
19
|
+
| 工具 | 说明 |
|
|
20
|
+
|---|---|
|
|
21
|
+
| `wechat_search_articles` | 搜索公众号文章(优质库) |
|
|
22
|
+
| `wechat_search_users` | 搜索公众号账号(优质库) |
|
|
23
|
+
| `wechat_get_account` | 获取公众号账号信息 |
|
|
24
|
+
| `wechat_get_user_works` | 获取公众号文章列表 |
|
|
25
|
+
| `wechat_get_work` | 根据作品 UUID 获取文章元数据 |
|
|
26
|
+
| `wechat_get_article_detail` | 根据文章链接获取全文详情 |
|
|
27
|
+
| `wechat_search_ai_articles` | 搜索公众号 AI 创作相关文章 |
|
|
28
|
+
|
|
29
|
+
## 认证
|
|
30
|
+
|
|
31
|
+
1. 前往 <https://redfox.hk/settings/api-keys?source=mcp> 获取 API Key
|
|
32
|
+
2. 设置环境变量:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
export REDFOX_API_KEY="YOUR_API_KEY"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
未配置 key 时,每个工具都会返回结构化的获取引导。
|
|
39
|
+
|
|
40
|
+
## 安装与运行(本地 stdio)
|
|
41
|
+
|
|
42
|
+
需要 Python ≥ 3.10,推荐使用 [uv](https://docs.astral.sh/uv/):
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
uvx redfox-wechat-mcp
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
或:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install redfox-wechat-mcp
|
|
52
|
+
redfox-wechat-mcp
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## 客户端配置
|
|
56
|
+
|
|
57
|
+
Claude Code:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
claude mcp add redfox-wechat --env REDFOX_API_KEY=YOUR_API_KEY -- uvx redfox-wechat-mcp
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Cursor / 其他 MCP 客户端:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"mcpServers": {
|
|
68
|
+
"redfox-wechat": {
|
|
69
|
+
"command": "uvx",
|
|
70
|
+
"args": ["redfox-wechat-mcp"],
|
|
71
|
+
"env": { "REDFOX_API_KEY": "YOUR_API_KEY" }
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## 远程 HTTP 模式(多租户)
|
|
78
|
+
|
|
79
|
+
适用于 MCP 市场与托管场景,每个用户携带自己的 API Key:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
redfox-wechat-mcp --transport http --host 0.0.0.0 --port 8000
|
|
83
|
+
# 或环境变量:REDFOX_MCP_TRANSPORT=http REDFOX_MCP_HOST=0.0.0.0 REDFOX_MCP_PORT=8000
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
- MCP 端点:`http://<host>:8000/mcp`(Streamable HTTP);健康检查:`GET /health`
|
|
87
|
+
- 每个请求通过请求头 `X-API-Key: <key>`(或 `Authorization: Bearer <key>`)携带自己的 key,按 key 建独立客户端缓存,额度互不共享
|
|
88
|
+
|
|
89
|
+
客户端配置(远程 URL + 请求头):
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"mcpServers": {
|
|
94
|
+
"redfox-wechat": {
|
|
95
|
+
"url": "http://<host>:8000/mcp",
|
|
96
|
+
"headers": { "X-API-Key": "ak_your_key" }
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Docker 部署
|
|
103
|
+
|
|
104
|
+
本包目录自带 Dockerfile,可独立构建部署:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
cd packages/redfox-wechat-mcp
|
|
108
|
+
docker build -t redfox-wechat-mcp .
|
|
109
|
+
docker run -d -p 8000:8000 redfox-wechat-mcp
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
镜像不内置任何 API Key,调用方通过请求头携带自己的 key。
|
|
113
|
+
|
|
114
|
+
## 底层实现
|
|
115
|
+
|
|
116
|
+
基于官方 SDK [redfox-python-sdk](https://github.com/redfox-data/redfox-python-sdk)。API 文档:<https://redfox.hk/?source=mcp>。
|
|
117
|
+
|
|
118
|
+
## License
|
|
119
|
+
|
|
120
|
+
MIT
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# redfox-wechat-mcp
|
|
2
|
+
|
|
3
|
+
RedFoxHub 公众号数据 MCP Server — 将公众号数据 API 封装为 7 个 MCP 工具,适用于 dsh、Claude Code、Cursor 等任意 MCP 客户端。
|
|
4
|
+
|
|
5
|
+
## 工具(7)
|
|
6
|
+
|
|
7
|
+
| 工具 | 说明 |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `wechat_search_articles` | 搜索公众号文章(优质库) |
|
|
10
|
+
| `wechat_search_users` | 搜索公众号账号(优质库) |
|
|
11
|
+
| `wechat_get_account` | 获取公众号账号信息 |
|
|
12
|
+
| `wechat_get_user_works` | 获取公众号文章列表 |
|
|
13
|
+
| `wechat_get_work` | 根据作品 UUID 获取文章元数据 |
|
|
14
|
+
| `wechat_get_article_detail` | 根据文章链接获取全文详情 |
|
|
15
|
+
| `wechat_search_ai_articles` | 搜索公众号 AI 创作相关文章 |
|
|
16
|
+
|
|
17
|
+
## 认证
|
|
18
|
+
|
|
19
|
+
1. 前往 <https://redfox.hk/settings/api-keys?source=mcp> 获取 API Key
|
|
20
|
+
2. 设置环境变量:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
export REDFOX_API_KEY="YOUR_API_KEY"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
未配置 key 时,每个工具都会返回结构化的获取引导。
|
|
27
|
+
|
|
28
|
+
## 安装与运行(本地 stdio)
|
|
29
|
+
|
|
30
|
+
需要 Python ≥ 3.10,推荐使用 [uv](https://docs.astral.sh/uv/):
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
uvx redfox-wechat-mcp
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
或:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install redfox-wechat-mcp
|
|
40
|
+
redfox-wechat-mcp
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## 客户端配置
|
|
44
|
+
|
|
45
|
+
Claude Code:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
claude mcp add redfox-wechat --env REDFOX_API_KEY=YOUR_API_KEY -- uvx redfox-wechat-mcp
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Cursor / 其他 MCP 客户端:
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"mcpServers": {
|
|
56
|
+
"redfox-wechat": {
|
|
57
|
+
"command": "uvx",
|
|
58
|
+
"args": ["redfox-wechat-mcp"],
|
|
59
|
+
"env": { "REDFOX_API_KEY": "YOUR_API_KEY" }
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## 远程 HTTP 模式(多租户)
|
|
66
|
+
|
|
67
|
+
适用于 MCP 市场与托管场景,每个用户携带自己的 API Key:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
redfox-wechat-mcp --transport http --host 0.0.0.0 --port 8000
|
|
71
|
+
# 或环境变量:REDFOX_MCP_TRANSPORT=http REDFOX_MCP_HOST=0.0.0.0 REDFOX_MCP_PORT=8000
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
- MCP 端点:`http://<host>:8000/mcp`(Streamable HTTP);健康检查:`GET /health`
|
|
75
|
+
- 每个请求通过请求头 `X-API-Key: <key>`(或 `Authorization: Bearer <key>`)携带自己的 key,按 key 建独立客户端缓存,额度互不共享
|
|
76
|
+
|
|
77
|
+
客户端配置(远程 URL + 请求头):
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{
|
|
81
|
+
"mcpServers": {
|
|
82
|
+
"redfox-wechat": {
|
|
83
|
+
"url": "http://<host>:8000/mcp",
|
|
84
|
+
"headers": { "X-API-Key": "ak_your_key" }
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Docker 部署
|
|
91
|
+
|
|
92
|
+
本包目录自带 Dockerfile,可独立构建部署:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
cd packages/redfox-wechat-mcp
|
|
96
|
+
docker build -t redfox-wechat-mcp .
|
|
97
|
+
docker run -d -p 8000:8000 redfox-wechat-mcp
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
镜像不内置任何 API Key,调用方通过请求头携带自己的 key。
|
|
101
|
+
|
|
102
|
+
## 底层实现
|
|
103
|
+
|
|
104
|
+
基于官方 SDK [redfox-python-sdk](https://github.com/redfox-data/redfox-python-sdk)。API 文档:<https://redfox.hk/?source=mcp>。
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
MIT
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "redfox-wechat-mcp"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "RedFoxHub WeChat MCP server: official account article/account search, account info, article list and detail, AI articles search"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
keywords = ["mcp", "redfox", "wechat", "gzh"]
|
|
13
|
+
dependencies = [
|
|
14
|
+
"redfox-mcp-core>=0.1.0",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
[project.urls]
|
|
18
|
+
Homepage = "https://github.com/redfox-data/redfox-mcp"
|
|
19
|
+
Website = "https://redfox.hk/apis/?source=mcp"
|
|
20
|
+
|
|
21
|
+
[project.scripts]
|
|
22
|
+
redfox-wechat-mcp = "redfox_wechat_mcp.server:main"
|
|
23
|
+
|
|
24
|
+
[tool.uv.sources]
|
|
25
|
+
redfox-mcp-core = { workspace = true }
|
|
26
|
+
|
|
27
|
+
[tool.hatch.build.targets.wheel]
|
|
28
|
+
packages = ["src/redfox_wechat_mcp"]
|
|
29
|
+
|
|
30
|
+
[tool.hatch.build.targets.sdist]
|
|
31
|
+
include = ["src/redfox_wechat_mcp", "README.md"]
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"""RedFox 公众号数据 MCP Server
|
|
2
|
+
|
|
3
|
+
将 RedFoxHub(红狐数据平台)的公众号数据 API 暴露为 MCP 工具。
|
|
4
|
+
|
|
5
|
+
认证:stdio 模式读环境变量 REDFOX_API_KEY;HTTP 模式从请求头
|
|
6
|
+
X-API-Key(或 Authorization: Bearer <key>)取 key。
|
|
7
|
+
获取地址 https://redfox.hk/settings/api-keys?source=mcp
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from typing import Any, Dict, Optional
|
|
11
|
+
|
|
12
|
+
from redfox_mcp_core import call, create_server, get_client, serve
|
|
13
|
+
|
|
14
|
+
from redfox_wechat_mcp import __version__
|
|
15
|
+
|
|
16
|
+
mcp = create_server("redfox-wechat", __version__)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@mcp.tool()
|
|
20
|
+
def wechat_search_articles(keyword: str, offset: int = 0,
|
|
21
|
+
sort_type: Optional[str] = None) -> Dict[str, Any]:
|
|
22
|
+
"""搜索公众号文章(优质库)。keyword 必填;offset 从 0 开始、每页 +20。"""
|
|
23
|
+
return call(lambda: get_client().wechat.search_articles,
|
|
24
|
+
keyword=keyword, offset=offset, sort_type=sort_type)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@mcp.tool()
|
|
28
|
+
def wechat_search_users(keyword: str, offset: int = 0,
|
|
29
|
+
sort_type: Optional[str] = None) -> Dict[str, Any]:
|
|
30
|
+
"""搜索公众号账号(优质库)。keyword 必填;sort_type:_0=默认,_2=最新,_4=最热。"""
|
|
31
|
+
return call(lambda: get_client().wechat.search_users,
|
|
32
|
+
keyword=keyword, offset=offset, sort_type=sort_type)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@mcp.tool()
|
|
36
|
+
def wechat_get_account(account: str,
|
|
37
|
+
account_name: Optional[str] = None) -> Dict[str, Any]:
|
|
38
|
+
"""获取公众号账号信息(优质库)。account 为公众号微信号(必填),
|
|
39
|
+
account_name 为公众号名称(可选)。"""
|
|
40
|
+
return call(lambda: get_client().wechat.get_account,
|
|
41
|
+
account=account, account_name=account_name)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@mcp.tool()
|
|
45
|
+
def wechat_get_user_works(account: str, account_name: Optional[str] = None,
|
|
46
|
+
offset: int = 0, sort_type: Optional[str] = None,
|
|
47
|
+
publish_time_start: Optional[str] = None,
|
|
48
|
+
publish_time_end: Optional[str] = None) -> Dict[str, Any]:
|
|
49
|
+
"""获取公众号文章列表(优质库)。account 为公众号微信号(必填);
|
|
50
|
+
sort_type:_0=默认,_2=最新,_4=最热;publish_time_start/end 格式如 "2026-07-01"。"""
|
|
51
|
+
return call(lambda: get_client().wechat.get_user_works,
|
|
52
|
+
account=account, account_name=account_name, offset=offset,
|
|
53
|
+
sort_type=sort_type, publish_time_start=publish_time_start,
|
|
54
|
+
publish_time_end=publish_time_end)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@mcp.tool()
|
|
58
|
+
def wechat_get_work(work_uuid: str) -> Dict[str, Any]:
|
|
59
|
+
"""根据作品 UUID 获取公众号文章元数据(优质库)。"""
|
|
60
|
+
return call(lambda: get_client().wechat.get_work, work_uuid=work_uuid)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@mcp.tool()
|
|
64
|
+
def wechat_get_article_detail(url: str) -> Dict[str, Any]:
|
|
65
|
+
"""根据文章链接获取公众号文章详情,支持全文内容(优质库)。
|
|
66
|
+
url 形如 https://mp.weixin.qq.com/s/..."""
|
|
67
|
+
return call(lambda: get_client().wechat.get_article_detail, url=url)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@mcp.tool()
|
|
71
|
+
def wechat_search_ai_articles(keyword: str, page_num: int = 1, page_size: int = 20,
|
|
72
|
+
start_time: Optional[str] = None,
|
|
73
|
+
end_time: Optional[str] = None) -> Dict[str, Any]:
|
|
74
|
+
"""搜索公众号 AI 创作相关文章(优质库)。keyword 必填;
|
|
75
|
+
start_time/end_time 格式如 "2026-06-01 00:00:00"。"""
|
|
76
|
+
return call(lambda: get_client().wechat.search_ai_articles,
|
|
77
|
+
keyword=keyword, page_num=page_num, page_size=page_size,
|
|
78
|
+
start_time=start_time, end_time=end_time)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def main() -> None:
|
|
82
|
+
serve(mcp, prog="redfox-wechat-mcp", description="RedFox 公众号数据 MCP server")
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
if __name__ == "__main__":
|
|
86
|
+
main()
|