OZON MCP Server
中文 | English
中文文档
OZON MCP Server 是一个基于 Model Context Protocol (MCP) 的工具,通过 Playwright 实现 OZON 电商后台自动化操作,支持 QQ 邮箱验证码自动读取。
功能
- 自动登录 (
login-with-email-code) - 使用 QQ 邮箱验证码自动登录 OZON 卖家后台 - 价格监控 (
get-marketing-actions) - 获取营销活动商品价格数据,识别低于最低价格的商品
快速开始
1. 安装依赖
pip install -r requirements.txt
playwright install chromium
2. 配置环境变量
复制 .env.example 为 .env 并填写:
# OZON 账号配置
ozon_username="[email protected]"
ozon_login_url="https://sso.ozon.ru/auth/ozonid?localization_language_code=zh-Hans"
# QQ 邮箱授权码(16位)- 获取方式见下方
qq_imap_auth_code="your_16_digit_auth_code"
# Chrome Profile 路径(可选,默认使用 ./chrome-profile/)
chrome_profile_path="./chrome-profile/"
3. 获取 QQ 邮箱授权码
- 登录 mail.qq.com
- 设置 → 账户 → POP3/IMAP/SMTP/Exchange/CardDAV/CalDAV服务
- 开启 IMAP/SMTP 服务,获取 16 位授权码
4. 运行 MCP Server
python -m ozon_mcp.server
或在 Claude Code 中添加 mcp.json 配置。
使用方法
命令行参数
{
"command": "login-with-email-code",
"timeout": 120
}
{
"command": "get-marketing-actions",
"page": 1,
"page_size": 20,
"all_pages": false
}
项目结构
ozon-mcp/
├── src/ozon_mcp/ # 核心代码
│ ├── server.py # MCP Server 入口
│ ├── browser.py # Playwright 浏览器管理
│ ├── mail.py # QQ 邮箱 IMAP 操作
│ └── selectors.py # OZON 页面选择器
├── tests/ # 测试代码
├── requirements.txt # 依赖
├── pyproject.toml # 项目配置
└── mcp.json # MCP 配置示例
开发
# 运行测试
pytest tests/ -v
# 安装开发依赖
pip install -e ".[dev]"
注意事项
- 隐私保护 - 请勿提交
.env文件或chrome-profile/目录到 Git - 验证码 - 确保 QQ 邮箱能正常接收 OZON 的验证码邮件
- Chrome Profile - 首次登录后会保存登录状态,避免重复验证
English Docs
OZON MCP Server is a Model Context Protocol (MCP) based tool for automating OZON seller platform operations using Playwright, with QQ Mail OTP support.
Features
- Auto Login - Login to OZON using QQ Mail verification codes
- Price Monitoring - Check marketing action prices and identify underpriced items
Quick Start
pip install -r requirements.txt
playwright install chromium
Copy .env.example to .env and configure your credentials.
Get QQ Mail auth code from: mail.qq.com → Settings → Account → IMAP/SMTP service
License
MIT License - see LICENSE file