Web数据提取工具

Anthropic的MCP服务为大型语言模型提供标准化的外部工具连接协议,支持实时Web数据提取和交互。

  • by bright-jp
  • 本地部署
  • 更新于
在 GitHub 查看 bright-jp/web-scraping-with-mcp

使用说明

Anthropic的,之MCP根据Web刻划

本指南提供按需数据提取MCP设置服务器,连接开发工具Bright Data活用,活用AI兼容Web说明如何立即获取信息。

理解局限性:为什么法学硕士在现实世界的互动中需要帮助

Large Language Models(LLM)擅长从广泛的学习数据集中处理和生成文本。但是,它有一个严重的限制。那就是不能与外部世界自然互动。也就是说,访问本地文件,执行自定义脚本Web标准中不具备从网站获取最新信息的功能。

作为基本的例子Claude运行中Amazon即使委托从商品页面提取详细信息,没有追加工具也是不可能的。为什么呢。这是因为没有浏览互联网或触发外部动作的固有能力。

如果没有辅助工具LLM无法执行依赖于实时数据和与外部系统集成的实际任务。

在那里发挥价值Anthropicの模型上下文协议(MCP)是。MCP是数据提取工具API、脚本等外部工具LLM中描述的场景,使用以下步骤创建明细表,以便在概念设计中分析体量的体积。

实际差异如下:。定制MCP整合服务器后Claude直接从结构化Amazon我们成功地提取了商品信息。

MCP的重要性

  • 标准化: MCP单击功能区上LLM为基础系统连接到外部工具或数据提供统一接口。Web整合API中所述修改相应参数的值。这大大减少了定制集成的需要,加快了开发速度。
  • 灵活性和可扩展性: 开发人员LLM替换或托管平台不需要重写工具集成。MCP啊stdio等多种通信方式,可适应各种配置。
  • LLM增强功能: MCP的LLM中描述的场景,使用以下步骤创建明细表,以便在概念设计中分析体量的体积。根据上下文提供最新、最相关的信息,可以触发现实世界中的行动。

比喻:

MCP啊LLM为了USB请认为是接口。USB与使不同设备(键盘、打印机、外置驱动器等)能够在没有特别驱动程序的情况下与兼容机器连接一样MCP使用标准化的协议LLM将条目添加到文档注册表。不需要每次都进行自定义集成。

理解模型上下文协议

Model Context Protocol(MCP)单击功能区上Anthropic开发的开放标准,大规模语言模型(LLM)是外部工具API、使数据源以一致、安全的方式相互作用。作为通用连接器发挥功能Web提取站点数据、查询数据库、执行脚本等现实世界的任务LLM进行动态观察时的轴心点。

Anthropic导入了MCP是开放和可扩展的,任何人都可以实施和贡献标准。检索增强生成(RAG)如果是处理过的人,应该很容易理解这个概念。MCP使之发展那个想法,轻量的JSON-RPC通过接口标准化交互,允许模型访问实时数据并执行操作。

MCP架构说明

MCP的基础是AI在于标准化模型和外部功能之间的通信。

核心创意: 标准化接口(通常为stdio在动态输入提示中单击JSON-RPC 2.0)在您查看完详细信息后,单击LLM(通过客户端)可以发现并调用外部服务器发布的工具。

MCP在客户端/服务器体系结构中运行,主要组件有三个。

  1. MCP主机: LLM中描述的场景,使用下列步骤创建明细表,以便在概念设计中分析体量的周长。例如,_Claude Desktop_像…一样AI助手,_Cursor_像…一样IDE的下界。
  2. MCP客户端: host在工作空间的边缘MCP Server建立和维护到的连接,处理通信协议管理数据交换。
  3. MCP服务器: (由作为开发者的我们制作)MCP一种实现协议并发布特定功能集的程序。MCP server是数据库Web服务或在此情况下Web可以与网站(亚马逊)合作。server以标准化形式发布功能:
    • 工具: 可调用函数(例如: scrape_amazon_product, 获取天气数据)
    • 资源: 用于获取静态数据的只读端点(例如,文件捕获、JSON返回记录)
    • 提示: LLM的tools啊resources的向导的预定义模板

