MCP HubMCP Hub
tinyfish-io

agentql-mcp

by: tinyfish-io

Model Context Protocol server that integrates AgentQL's data extraction capabilities.

48created 21/12/2024
Visit
Protocol
AgentQL

📌Overview

Purpose: The AgentQL MCP Server is designed to facilitate data extraction from web pages using the Model Context Protocol (MCP).

Overview: This server leverages AgentQL's capabilities to pull structured data from specified URLs, allowing users to easily implement data extraction in their applications.

Key Features:

  • Web Data Extraction Tool: The extract-web-data tool enables users to extract structured data by specifying a URL and providing a detailed prompt about the desired data fields. This feature streamlines the process of gathering information from online sources, making it efficient and user-friendly.

AgentQL MCP Server

This is a Model Context Protocol (MCP) server that integrates AgentQL's data extraction capabilities.

Features

Tools

  • extract-web-data - extract structured data from a given URL, using a prompt as a description of the actual data and its fields to extract.

Installation

To use AgentQL MCP Server for extracting data from web pages, install it via npm, get an API key from the Dev Portal, and configure it in your app that supports MCP.

Install the package

npm install -g agentql-mcp

Configure Claude

  • Open Claude Desktop Settings via ⌘ + ,
  • Go to Developer sidebar section
  • Click Edit Config and open claude_desktop_config.json
  • Add agentql server inside mcpServers dictionary in the config file
  • Restart the app
{
  "mcpServers": {
    "agentql": {
      "command": "npx",
      "args": ["-y", "agentql-mcp"],
      "env": {
        "AGENTQL_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}

Read more about MCP configuration in Claude here.

Configure Cursor

  • Open Cursor Settings
  • Go to MCP > MCP Servers
  • Click + Add new MCP Server
  • Enter the following:
    • Name: "agentql" (or your preferred name)
    • Type: "command"
    • Command: env AGENTQL_API_KEY=YOUR_API_KEY npx -y agentql-mcp

Read more about MCP configuration in Cursor here.

Configure Windsurf

  • Open Windsurf: MCP Configuration Panel
  • Click Add custom server+
  • Alternatively, open ~/.codeium/windsurf/mcp_config.json directly
  • Add agentql server inside mcpServers dictionary in the config file
{
  "mcpServers": {
    "agentql": {
      "command": "npx",
      "args": ["-y", "agentql-mcp"],
      "env": {
        "AGENTQL_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}

Read more about MCP configuration in Windsurf here.

Validate MCP integration

Give your agent a task that requires extracting data from the web. For example:

Extract the list of videos from the page https://www.youtube.com/results?search_query=agentql, every video should have a title, an author name, a number of views and a url to the video. Make sure to exclude ads items. Format this as a markdown table.

Tip
If your agent cannot open URLs or load web content and does not use AgentQL, try adding "use tools" or "use agentql tool" hint.

Development

Install dependencies:

npm install

Build the server:

npm run build

For development with auto-rebuild:

npm run watch

To try the development version, use the following config instead of the default one:

{
  "mcpServers": {
    "agentql": {
      "command": "/path/to/agentql-mcp/dist/index.js",
      "env": {
        "AGENTQL_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}

Note
Remove the default AgentQL MCP server config to avoid conflicts if using this config.

Debugging

MCP servers communicate over stdio, which can make debugging challenging. Use the MCP Inspector, available as a package script:

npm run inspector

The Inspector provides a URL to access debugging tools in your browser.