Skip to main content
Glama

PhoneLCDParts MCP Server

by cnguyen14

手机LCD配件 MCP 服务器

该项目为模型上下文协议 (MCP) 服务器提供了一个工具,用于从phonelcdparts.com抓取产品搜索结果。

目的

主要工具scrape_phonelcdparts允许兼容 MCP 的客户端(例如 LLM 代理)根据搜索词在phonelcdparts.com网站上查询产品。它会返回包含产品名称、价格、直达 URL 和图片 URL 的结构化 JSON 数据。

这使得各种应用程序能够自动检索产品信息,例如价格跟踪、数据分析或集成到更大的 AI 驱动的工作流程中。

Related MCP server: Vinted-scrapper

先决条件

  • Python 3.12 或更高版本。

  • uv (用于环境和包管理)。

  • 有效的 Firecrawl API 密钥(来自firecrawl.dev )。

设置

  1. 克隆存储库(如果适用)或导航到项目目录:

    cd path/to/phonelcdpart-mcp
  2. 使用

    uv venv source .venv/bin/activate
  3. **配置 Firecrawl API 密钥:**在phonelcdpart-mcp项目根目录下创建一个名为.env的文件(即phonelcdpart-mcp/.env )。将您的 Firecrawl API 密钥添加到此文件中:

    FIRECRAWL_API_KEY="YOUR_ACTUAL_FIRECRAWL_API_KEY_HERE"

    应用程序使用python-dotenv库在运行时加载此密钥。

  4. 使用

    uv pip install .

    这将安装pyproject.toml中列出的所有依赖项,包括python-dotenv

运行 MCP 服务器

您有几种运行服务器的选项:

  1. 直接使用Python(用于简单开发):

    python app.py
  2. **使用 Uvicorn(推荐用于开发,提供自动重新加载):**确保已安装uvicorn (位于pyproject.toml中)。

    uvicorn app:mcp --reload --host 0.0.0.0 --port 8000

    app:mcp指的是app.py文件中FastMCPmcp实例。)

  3. **使用已安装的脚本(如果uv pip install .成功):**成功uv pip install .后, pyproject.toml中定义的脚本应该可用:

    start-mcp

    这通常会使用mcp.run()方法。

服务器通常会从http://127.0.0.1:8000http://0.0.0.0:8000启动。

使用工具

一旦服务器运行,您就可以使用任何与 MCP 兼容的客户端与其进行交互。

  • 工具名称: scrape_phonelcdparts

  • **描述(来自文档字符串):**根据给定的搜索查询从phonelcdparts.com抓取产品信息(名称、价格、URL、图像 URL)。

  • 争论:

    • search_query (字符串):产品搜索词(例如“iphone 15 pro max lcd”)。

  • **返回:**字典列表,其中每个字典包含:

    • name (字符串)

    • price (字符串)

    • url (字符串)

    • image_url (字符串)

示例调用(概念性,使用 Python 客户端):

# (This is a conceptual example of how a client might call the tool) # import asyncio # from fastmcp import Client # # async def main(): # # Ensure the server_url matches where your MCP server is running # server_url = "http://127.0.0.1:8000/sse" # async with Client(server_url) as client: # try: # result = await client.call_tool( # "scrape_phonelcdparts", # {"search_query": "iphone 14 screen"} # ) # if result and result.data: # print("Tool Result:") # for item in result.data: # print(item) # else: # print("No data returned or tool call failed.") # except Exception as e: # print(f"Error calling tool: {e}") # # if __name__ == "__main__": # asyncio.run(main())

该客户端代码将连接到您正在运行的 MCP 服务器并使用指定的搜索查询调用scrape_phonelcdparts工具,然后打印结构化的 JSON 结果。

-
security - not tested
F
license - not found
-
quality - not tested

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cnguyen14/plp-mcpserver'

If you have feedback or need assistance with the MCP directory API, please join our Discord server