MarkTechPost@AI 05月07日 01:45
Implementing an AgentQL Model Context Protocol (MCP) Server
index_new5.html
../../../zaker_core/zaker_tpl_static/wap/tpl_guoji1.html

 

本文介绍了如何使用AgentQL从网页中提取结构化数据,并将其集成到Claude Desktop中。AgentQL是一个强大的工具,能够抓取任何包含非结构化数据的网站,并提供一致的结构化结果,即使页面内容动态变化或布局频繁更改。通过搭建AgentQL MCP服务器,用户可以从Amazon搜索结果页面抓取AI书籍的详细信息,如价格、评分和评论数量,并在Claude的交互式终端中进行数据可视化和分析。文章详细阐述了安装Node.js、AgentQL API、配置MCP服务器以及运行服务器的步骤,最终实现将非结构化网页内容转化为可操作的见解。

💻 AgentQL 允许用户通过定义所需信息的确切结构来抓取任何包含非结构化数据的网站。它提供一致的、结构化的结果,即使页面内容动态变化或布局频繁更改。

⚙️ 搭建AgentQL MCP服务器需要安装Node.js和AgentQL API,并配置Claude Desktop以连接到MCP服务器。配置过程包括创建AgentQL API密钥、安装必要的软件包以及修改claude_desktop_config.json文件。

📚 通过AgentQL,用户可以从Amazon搜索结果页面抓取AI书籍的详细信息。在Claude Desktop中,可以使用extract_web_data工具,输入URL和自然语言描述来提取数据,并在交互式终端中进行数据可视化,例如生成条形图和散点图。

💡 AgentQL可以与Notion或GitHub等其他服务器连接,自动发送结构化数据,用于文档、跟踪或进一步自动化。这使得AgentQL成为将非结构化网页内容转化为可操作见解的强大工具,这一切都通过简单的自然语言工作流程实现。

AgentQL allows you to scrape any website with unstructured data by defining the exact shape of the information you want. It gives you consistent, structured results—even from pages with dynamic content or frequently changing layouts.

In this tutorial, we’ll implement an AgentQL MCP server inside Claude Desktop, and use Claude’s built-in visualization capabilities to explore the data. Specifically, we’ll scrape an Amazon search results page for AI books, extracting details like price, rating, and number of reviews.

Step 1: Setting up dependencies

Node JS

We need npx to run the AgentQL server, which comes with Node.js.

Claude Desktop

Download Claude using https://claude.ai/download.

AgentQL API

Create your AgentQL API key at dev.agentql.com/api-keys and store it securely — you’ll need it later in this tutorial.

Step 2: Installing the packages

Once Node.js is installed, open your terminal and run the following command:

npm install -g agentql-mcp

Step 3: Configuring the MCP Server

Next, configure Claude to connect to your MCP server. Open the claude_desktop_config.json file located in the Claude installation directory using any text editor. If the file doesn’t exist, you can create it manually. Once opened, enter the following code:

{    "mcpServers": {      "agentql": {        "command": "npx",        "args": ["-y", "agentql-mcp"],        "env": {          "AGENTQL_API_KEY": "<YOUR_API_KEY>"        }      }    }  }

Replace <YOUR_API_KEY> with the key you generated.

Step 4: Running the server

Once the MCP configuration is complete, your server should appear in Claude. The AgentQL server includes a single powerful tool — extract_web_data — which takes a URL and a natural language description of the data structure you want to extract.

You can use any URL you want to scrape. For this tutorial, I used an Amazon search results page for AI books and asked Claude to visualize the extracted data. Claude provides an interactive terminal where it generates code to process and visualize the data — and you can edit that code as needed. Once the code was finalized, Claude presented a bar chart with interactive options to explore prices, ratings, review counts, and even a price vs. rating scatter plot, along with key summary statistics.

AgentQL can be used to scrape websites, and we can connect it with other servers like Notion or GitHub to automatically send structured data for documentation, tracking, or further automation.

This makes AgentQL a powerful tool for turning unstructured web content into actionable insights — all within a simple, natural language workflow.


Here’s a brief overview of what we’re building at Marktechpost:

The post Implementing an AgentQL Model Context Protocol (MCP) Server appeared first on MarkTechPost.

Fish AI Reader

Fish AI Reader

AI辅助创作,多种专业模板,深度分析,高质量内容生成。从观点提取到深度思考,FishAI为您提供全方位的创作支持。新版本引入自定义参数,让您的创作更加个性化和精准。

FishAI

FishAI

鱼阅,AI 时代的下一个智能信息助手,助你摆脱信息焦虑

联系邮箱 441953276@qq.com

相关标签

AgentQL 网页抓取 Claude Desktop 数据可视化
相关文章