MCP体系结构图在这里。

图像来源: 模型上下文协议

在该结构中主机(Claude Desktop或Cursor IDE)的MCP客户端启动外部的MCP服务器中所述修改相应参数的值。server啊tools、resources、prompts公开AI将条目添加到文档注册表。

总之,工作流可以:。

  • 用户 “在Amazon获取链接的商品信息。」 来定义自定义外观
  • MCP client但是,已注册可处理该任务tool进行调试
  • client将条目添加到文档注册表MCP server发送到
  • MCP server执行适当的操作(例如,启动无头浏览器)
  • server将条目添加到文档注册表MCP client按钮关闭对话框
  • client结果LLM交给LLM提示用户

开发自己的MCP服务器

Amazon从商品页面提取数据Python的,之MCP server来定义自定义外观。

这server是两个tool中描述的相应参数的值。一个是HTML另一种是为了下载整理好的信息。Cursor或Claude Desktop的,之LLM通过客户端server进行调试。

第一步:准备你的环境

首先Python 3进行动态观察时的轴心点。然后创建并启用虚拟环境。

python -m venv mcp-amazon-scraper
# On macOS/Linux:
source mcp-amazon-scraper/bin/activate
# On Windows:
.\mcp-amazon-scraper\Scripts\activate

所需的库(MCP Python SDK、剧作家、LXML 文件),模板名称将采用不同的格式。

pip install mcp playwright lxml
# Install browser binaries for Playwright
python -m playwright install

这将安装以下内容:。

  • 主控程序: Model Context Protocol的,之server以及client面向Python SDK在工作空间的边缘JSON-RPC处理所有通信细节
  • 剧作家在浏览器自动化库中,单击JavaScript多的Web提供无头浏览器功能,用于渲染和刻划站点
  • lxml 文件:快速XML/HTML在透视库中XPath使用查询Web从页面中轻松提取特定数据元素

总之MCP Python SDK(mcp)处理协议的所有细节Claude啊Cursor从自然语言提示中调用tool中所述修改相应参数的值。Playwright啊Web可以完全渲染页面(包括JavaScript内容)lxml是强大的HTML提供透视功能。

步骤2:启动MCP服务器

amazon_scraper_mcp.py名称Python创建文件。首先,导入所需的模块FastMCP server中所述修改相应参数的值。

import os
import asyncio
from lxml import html as lxml_html
from mcp.server.fastmcp import FastMCP
from playwright.async_api import async_playwright

# Define a temporary file path for the HTML content
HTML_FILE = os.path.join(os.getenv("TMPDIR", "/tmp"), "amazon_product_page.html")

# Initialize the MCP server with a descriptive name
mcp = FastMCP("Amazon Product Scraper")

print("MCP Server Initialized: Amazon Product Scraper")

这样一来MCP server的明细栏样式中定义的设置。下一个tool中所述修改相应参数的值。

步骤3:实施 fetch_page 工具

这tool啊URL作为输入Playwright单击功能区上的HTML将条目添加到文档注册表。

@mcp.tool()
async def fetch_page(url: str) -> str:
    """
    Fetches the HTML content of the given Amazon product URL using Playwright
    and saves it to a temporary file. Returns a status message.
    """
    print(f"Executing fetch_page for URL: {url}")
    try:
        async with async_playwright() as p:
            # Launch headless Chromium browser
            browser = await p.chromium.launch(headless=True)
            page = await browser.new_page()
            # Navigate to the URL with a generous timeout
            await page.goto(url, timeout=90000, wait_until="domcontentloaded")
            # Wait for a key element (e.g., body) to ensure basic loading
            await page.wait_for_selector("body", timeout=30000)
            # Add a small delay for any dynamic content rendering via JavaScript
            await asyncio.sleep(5)

            html_content = await page.content()
            with open(HTML_FILE, "w", encoding="utf-8") as f:
                f.write(html_content)

            await browser.close()
            print(f"Successfully fetched and saved HTML to {HTML_FILE}")
            return f"HTML content for {url} downloaded and saved successfully to {HTML_FILE}."
    except Exception as e:
        error_message = f"Error fetching page {url}: {str(e)}"
        print(error_message)
        return error_message

