Back to MCP directory
publicPublicdnsLocal runtime

agentql-mcp

AgentQL MCP Server是一个集成AgentQL数据提取能力的模型上下文协议服务器,支持从网页中提取结构化数据。

article

README

🚀 AgentQL MCP 服务器

这是一个集成 AgentQL 数据提取功能的模型上下文协议 (MCP) 服务器,能够帮助用户从网页中高效提取结构化数据,为相关应用提供有力支持。

✨ 主要特性

工具

  • extract-web-data - 根据给定的 'url' 和描述实际数据及其字段的 'prompt',从网页中提取结构化数据。

📦 安装指南

要使用 AgentQL MCP 服务器通过网页提取数据,请通过 npm 安装它,从我们的 开发者门户 获取 API 密钥,并在支持 MCP 的应用程序中进行配置。

安装包

npm install -g agentql-mcp

配置 Claude

  • 打开 Claude Desktop 设置 通过 +,(不要与 Claude 账户设置混淆)
  • 转到 开发者 侧边栏部分
  • 点击 编辑配置 并打开 claude_desktop_config.json 文件
  • 在配置文件中 mcpServers 字典下添加 agentql 服务器
  • 重启应用程序
{
  "mcpServers": {
    "agentql": {
      "command": "npx",
      "args": ["-y", "agentql-mcp"],
      "env": {
        "AGENTQL_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}

了解更多关于 Claude 中 MCP 配置 这里

配置 Cursor

  • 打开 Cursor 设置
  • 转到 MCP > MCP 服务器
  • 点击 + 添加新的 MCP 服务器
  • 输入以下信息:
    • 名称: "agentql"(或你首选的名称)
    • 类型: "command"
    • 命令: env AGENTQL_API_KEY=YOUR_API_KEY npx -y agentql-mcp

了解更多关于 Cursor 中 MCP 配置 这里

配置 Windsurf

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

了解更多关于 Windsurf 中 MCP 配置 这里

验证 MCP 集成

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

提取页面 https://www.youtube.com/results?search_query=agentql 上的视频列表,每个视频应包含标题、作者名称、观看次数和视频 URL。确保排除广告项。将其格式化为 Markdown 表格。

⚠️ 重要提示

如果你的代理抱怨无法打开 URLs 或从网页加载内容,尝试添加 "使用工具" 或 "使用 agentql 工具" 提示。

💻 使用示例

基础用法

提取页面 https://www.youtube.com/results?search_query=agentql 上的视频列表,每个视频应包含标题、作者名称、观看次数和视频 URL。确保排除广告项。将其格式化为 Markdown 表格。

🔧 技术细节

开发

安装依赖:

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,用于在浏览器中访问调试工具。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client