Skip to main content
Glama
moongzee

Price Monitor MCP Server

by moongzee

价格监控 MCP 服务器

大纲

该项目是一个基于模型上下文协议(MCP)的价格监控服务器。通过产品代码比较DB标准价格和Gmarket实时价格,当价格下降时通过Slack发送通知。

  • 遵循MCP 标准的服务器/工具/提示结构

  • 自动化整个抓取、价格比较和通知过程

  • 支持Slack webhook集成


Related MCP server: Ecommerce Price Monitor MCP

主要特点

  1. DB标准价格搜索:使用产品代码搜索DB中的标准价格

  2. Gmarket 实时价格爬取:使用 Firecrawl API

  3. 比较价格并计算折扣率

  4. 价格下降时发送 Slack 通知

  5. 提供自动化整个工作流程的工具


文件夹结构

price_monitor_mcp/
├── src/
│   └── price_monitor_mcp.py   # MCP 서버 메인 코드
├── mcp_client.py              # MCP 클라이언트 코드
├── README.md                  
└── .env                       # 환경변수

如何运行

1.准备虚拟环境并安装包

conda activate price_monitor_mcp
pip install -r requirements.txt
# 또는 필요한 경우
pip install mcp firecrawl requests python-dotenv psycopg2-binary pydantic

2.设置环境变量

.env文件中设置环境变量,例如 Slack webhooks,如下所示。

SLACK_WEBHOOK_URL=https://hooks.slack.com/services/...
DB_HOST=...
DB_PORT=...
DB_NAME=...
DB_USER=...
DB_PASSWORD=...

3. 运行 MCP 服务器

mcp run src/price_monitor_mcp.py
  • 或者使用 devtools 运行它: mcp dev src/price_monitor_mcp.py

  • 或者使用 shell 脚本激活 conda 环境,然后运行


MCP 工具/提示列表

  • get_db_price(product_code) :DB标准价格查询

  • crawl_gmarket_price(product_code) :Gmarket实时价格爬取

  • send_slack_alert(message) :发送 Slack 通知

  • monitor_price_workflow(product_code) :自动运行整个流程(推荐)

  • monitor_price(product_code) :提示(针对法学硕士)


自动化整个过程(推荐)

调用工作流工具的示例

在 MCP 开发工具/客户端中:

  • 选择monitor_price_workflow工具,输入product_code ,然后运行它。

  • 结果:返回数据库价格、最低价、差价、折扣率、Slack通知等。

Python 客户端示例

import asyncio
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client

async def main():
    server_params = StdioServerParameters(
        command="python",
        args=["src/price_monitor_mcp.py"],
    )
    async with stdio_client(server_params) as (read, write):
        async with ClientSession(read, write) as session:
            await session.initialize()
            result = await session.call_tool("monitor_price_workflow", arguments={"product_code": "ULCK25151"})
            print("워크플로우 결과:", result)

if __name__ == "__main__":
    asyncio.run(main())

Slack 通知测试

  • 如果您的 Slack webhook 设置正确,当价格下降时您将自动收到通知。

  • 消息格式可以在send_slack_alert函数中自由修改。


LLM(Claude、GPT等)链接

  • 一旦 MCP 服务器连接得到官方支持,Claude、GPT 等将能够以自然语言运行提示/工具

  • 目前,通过 MCP 客户端代码接收结果并粘贴到 LLM 以供摘要/分析请求。


参考文献/文件


联系/贡献

  • 请将任何问题、错误或扩展请求保留为问题!

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables querying and comparing product prices across different marketplaces with real-time updates. Deployable on Cloudflare Workers with tools for searching products, comparing prices, and retrieving price history.
    -
  • A
    license
    Not graded
    quality
    C
    maintenance
    Real-time Shopee competitor price monitoring, powered by AI agents through the Model Context Protocol (MCP). Enables AI agents to track, analyze, and alert on price movements across Shopee Southeast Asia.
    1
    MIT