Skip to main content

OZON MCP Server - Browser automation for OZON seller platform

Project description

OZON MCP Server

Python 3.10+ License: MIT PyPI version

中文 | English


中文文档

OZON MCP Server 是一个基于 Model Context Protocol (MCP) 的工具,通过 Playwright 实现 OZON 电商后台自动化操作,支持 QQ 邮箱验证码自动读取。

功能

  • 自动登录 (login-with-email-code) - 使用 QQ 邮箱验证码自动登录 OZON 卖家后台
  • 价格监控 (get-marketing-actions) - 获取营销活动商品价格数据,识别低于最低价格的商品

安装

方式一:从 PyPI 安装(推荐)

# 安装 uv (如果没有)
curl -LsSf https://astral.sh/uv/install.sh | sh

# 全局安装 ozon-mcp
uv tool install ozon-mcp

# 安装浏览器
uv tool run ozon-mcp playwright install chromium

方式二:克隆源码开发

# 克隆项目
git clone https://github.com/oychao1988/ozon-mcp.git
cd ozon-mcp

# 安装 uv (如果没有)
curl -LsSf https://astral.sh/uv/install.sh | sh

# 安装依赖
uv sync
uv run playwright install chromium

配置环境变量

复制 .env.example.env 并填写:

cp .env.example .env

编辑 .env 文件:

# OZON 账号配置(只需要用户名)
ozon_username="your_qq@qq.com"

# QQ 邮箱授权码(16位)- 获取方式见下方
qq_imap_auth_code="your_16_digit_auth_code"

# Chrome Profile 配置(可选)
chrome_profile_source="copy_to_local"

获取 QQ 邮箱授权码

  1. 登录 mail.qq.com
  2. 设置 → 账户 → POP3/IMAP/SMTP/Exchange/CardDAV/CalDAV服务
  3. 开启 IMAP/SMTP 服务,获取 16 位授权码

在 Claude Code 中配置

方式一:使用已安装的 ozon-mcp 命令(推荐)

claude mcp add ozon --transport stdio -- ozon-mcp

方式二:使用 uvx 远程运行

claude mcp add ozon --transport stdio -- uvx ozon-mcp

在 Cursor 中配置

.mcp.json 或 Cursor MCP 设置中添加:

{
  "mcpServers": {
    "ozon": {
      "command": "ozon-mcp"
    }
  }
}

或使用 uvx:

{
  "mcpServers": {
    "ozon": {
      "command": "uvx",
      "args": ["ozon-mcp"]
    }
  }
}

使用方法

工具列表

1. login-with-email-code

自动登录 OZON 卖家后台(使用 QQ 邮箱接收验证码)。

{
  "command": "login-with-email-code"
}
2. get-marketing-actions

获取营销活动商品价格数据。

{
  "command": "get-marketing-actions",
  "arguments": {
    "page": 1,
    "page_size": 20,
    "all_pages": false
  }
}

参数说明:

参数 类型 默认值 说明
page number 1 页码(从 1 开始)
page_size number 20 每页产品数量
all_pages boolean false 是否获取所有页面数据

项目结构

ozon-mcp/
├── src/ozon_mcp/          # 核心代码
│   ├── server.py          # MCP Server 入口
│   ├── browser.py         # Playwright 浏览器管理
│   ├── mail.py            # QQ 邮箱 IMAP 操作
│   └── ozon_selectors.py  # OZON 页面选择器
├── tests/                 # 测试代码
├── .env.example           # 环境变量示例
├── pyproject.toml         # 项目配置
└── mcp.json              # MCP 配置示例

发布到 PyPI

# 构建包
uv build

# 发布到 PyPI(需要账号)
uv publish

# 或发布到 TestPyPI 测试
uv publish --repository testpypi

注意事项

  1. 隐私保护 - 请勿提交 .env 文件或 chrome-profile/ 目录到 Git
  2. 验证码 - 确保 QQ 邮箱能正常接收 OZON 的验证码邮件
  3. 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

Installation

# Install via uv
curl -LsSf https://astral.sh/uv/install.sh | sh
uv tool install ozon-mcp

# Install browser
uv tool run ozon-mcp playwright install chromium

Configuration

Copy .env.example to .env and configure:

ozon_username="your_qq@qq.com"
qq_imap_auth_code="your_16_digit_auth_code"

Get QQ Mail auth code from: mail.qq.com → Settings → Account → IMAP/SMTP service

Claude Code Configuration

claude mcp add ozon --transport stdio -- ozon-mcp

Cursor Configuration

Add to .mcp.json or Cursor MCP settings:

{
  "mcpServers": {
    "ozon": {
      "command": "ozon-mcp"
    }
  }
}

License

MIT License - see LICENSE file

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ozon_mcp-0.1.0.tar.gz (23.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ozon_mcp-0.1.0-py3-none-any.whl (18.2 kB view details)

Uploaded Python 3

File details

Details for the file ozon_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: ozon_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 23.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.14

File hashes

Hashes for ozon_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3425368b75b1463647aafa671b9b956bf1306bf12dce3a501059509b57d339f9
MD5 4f5ffdc9c7610f0056dccef82a37f5af
BLAKE2b-256 2f6c0075dd548bc76ff037f83528b260cb4d21cd5a925e915d138dd043126cd8

See more details on using hashes here.

File details

Details for the file ozon_mcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ozon_mcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.14

File hashes

Hashes for ozon_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e97470dfe287cbf845e1784adec89fd05e21142b259809ca1d9fa842a865f49e
MD5 fd7aca471d65fe66ba18baacbed76af7
BLAKE2b-256 ca9848fb73815572dea04fc9ff1228b14c7d252524e9baf2390dce407cdccc2f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page