网页数据提取服务

AgentQL MCP Server 是一个集成AgentQL数据提取能力的服务,主要用于从网页中提取结构化数据。

  • by tinyfish-io
  • JavaScript
  • 本地部署
  • 111 星标
  • 更新于
在 GitHub 查看 tinyfish-io/agentql-mcp

使用说明

AgentQL MCP服务器

这是一个模型上下文协议(MCP)服务器,它集成了 Agent QL的数据提取功能。

特性

工具

  • extract-web-data -从给定的url中提取结构化数据,使用prompt描述实际数据及其要提取的字段。

安装

要使用AgentQLMCP服务器从网页中提取数据,您需要通过npm安装它,从我们的 开发门户,并在您最喜欢的支持MCP的应用程序中进行配置。

安装软件包

npm install -g agentql-mcp

配置Claude

  • 打开克劳德桌面 设置 通过 ⌘+, (不要与Claude帐户设置混淆)
  • 首选 开发者 侧边栏部分
  • 点击 编辑配置 并打开 claude_desktop_config.json 文件
  • 添加 agentql 服务器内部 mcpServers 配置文件中的字典
  • 重新启动应用程序
{
  "mcpServers": {
    "agentql": {
      "command": "npx",
      "args": ["-y", "agentql-mcp"],
      "env": {
        "AGENTQL_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}

阅读更多关于Claude中的MCP配置 这里.

配置光标

  • 打开 光标设置
  • 首选 MCP>MCP服务器
  • 点击 +添加新的MCP服务器
  • 输入以下内容:
    • 名称:“agentql”(或您的首选名称)
    • 类型:“命令”
    • 命令: env AGENTQL_API_KEY=YOUR_API_KEY npx -y agentql-mcp

在Cursor中阅读有关MCP配置的更多信息 这里.

配置Windsurf

  • 打开 Windsurf:MCP配置面板
  • 点击 添加自定义服务器+
  • 或者,您可以打开 ~/.codeium/windsurf/mcp_config.json 直接
  • 添加 agentql 服务器内部 mcpServers 配置文件中的字典
{
  "mcpServers": {
    "agentql": {
      "command": "npx",
      "args": ["-y", "agentql-mcp"],
      "env": {
        "AGENTQL_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}

阅读更多关于Windsurf中MCP配置的信息 这里.

验证MCP集成

给你的代理一个需要从网络中提取数据的任务。例如:

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.

[!提示] 如果您的代理抱怨它无法打开URL或从web加载内容,而不是使用AgentQL,请尝试添加“使用工具”或“使用AgentQL工具”提示。

发展

安装依赖项:

npm install

构建服务器:

npm run build

对于自动重建的开发:

npm run watch

如果你想试用开发版本,你可以使用以下配置而不是默认配置:

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

[!注意] 不要忘记删除默认的AgentQL MCP服务器配置,以免将Claude与两个类似的服务器混淆。

调试

由于MCP服务器通过stdio进行通信,调试可能具有挑战性。我们建议使用 MCP检查员,可作为包脚本使用:

npm run inspector

检查器将提供一个URL,用于访问浏览器中的调试工具。