Skip to main content

电商定价 MCP Server — 基于成本计算建议售价、基于售价核算净利润率,纯计算无外部API

Project description

💰 mcp-ecom-pricing

电商定价 MCP Server — 基于成本计算建议售价、基于售价核算净利润率,一个 Server 全搞定。

基于扣子技能 e-commerce-pricing-calculator 重写为 MCP Server。

纯计算逻辑,无需外部 API、无需环境变量。


🛠 工具列表

工具 功能 典型场景
pricing 基于成本和目标利润率计算建议售价 "成本30元,目标利润15%,该卖多少?"
valuation 基于售价核算实际净利润率 "卖49元,净利润率多少?"

📦 安装

pip install mcp-ecom-pricing

或从源码安装:

git clone https://github.com/yourname/mcp-ecom-pricing.git
cd mcp-ecom-pricing
pip install -e .

⚙️ 配置

无需任何环境变量,纯计算逻辑。

🚀 使用

命令行

# STDIO 模式 (默认)
mcp-ecom-pricing

# 或
python -m mcp_ecom_pricing

MCP 客户端配置

在 Claude Desktop / Cherry Studio / ChatBox 等 MCP 客户端中添加:

{
  "mcpServers": {
    "ecom-pricing": {
      "command": "mcp-ecom-pricing"
    }
  }
}

开发测试

# 安装 FastMCP CLI
pip install "mcp[cli]"

# 交互式测试
mcp dev src/mcp_ecom_pricing/server.py

💡 工具详细说明

pricing — 定价计算

基于成本和目标利润率计算建议售价。

# 基本定价
pricing(
    cost=30.0,            # 商品成本 30元
    platform_fee=0.05,    # 平台扣点 5%
    shipping_insurance=1.0,  # 运费险 1元/单
    express_fee=3.0,      # 快递费 3元/单
    ad_ratio=0.10,        # 广告费占比 10%
    return_rate=0.05,     # 退货率 5%
    target_profit=0.15,   # 目标利润率 15%
)
# → suggested_price: 48.86元

参数

  • cost (必填): 商品成本(元),必须大于0
  • platform_fee (必填): 平台扣点率(小数,如0.05表示5%)
  • shipping_insurance (必填): 运费险(元/单)
  • express_fee (必填): 快递费(元/单)
  • ad_ratio (必填): 广告费占比(小数,如0.1表示10%)
  • return_rate (必填): 退货率(小数,如0.05表示5%)
  • target_profit (必填): 目标利润率(小数,如0.15表示15%)

返回:建议售价、各项成本明细(成本/运费险/快递费/退货损失/平台扣点/广告费/目标利润)、各项费率、利润分析

计算公式

退货时商品可二次销售,仅损失快递费+运费险:

有效成本 = 商品成本 + 运费险 + 快递费
退货每单额外损失 = (运费险 + 快递费) × 退货率
售价 = (有效成本 + 退货每单额外损失) / (1 - 平台扣点率 - 广告占比 - 目标利润率)

valuation — 利润核算

基于售价核算实际净利润率。

# 利润核算
valuation(
    cost=30.0,            # 商品成本 30元
    price=49.0,           # 售价 49元
    platform_fee=0.05,    # 平台扣点 5%
    shipping_insurance=1.0,  # 运费险 1元/单
    express_fee=3.0,      # 快递费 3元/单
    ad_ratio=0.10,        # 广告费占比 10%
    return_rate=0.05,     # 退货率 5%
)
# → 净利润: 7.45元, 净利润率: 15.20%, 盈利

参数

  • cost (必填): 商品成本(元),必须大于0
  • price (必填): 售价(元),必须大于0
  • platform_fee (必填): 平台扣点率(小数)
  • shipping_insurance (必填): 运费险(元/单)
  • express_fee (必填): 快递费(元/单)
  • ad_ratio (必填): 广告费占比(小数)
  • return_rate (必填): 退货率(小数)

返回:净利润金额、净利润率、各项成本明细、各项成本占比、盈亏判定

计算公式

平台扣点 = 售价 × 平台扣点率
广告费 = 售价 × 广告占比
退货损失 = (运费险 + 快递费) × 退货率
总成本 = 商品成本 + 运费险 + 快递费 + 平台扣点 + 广告费 + 退货损失
净利润 = 售价 - 总成本
净利润率 = 净利润 / 售价

📜 License

MIT

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

mcp_ecom_pricing-0.1.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

mcp_ecom_pricing-0.1.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mcp_ecom_pricing-0.1.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for mcp_ecom_pricing-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7e7cf05b680364a020a98c39d0f0113e4ba71fe7ff73a312cd56e1f7420bab53
MD5 3f1cebba7bb903af48ad979249ef2fcb
BLAKE2b-256 17b20383cbdd90c52a46934405595032b908cc1ee40ba3ed2d5e0711c40e5e5e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcp_ecom_pricing-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a31a56fd8077586c121d054a71b9c75b24e132b76c2c31fa619ab002d4953d23
MD5 b9e25bad140f06ed4cfc5d356ca55343
BLAKE2b-256 443d4218390b0e096edfabae34e138c678c21f42a827ab978cd3d311ea713ff5

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