dudutt 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.
- dudutt-0.1.0/LICENSE +21 -0
- dudutt-0.1.0/PKG-INFO +135 -0
- dudutt-0.1.0/README.md +82 -0
- dudutt-0.1.0/dudutt/__init__.py +8 -0
- dudutt-0.1.0/dudutt/__main__.py +8 -0
- dudutt-0.1.0/dudutt/actions.py +478 -0
- dudutt-0.1.0/dudutt/api_map.py +296 -0
- dudutt-0.1.0/dudutt/audit.py +126 -0
- dudutt-0.1.0/dudutt/backends/__init__.py +116 -0
- dudutt-0.1.0/dudutt/backends/api_backend.py +327 -0
- dudutt-0.1.0/dudutt/backends/base.py +218 -0
- dudutt-0.1.0/dudutt/backends/browser_backend.py +259 -0
- dudutt-0.1.0/dudutt/backends/mock_backend.py +308 -0
- dudutt-0.1.0/dudutt/compat.py +39 -0
- dudutt-0.1.0/dudutt/login.py +83 -0
- dudutt-0.1.0/dudutt/pop_client.py +281 -0
- dudutt-0.1.0/dudutt/py.typed +3 -0
- dudutt-0.1.0/dudutt/server.py +425 -0
- dudutt-0.1.0/dudutt.egg-info/PKG-INFO +135 -0
- dudutt-0.1.0/dudutt.egg-info/SOURCES.txt +28 -0
- dudutt-0.1.0/dudutt.egg-info/dependency_links.txt +1 -0
- dudutt-0.1.0/dudutt.egg-info/entry_points.txt +2 -0
- dudutt-0.1.0/dudutt.egg-info/requires.txt +9 -0
- dudutt-0.1.0/dudutt.egg-info/top_level.txt +1 -0
- dudutt-0.1.0/pyproject.toml +57 -0
- dudutt-0.1.0/setup.cfg +4 -0
- dudutt-0.1.0/tests/test_actions.py +381 -0
- dudutt-0.1.0/tests/test_e2e_mcp.py +245 -0
- dudutt-0.1.0/tests/test_pop_client.py +254 -0
- dudutt-0.1.0/tests/test_skill_structure.py +103 -0
dudutt-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Shine8592
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
dudutt-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dudutt
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: 快团团 MCP server for AI agents: 商品发布/下架/改价/改库存,官方 POP API 为主、浏览器自动化兜底,双后端可插拔。
|
|
5
|
+
Author: Shine8592
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Shine8592
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/Shine8592/dudutt
|
|
29
|
+
Project-URL: Repository, https://github.com/Shine8592/dudutt
|
|
30
|
+
Project-URL: Issues, https://github.com/Shine8592/dudutt/issues
|
|
31
|
+
Project-URL: Changelog, https://github.com/Shine8592/dudutt/blob/main/CHANGELOG.md
|
|
32
|
+
Keywords: kuaituantuan,ktt,快团团,pinduoduo,pdd,mcp,model-context-protocol,ai-agent,llm,ecommerce,social-commerce,automation,chinese
|
|
33
|
+
Classifier: Development Status :: 3 - Alpha
|
|
34
|
+
Classifier: Intended Audience :: Developers
|
|
35
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
36
|
+
Classifier: Programming Language :: Python :: 3
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
40
|
+
Classifier: Topic :: Office/Business :: Financial :: Point-Of-Sale
|
|
41
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
42
|
+
Requires-Python: >=3.10
|
|
43
|
+
Description-Content-Type: text/markdown
|
|
44
|
+
License-File: LICENSE
|
|
45
|
+
Requires-Dist: requests>=2.28.0
|
|
46
|
+
Requires-Dist: mcp>=2.0.0
|
|
47
|
+
Provides-Extra: browser
|
|
48
|
+
Requires-Dist: playwright>=1.40.0; extra == "browser"
|
|
49
|
+
Provides-Extra: dev
|
|
50
|
+
Requires-Dist: build>=1.0.0; extra == "dev"
|
|
51
|
+
Requires-Dist: twine>=5.0.0; extra == "dev"
|
|
52
|
+
Dynamic: license-file
|
|
53
|
+
|
|
54
|
+
# dudutt
|
|
55
|
+
|
|
56
|
+
快团团(拼多多旗下社群团购)网店管理 MCP 服务 —— 让 AI Agent 直接发布商品、下架商品、改价改库存。
|
|
57
|
+
|
|
58
|
+
> **架构定位**:官方 POP API 为主,浏览器自动化兜底,双后端可插拔。
|
|
59
|
+
> 当官方接口不支持某动作(如「下架」「改价」)时,自动降级到浏览器后端或给出明确的能力提示,**绝不假装成功**。
|
|
60
|
+
|
|
61
|
+
## 为什么需要它
|
|
62
|
+
|
|
63
|
+
| 现状 | 说明 |
|
|
64
|
+
|---|---|
|
|
65
|
+
| 快团团 API 藏在拼多多开放平台 | 接口散落在 `open.pinduoduo.com`,无统一 SDK |
|
|
66
|
+
| 官方无「下架 / 改价」接口 | 只能靠库存归零 / 重建团变通,或走浏览器后台 |
|
|
67
|
+
| 出错代价高 | 商品误下架、价格误改直接影响真实经营 |
|
|
68
|
+
|
|
69
|
+
`dudutt` 把上述复杂度收敛成 MCP 工具,并内置**能力协商**与**写操作护栏**。
|
|
70
|
+
|
|
71
|
+
## 快速开始
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
pip install dudutt # 仅官方 API 后端
|
|
75
|
+
pip install "dudutt[browser]" # 额外支持浏览器兜底
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 配置凭据
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# 官方 API 后端(推荐,需企业资质)
|
|
82
|
+
export DUDUTT_CLIENT_ID="your_client_id"
|
|
83
|
+
export DUDUTT_CLIENT_SECRET="your_client_secret"
|
|
84
|
+
export DUDUTT_ACCESS_TOKEN="your_access_token"
|
|
85
|
+
|
|
86
|
+
# 或使用 mock 后端跑通流程(无需凭据)
|
|
87
|
+
export DUDUTT_BACKEND="mock"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 挂载到 MCP 客户端
|
|
91
|
+
|
|
92
|
+
```jsonc
|
|
93
|
+
{
|
|
94
|
+
"mcp": {
|
|
95
|
+
"dudutt": {
|
|
96
|
+
"type": "local",
|
|
97
|
+
"command": ["python", "-u", "-m", "dudutt"],
|
|
98
|
+
"environment": {
|
|
99
|
+
"DUDUTT_CLIENT_ID": "{env:DUDUTT_CLIENT_ID}",
|
|
100
|
+
"DUDUTT_CLIENT_SECRET": "{env:DUDUTT_CLIENT_SECRET}",
|
|
101
|
+
"DUDUTT_ACCESS_TOKEN": "{env:DUDUTT_ACCESS_TOKEN}"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## 工具一览
|
|
109
|
+
|
|
110
|
+
| 工具 | 动作 | 官方 API | 浏览器兜底 |
|
|
111
|
+
|---|---|---|---|
|
|
112
|
+
| `capabilities` | 查询当前后端支持哪些动作 | — | — |
|
|
113
|
+
| `list_groups` | 团列表 | ✅ | ✅ |
|
|
114
|
+
| `list_goods` / `get_goods` | 商品列表 / 单品 | ✅ | ✅ |
|
|
115
|
+
| `publish_goods` | **发布商品**(创建团购) | ✅ | ✅ |
|
|
116
|
+
| `set_stock` | **改库存** | ✅ | ✅ |
|
|
117
|
+
| `delist_goods` | **下架商品** | ❌ 库存归零变通 | ✅ |
|
|
118
|
+
| `update_price` | **改价** | ❌ 需重建团 | ✅ |
|
|
119
|
+
| `audit_log` | 查看写操作审计 | — | — |
|
|
120
|
+
|
|
121
|
+
## 安全设计
|
|
122
|
+
|
|
123
|
+
- **能力协商**:先查 `capabilities`,后端不支持时明确报错,不给幻觉结果
|
|
124
|
+
- **dry-run 预演**:写操作默认返回"将要发生什么",确认后才真正执行
|
|
125
|
+
- **审计日志**:每次写操作落盘 JSONL,可追溯
|
|
126
|
+
- **幂等键**:同一 `idempotency_key` 重复调用不会重复下单
|
|
127
|
+
|
|
128
|
+
## 文档
|
|
129
|
+
|
|
130
|
+
- [docs/SETUP.md](docs/SETUP.md) —— 企业资质申请与授权全流程
|
|
131
|
+
- [docs/API-MAP.md](docs/API-MAP.md) —— 动作 ↔ 官方接口映射与能力边界
|
|
132
|
+
|
|
133
|
+
## License
|
|
134
|
+
|
|
135
|
+
MIT
|
dudutt-0.1.0/README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# dudutt
|
|
2
|
+
|
|
3
|
+
快团团(拼多多旗下社群团购)网店管理 MCP 服务 —— 让 AI Agent 直接发布商品、下架商品、改价改库存。
|
|
4
|
+
|
|
5
|
+
> **架构定位**:官方 POP API 为主,浏览器自动化兜底,双后端可插拔。
|
|
6
|
+
> 当官方接口不支持某动作(如「下架」「改价」)时,自动降级到浏览器后端或给出明确的能力提示,**绝不假装成功**。
|
|
7
|
+
|
|
8
|
+
## 为什么需要它
|
|
9
|
+
|
|
10
|
+
| 现状 | 说明 |
|
|
11
|
+
|---|---|
|
|
12
|
+
| 快团团 API 藏在拼多多开放平台 | 接口散落在 `open.pinduoduo.com`,无统一 SDK |
|
|
13
|
+
| 官方无「下架 / 改价」接口 | 只能靠库存归零 / 重建团变通,或走浏览器后台 |
|
|
14
|
+
| 出错代价高 | 商品误下架、价格误改直接影响真实经营 |
|
|
15
|
+
|
|
16
|
+
`dudutt` 把上述复杂度收敛成 MCP 工具,并内置**能力协商**与**写操作护栏**。
|
|
17
|
+
|
|
18
|
+
## 快速开始
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install dudutt # 仅官方 API 后端
|
|
22
|
+
pip install "dudutt[browser]" # 额外支持浏览器兜底
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 配置凭据
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# 官方 API 后端(推荐,需企业资质)
|
|
29
|
+
export DUDUTT_CLIENT_ID="your_client_id"
|
|
30
|
+
export DUDUTT_CLIENT_SECRET="your_client_secret"
|
|
31
|
+
export DUDUTT_ACCESS_TOKEN="your_access_token"
|
|
32
|
+
|
|
33
|
+
# 或使用 mock 后端跑通流程(无需凭据)
|
|
34
|
+
export DUDUTT_BACKEND="mock"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 挂载到 MCP 客户端
|
|
38
|
+
|
|
39
|
+
```jsonc
|
|
40
|
+
{
|
|
41
|
+
"mcp": {
|
|
42
|
+
"dudutt": {
|
|
43
|
+
"type": "local",
|
|
44
|
+
"command": ["python", "-u", "-m", "dudutt"],
|
|
45
|
+
"environment": {
|
|
46
|
+
"DUDUTT_CLIENT_ID": "{env:DUDUTT_CLIENT_ID}",
|
|
47
|
+
"DUDUTT_CLIENT_SECRET": "{env:DUDUTT_CLIENT_SECRET}",
|
|
48
|
+
"DUDUTT_ACCESS_TOKEN": "{env:DUDUTT_ACCESS_TOKEN}"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## 工具一览
|
|
56
|
+
|
|
57
|
+
| 工具 | 动作 | 官方 API | 浏览器兜底 |
|
|
58
|
+
|---|---|---|---|
|
|
59
|
+
| `capabilities` | 查询当前后端支持哪些动作 | — | — |
|
|
60
|
+
| `list_groups` | 团列表 | ✅ | ✅ |
|
|
61
|
+
| `list_goods` / `get_goods` | 商品列表 / 单品 | ✅ | ✅ |
|
|
62
|
+
| `publish_goods` | **发布商品**(创建团购) | ✅ | ✅ |
|
|
63
|
+
| `set_stock` | **改库存** | ✅ | ✅ |
|
|
64
|
+
| `delist_goods` | **下架商品** | ❌ 库存归零变通 | ✅ |
|
|
65
|
+
| `update_price` | **改价** | ❌ 需重建团 | ✅ |
|
|
66
|
+
| `audit_log` | 查看写操作审计 | — | — |
|
|
67
|
+
|
|
68
|
+
## 安全设计
|
|
69
|
+
|
|
70
|
+
- **能力协商**:先查 `capabilities`,后端不支持时明确报错,不给幻觉结果
|
|
71
|
+
- **dry-run 预演**:写操作默认返回"将要发生什么",确认后才真正执行
|
|
72
|
+
- **审计日志**:每次写操作落盘 JSONL,可追溯
|
|
73
|
+
- **幂等键**:同一 `idempotency_key` 重复调用不会重复下单
|
|
74
|
+
|
|
75
|
+
## 文档
|
|
76
|
+
|
|
77
|
+
- [docs/SETUP.md](docs/SETUP.md) —— 企业资质申请与授权全流程
|
|
78
|
+
- [docs/API-MAP.md](docs/API-MAP.md) —— 动作 ↔ 官方接口映射与能力边界
|
|
79
|
+
|
|
80
|
+
## License
|
|
81
|
+
|
|
82
|
+
MIT
|