此异步函数包括:Amazon可能发生在页面上JavaScript渲染Playwright中所述修改相应参数的值。@mcp.tool()通过解码器,这个函数server中找到最佳实践tool中所述修改相应参数的值。

步骤4:实施 extract_info 工具

这tool单击功能区上fetch_page已保存HTML装入文件LXML和XPath用选择器透视,返回包含提取的商品详细信息的词典。

def _extract_xpath(tree, xpath, default="N/A"):
    """Helper function to extract text using XPath, returning default if not found."""
    try:
        # Use text_content() to get text from node and children, strip whitespace
        result = tree.xpath(xpath)
        if result:
            return result[0].text_content().strip()
        return default
    except Exception:
        return default

def _extract_price(price_str):
    """Helper function to parse price string into a float."""
    if price_str == "N/A":
        return None
    try:
        # Remove currency symbols and commas, handle potential whitespace
        cleaned_price = "".join(filter(str.isdigit or str.__eq__("."), price_str))
        return float(cleaned_price)
    except (ValueError, TypeError):
        return None

@mcp.tool()
def extract_info() -> dict:
    """
    Parses the saved HTML file (downloaded by fetch_page) to extract
    Amazon product details like title, price, rating, features, etc.
    Returns a dictionary of the extracted data.
    """
    print(f"Executing extract_info from file: {HTML_FILE}")
    if not os.path.exists(HTML_FILE):
        return {
            "error": f"HTML file not found at {HTML_FILE}. Please run fetch_page first."
        }

    try:
        with open(HTML_FILE, "r", encoding="utf-8") as f:
            page_html = f.read()

        tree = lxml_html.fromstring(page_html)

        # --- XPath Selectors for Amazon Product Details ---
        title = _extract_xpath(tree, '//span[@id="productTitle"]')
        # Handle different price structures (main price, sale price)
        price_whole = _extract_xpath(tree, '//span[contains(@class, "a-price-whole")]')
        price_fraction = _extract_xpath(
            tree, '//span[contains(@class, "a-price-fraction")]'
        )
        price_str = (
            f"{price_whole}.{price_fraction}"
            if price_whole != "N/A"
            else _extract_xpath(tree, '//span[contains(@class,"a-offscreen")]')
        )  # Fallback to offscreen if needed

        price = _extract_price(price_str)

        # Original price (strike-through)
        original_price_str = _extract_xpath(
            tree, '//span[@class="a-price a-text-price"]//span[@class="a-offscreen"]'
        )
        original_price = _extract_price(original_price_str)

        # Rating
        rating_text = _extract_xpath(tree, '//span[@id="acrPopover"]/@title')
        rating = None
        if rating_text != "N/A":
            try:
                rating = float(rating_text.split()[0])
            except (ValueError, IndexError):
                rating = None

        # Review Count
        reviews_text = _extract_xpath(tree, '//span[@id="acrCustomerReviewText"]')
        review_count = None
        if reviews_text != "N/A":
            try:
                review_count = int(reviews_text.split()[0].replace(",", ""))
            except (ValueError, IndexError):
                review_count = None

        # Availability
        availability = _extract_xpath(
            tree,
            '//div[@id="availability"]//span/text()',
        )

        # Features (bullet points)
        feature_elements = tree.xpath(
            '//div[@id="feature-bullets"]//li//span[@class="a-list-item"]'
        )
        features = [
            elem.text_content().strip()
            for elem in feature_elements
            if elem.text_content().strip()
        ]

        # Calculate Discount
        discount = None
        if price and original_price and original_price > price:
            discount = round(((original_price - price) / original_price) * 100)

        extracted_data = {
            "title": title,
            "price": price,
            "original_price": original_price,
            "discount_percent": discount,
            "rating_stars": rating,
            "review_count": review_count,
            "features": features,
            "availability": availability.strip(),
        }
        print(f"Successfully extracted data: {extracted_data}")
        return extracted_data

    except Exception as e:
        error_message = f"Error parsing HTML: {str(e)}"
        print(error_message)  # Added for logging
        return {"error": error_message}

