使用说明

项目简介

AgentQL MCP Server 是一个实现了 Model Context Protocol (MCP) 的服务器,它扩展了 LLM 应用的能力,使其能够通过 'extract-web-data' 工具从网页中提取结构化数据。

主要功能点

  • 网页数据提取工具: 提供 'extract-web-data' 工具,允许 LLM 根据自然语言描述从指定的 URL 网页中提取结构化数据。

安装步骤

  1. 安装 AgentQL MCP Server: 打开终端并运行 'npm install -g agentql-mcp' 命令进行全局安装。
  2. 获取 API Key: 访问 AgentQL Dev Portal 获取 API Key。

服务器配置

  • MCP客户端需要配置服务器的启动命令才能连接 AgentQL MCP Server。以下是配置示例,你需要将 'YOUR_API_KEY' 替换为你从 AgentQL Dev Portal 获取的 API Key。

    {
      "server_name": "agentql",  //  服务器名称,可以自定义
      "command": "npx",        //  启动命令,使用 npx 运行 agentql-mcp
      "args": ["-y", "agentql-mcp"], //  命令参数,-y 表示自动确认执行
      "env": {
        "AGENTQL_API_KEY": "YOUR_API_KEY" //  环境变量,用于传递 AgentQL API Key
      }
    }
    • 注意: 具体的配置方法请参考你的 MCP 客户端(如 Claude, Cursor, Windsurf)的文档。

基本使用方法

  • 配置完成后,在你的 LLM 应用中,你可以指示 agent 使用 'extract-web-data' 工具来提取网页数据。例如,你可以给 agent 发送指令:'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. use tools'。

信息

分类

网页与API