MCP服务器产品数据抓取工具

一个用于从Mercado Livre抓取产品数据(如价格和库存)并集成到MCP生态系统的工具,具有强大的数据验证功能以确保可靠性。

  • by newerton
  • TypeScript
  • 本地部署
  • 15 星标
  • 更新于
在 GitHub 查看 newerton/mcp-mercado-livre

使用说明

自由市场 - MCP Server

该项目是模型上下文协议(MCP)生态系统的一部分,提供了与外部源集成和管理特定领域模型的工具。它旨在演示如何构建一个从Mercado Livre抓取产品的MCP服务器,并通过强大的数据验证来确保可靠性。

An integration that enables MCP tools to scrape product data, such as prices and availability, directly from Mercado Livre.

目录

特性

  • 获取产品:获取基本产品信息。
  • 使用以下方式进行输入验证 萨德.
  • 使用与Mercado Livre API集成 fetch (基础设施层)。

建筑

该项目遵循分层架构,灵感来自 领域驱动设计 (DDD)模式:

  • 领域 (src/domain): 定义表示数据结构的接口和类型(例如。, Mercado Livre).

  • 基础设施 (src/infrastructure): 实现外部服务,例如 MercadoLivreApiService,负责对Mercado Livre API进行HTTP调用。

  • 应用 (src/application): 包含业务逻辑 MercadoLivreService,它处理和格式化来自基础设施的数据。

  • 接口 (src/interface): 包括控制器(MercadoLivreToolsController)在MCP服务器中注册工具,定义验证模式,并返回结果。

  • 入口点 (src/main.ts): 初始化 McpServer,配置传输(StdioServerTransport),实例化服务和控制器,并开始监听 标准输入输出.

文件夹结构如下:

src/
├── domain/
│   └── models/           # Domain interfaces
├── infrastructure/
│   └── services/         # External API implementations (Mercado Livre)
├── application/
│   └── services/         # Business logic and data formatting
├── interface/
│   └── controllers/      # MCP tool registration and validation
└── main.ts               # Server entry point
build/                    # Compiled JavaScript code
.vscode/                  # Contains the mcp.json file, MCP Server config

安装

git clone git@github.com:newerton/mcp-mercado-livre.git
cd mcp-mercado-livre
npm install
npm run build

VSCode中的MCP服务器配置

  1. 按 Ctrl+Shift+P 并选择“MCP:列出服务器”
  2. 选择“产品”,然后选择“启动服务器”

VSCode中的MCP服务器输出

  1. 按 Ctrl+Shift+P 并选择“MCP:列出服务器”
  2. 选择“产品”,然后选择“显示输出”

贡献

欢迎拉取请求!欢迎提出问题并讨论改进。

许可证

此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。