单击功能区上LXML的,之fromstring来修改标记元素的显示属性HTML透视,坚固XPath在选择器中找到所需的元素。

步骤5:运行服务器

最后amazon_scraper_mcp.py在脚本的末尾添加以下行:stdio通过传输机构server中所述修改相应参数的值。这是Claude Desktop啊Cursor像…一样client通信的本地MCP server的规格化距离的幂函数。

if __name__ == "__main__":
    print("Starting MCP Server with stdio transport...")
    # Run the server, listening via standard input/output
    mcp.run(transport="stdio")

完整的源代码

import os
import asyncio
from lxml import html as lxml_html
from mcp.server.fastmcp import FastMCP
from playwright.async_api import async_playwright

# Define a temporary file path for the HTML content
HTML_FILE = os.path.join(os.getenv("TMPDIR", "/tmp"), "amazon_product_page.html")

# Initialize the MCP server with a descriptive name
mcp = FastMCP("Amazon Product Scraper")

print("MCP Server Initialized: Amazon Product Scraper")

@mcp.tool()
async def fetch_page(url: str) -> str:
    """
    Fetches the HTML content of the given Amazon product URL using Playwright
    and saves it to a temporary file. Returns a status message.
    """
    print(f"Executing fetch_page for URL: {url}")
    try:
        async with async_playwright() as p:
            # Launch headless Chromium browser
            browser = await p.chromium.launch(headless=True)
            page = await browser.new_page()
            # Navigate to the URL with a generous timeout
            await page.goto(url, timeout=90000, wait_until="domcontentloaded")
            # Wait for a key element (e.g., body) to ensure basic loading
            await page.wait_for_selector("body", timeout=30000)
            # Add a small delay for any dynamic content rendering via JavaScript
            await asyncio.sleep(5)

            html_content = await page.content()
            with open(HTML_FILE, "w", encoding="utf-8") as f:
                f.write(html_content)

            await browser.close()
            print(f"Successfully fetched and saved HTML to {HTML_FILE}")
            return f"HTML content for {url} downloaded and saved successfully to {HTML_FILE}."
    except Exception as e:
        error_message = f"Error fetching page {url}: {str(e)}"
        print(error_message)
        return error_message

def _extract_xpath(tree, xpath, default="N/A"):
    """Helper function to extract text using XPath, returning default if not found."""
    try:
        # Use text_content() to get text from node and children, strip whitespace
        result = tree.xpath(xpath)
        if result:
            return result[0].text_content().strip()
        return default
    except Exception:
        return default

def _extract_price(price_str):
    """Helper function to parse price string into a float."""
    if price_str == "N/A":
        return None
    try:
        # Remove currency symbols and commas, handle potential whitespace
        cleaned_price = "".join(filter(str.isdigit or str.__eq__("."), price_str))
        return float(cleaned_price)
    except (ValueError, TypeError):
        return None

