Implementing an AgentQL Model Context Protocol (MCP) Server

0


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.

  • Download the latest version of Node.js from nodejs.org
  • Run the installer.
  • Leave all settings as default and complete the installation

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:

I am a Civil Engineering Graduate (2022) from Jamia Millia Islamia, New Delhi, and I have a keen interest in Data Science, especially Neural Networks and their application in various areas.



Source link

You might also like
Leave A Reply

Your email address will not be published.