Price Monitor MCP Server

Integrations

  • Manages environment variables for configuration settings like database credentials and Slack webhook URLs

  • Used for data validation and settings management in the price monitoring server

  • Provides a Python client interface to interact with the MCP server, allowing programmatic access to price monitoring workflows and tools

价格监控 MCP 服务器

大纲

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

  • 遵循MCP 标准的服务器/工具/提示结构
  • 自动化整个抓取、价格比较和通知过程
  • 支持Slack webhook集成

主要特点

  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 以供摘要/分析请求。

参考文献/文件


联系/贡献

  • 请将任何问题、错误或扩展请求保留为问题!
-
security - not tested
F
license - not found
-
quality - not tested

通过将数据库参考价格与实时 G-Market 价格进行比较来监控产品价格,并在价格下降时发送 Slack 通知。

  1. 개요
    1. 주요 기능
      1. 폴더 구조
        1. 실행 방법
          1. 1. 가상환경 준비 및 패키지 설치
          2. 2. 환경 변수 설정
          3. 3. MCP 서버 실행
        2. MCP 툴/프롬프트 목록
          1. 전체 프로세스 자동 실행 (추천)
            1. 워크플로우 툴 호출 예시
          2. 슬랙 알림 테스트
            1. LLM(Claude, GPT 등) 연동
              1. 참고/문서
                1. 문의/기여
                  ID: n3lbm0w19k