@mcp.tool()
def extract_info() -> dict:
    """
    Parses the saved HTML file (downloaded by fetch_page) to extract
    Amazon product details like title, price, rating, features, etc.
    Returns a dictionary of the extracted data.
    """
    print(f"Executing extract_info from file: {HTML_FILE}")
    if not os.path.exists(HTML_FILE):
        return {
            "error": f"HTML file not found at {HTML_FILE}. Please run fetch_page first."
        }

    try:
        with open(HTML_FILE, "r", encoding="utf-8") as f:
            page_html = f.read()

        tree = lxml_html.fromstring(page_html)

        # --- XPath Selectors for Amazon Product Details ---
        title = _extract_xpath(tree, '//span[@id="productTitle"]')
        # Handle different price structures (main price, sale price)
        price_whole = _extract_xpath(tree, '//span[contains(@class, "a-price-whole")]')
        price_fraction = _extract_xpath(
            tree, '//span[contains(@class, "a-price-fraction")]'
        )
        price_str = (
            f"{price_whole}.{price_fraction}"
            if price_whole != "N/A"
            else _extract_xpath(tree, '//span[contains(@class,"a-offscreen")]')
        )  # Fallback to offscreen if needed

        price = _extract_price(price_str)

        # Original price (strike-through)
        original_price_str = _extract_xpath(
            tree, '//span[@class="a-price a-text-price"]//span[@class="a-offscreen"]'
        )
        original_price = _extract_price(original_price_str)

        # Rating
        rating_text = _extract_xpath(tree, '//span[@id="acrPopover"]/@title')
        rating = None
        if rating_text != "N/A":
            try:
                rating = float(rating_text.split()[0])
            except (ValueError, IndexError):
                rating = None

        # Review Count
        reviews_text = _extract_xpath(tree, '//span[@id="acrCustomerReviewText"]')
        review_count = None
        if reviews_text != "N/A":
            try:
                review_count = int(reviews_text.split()[0].replace(",", ""))
            except (ValueError, IndexError):
                review_count = None

        # Availability
        availability = _extract_xpath(
            tree,
            '//div[@id="availability"]//span/text()',
        )

        # Features (bullet points)
        feature_elements = tree.xpath(
            '//div[@id="feature-bullets"]//li//span[@class="a-list-item"]'
        )
        features = [
            elem.text_content().strip()
            for elem in feature_elements
            if elem.text_content().strip()
        ]

        # Calculate Discount
        discount = None
        if price and original_price and original_price > price:
            discount = round(((original_price - price) / original_price) * 100)

        extracted_data = {
            "title": title,
            "price": price,
            "original_price": original_price,
            "discount_percent": discount,
            "rating_stars": rating,
            "review_count": review_count,
            "features": features,
            "availability": availability.strip(),
        }
        print(f"Successfully extracted data: {extracted_data}")
        return extracted_data

    except Exception as e:
        error_message = f"Error parsing HTML: {str(e)}"
        print(error_message)  # Added for logging
        return {"error": error_message}

if __name__ == "__main__":
    print("Starting MCP Server with stdio transport...")
    # Run the server, listening via standard input/output
    mcp.run(transport="stdio")

连接您的MCP服务器

server脚本已经准备好了Claude Desktop啊Cursor像…一样MCP client中所述修改相应参数的值。

使用Claude Desktop进行设置

第一步: Claude Desktop的双曲正切值。

第二步: Settings -> Developer -> Edit Config中所述修改相应参数的值。因此,在默认文本编辑器中claude_desktop_config.json文件打开。

步骤3: mcpServers按键server中所述修改相应参数的值。args的路径amazon_scraper_mcp.py请用文件的绝对路径替换。

{
  "mcpServers": {
    "amazon_product_scraper": {
      "command": "python",  // Or python3 if needed
      "args": ["/full/path/to/your/amazon_scraper_mcp.py"], // <-- IMPORTANT: Use the correct absolute path
    }
  }
}

步骤4: claude_desktop_config.json保存文件并反映更改Claude Desktop中所述修改相应参数的值。

步骤5: Claude Desktop在聊天输入区tools图标(锤子🔨),模板名称将采用不同的格式。

步骤6: 点击它fetch_page和extract_info的,之tools将条目添加到文档注册表。

步骤7: 例如,发送以下提示: “获取此亚马逊产品的当前价格、原价和评级: https://www.amazon.com/dp/B09C13PZX7".

步骤8: Claude外部tools检测到需要,首先fetch_page下一个extract_info求值时使用曲面法线的原始方向。各tool的明细栏样式中定义的设置。

步骤9: 授予权限后MCP server的tools中所述修改相应参数的值。之后Claude接受结构化数据,在聊天中提示。

使用光标进行设置

Cursor(AI第一IDE)的明细栏样式中定义的设置。

第一步: Cursor的双曲正切值。

第二步: Settings ⚙️前进MCP转到节。

步骤3: 「+Add a new global MCP Server」按钮关闭对话框。因此mcp.json将打开配置文件。server的条目,在这里也可以在脚本中绝对路径中所述修改相应参数的值。

步骤4: mcp.json在您查看完详细信息后,单击「amazon_product_scraper」列表中显示,如果启动、连接,则应该显示绿色的点。

步骤5: Cursor聊天功能(Cmd+l或Ctrl+l),模板名称将采用不同的格式。

步骤6: 例如:“从该亚马逊URL提取所有可用的产品数据: https://www.amazon.com/dp/B09C13PZX7.将输出格式化为结构化JSON对象”.

步骤7: Claude Desktop来修改标记元素的显示属性Cursor啊fetch_page和extract_info求值时使用曲面法线的原始方向。批准这些请求(运行工具)。

步骤8: Cursor显示交互流MCP tools最后调用extract_info tool返回的结构化JSON出示数据。

以下为Cursor空的JSON输出示例。

{
  "title": "Razer Basilisk V3 Customizable Ergonomic Gaming Mouse: Fastest Gaming Mouse Switch - Chroma RGB Lighting - 26K DPI Optical Sensor - 11 Programmable Buttons - HyperScroll Tilt Wheel - Classic Black",
  "price": 39.99,
  "original_price": 69.99,
  "discount_percent": 43,
  "rating_stars": 4.6,
  "review_count": 7782,
  "features": [
    "ICONIC ERGONOMIC DESIGN WITH THUMB REST — PC gaming mouse favored by millions worldwide with a form factor that perfectly supports the hand while its buttons are optimally positioned for quick and easy access",
    "11 PROGRAMMABLE BUTTONS — Assign macros and secondary functions across 11 programmable buttons to execute essential actions like push-to-talk, ping, and more",
    "HYPERSCROLL TILT WHEEL — Speed through content with a scroll wheel that free-spins until its stopped or switch to tactile mode for more precision and satisfying feedback that's ideal for cycling through weapons or skills",
    "11 RAZER CHROMA RGB LIGHTING ZONES — Customize each zone from over 16.8 million colors and countless lighting effects, all while it reacts dynamically with over 150 Chroma integrated games",
    "OPTICAL MOUSE SWITCHES GEN 2 — With zero unintended misclicks these switches provide crisp, responsive execution at a blistering 0.2ms actuation speed for up to 70 million clicks",
    "FOCUS+ 26K DPI OPTICAL SENSOR — Best-in-class mouse sensor with intelligent functions flawlessly tracks movement with zero smoothing, allowing for crisp response and pixel-precise accuracy",
    // ... (other features)
  ],
  "availability": "In Stock"
}

这是MCP中所述修改相应参数的值。相同server但是,不同client应用程序也可以无缝运行。

利用Bright Data的MCP进行专业Web数据提取

Bright Data企业级模型上下文协议(MCP)解决方案包括MCP server代理管理防机器人导航、缩放的课题等)AI代理以及LLM中描述的场景,使用以下步骤创建明细表,以便在概念设计中分析体量的体积。

Bright Data的,之MCP中所述修改相应参数的值SERP包含结果或难以到达的站点的公共Web可即时访问数据AI为工作流优化。

MCP单击功能区上Web解锁器、SERP API、Web Scraper API、抓取浏览器等工具Web释放提取框架,并提供以下内容:。

  • AI就绪数据: 预结构化内容,无需预处理。
  • 可扩展性和可靠性: 即使是高音量也不会降低速度。
  • 块和CAPTCHA避免: 是高级的防机器人功能。
  • 全局IP覆盖: Bright Data代理对较大场景进行渲染期间已观察到该故障。
  • 无缝集成: 哪个MCP client但是可以迅速设置。

Bright Data MCP的先决条件

Bright Data的,之MCP在开始集成之前,请确保:。

  1. Bright Data帐户: Brightdata.com来修改标记元素的显示属性。首次用户将获得测试用的免费信用。
  2. API令牌: Bright Data从帐户设置API token请安全取得(用户设置页面)。
  3. Web解锁区: Bright Data在您查看完详细信息后,单击Web解锁器代理 zone中所述修改相应参数的值。mcp_unlocker等已弃用的函数的缺少的支持。
  4. (可选)清除浏览器区域: 高级浏览器自动化功能(例如,复杂的JavaScript在动态输入提示中单击抓取浏览器区域中所述修改相应参数的值。这zone中描述的场景,使用下列步骤创建明细表,以便在概念设计中分析体量的周长Password。概述选项卡中启用扩展提示。一般来说brd-customer-ACCOUNT_ID-zone-ZONE_NAME:PASSWORD的双曲正切值。

快速入门:为Claude Desktop配置Bright Data MCP

第一步: Bright Data的,之MCP server通常npx中描述的场景,使用以下步骤创建明细表,以便在概念设计中分析体量的体积。根据需要官方网站从Node.js中所述修改相应参数的值。

第二步: 克劳德桌面-> Settings -> Developer -> Edit Config(claude_desktop_config.json),模板名称将采用不同的格式。

步骤3: mcpServers属下Bright Data server插入设置。请用实际凭据替换占位符。

{
  "mcpServers": {
    "Bright Data": { // Choose a name for the server
      "command": "npx",
      "args": ["@brightdata/mcp"],
      "env": {
        "API_TOKEN": "YOUR_BRIGHTDATA_API_TOKEN", // Paste your API token here
        "WEB_UNLOCKER_ZONE": "mcp_unlocker",     // Your Web Unlocker zone name
        // Optional: Add if using Scraping Browser tools
        "BROWSER_AUTH": "brd-customer-ACCOUNTID-zone-YOURZONE:PASSWORD"
      }
    }
  }
}

步骤4: 保存配置文件Claude Desktop重新启动。

步骤5: Claude Desktop的锤子图标🔨)中所述修改相应参数的值。多个MCP tools应该是可以使用的。

以可能限制刮刀而闻名Web网站缩略图Zillow来定义自定义外观。Claude中输入以下提示:“从Zillow URL中提取JSON格式的关键属性数据: https://www.zillow.com/apartments/arverne-ny/the-tides-at-arverne-by-the-sea/ChWHPZ/"

必要的Bright Data的,之MCP tools的Claude来定义自定义外观。Bright Data的,之MCP server但基础复杂性(代理轮换,如有必要)Scraping Browser根据JavaScript渲染)。

Bright Data的,之server执行提取,返回结构化数据Claude出示那个。

以下是预期输出的示例。

{
  "propertyInfo": {
    "name": "The Tides At Arverne By The Sea",
    "address": "190 Beach 69th St, Arverne, NY 11692",
    "propertyType": "Apartment building",
    // ... more info
  },
  "rentPrices": {
    "studio": { "startingPrice": "$2,750", /* ... */ },
    "oneBed": { "startingPrice": "$2,900", /* ... */ },
    "twoBed": { "startingPrice": "$3,350", /* ... */ }
  },
  // ... amenities, policies, etc.
}

另一个示例:Hacker News标题

作为一个更简单的查询:“给我Hacker news最近5篇新闻文章的标题".

这是,Bright Data的,之MCP server动态内容和保护Web即使是内容AI如何简化工作流中的直接访问。

进一步阅读

为了更深入的知识AI以及大型语言模型(LLM)的过去指南。

结论

Anthropic的,之Model Context Protocol单击功能区上AI它标志着系统在如何与外部世界互动方面的根本转折点。为特定任务定制MCP server中所述修改相应参数的值。Bright Data的,之MCP整合进一步加强了这一点,避免了反机器人保护AI-ready结构化数据提供的企业级Web提供刻划功能。

马上人工智能解决方案注册,免费试用!