Back to MCP directory
publicPublicdnsLocal runtime

mcp-dataforseo

DataForSEO API的MCP服务器实现,支持多种搜索引擎数据查询

article

README

🚀 DataForSEO MCP 服务器

DataForSEO MCP 服务器是一个基于标准输入输出的 Model Context Protocol (MCP) 服务器,专为 DataForSEO API 打造,能助力开发者更便捷地使用相关服务。

🚀 快速开始

本服务器可以通过不同方式快速启动,以下为您详细介绍。

📦 安装指南

使用 npx 直接运行

可以直接使用 npx 运行该服务器,命令如下:

npx @skobyn/mcp-dataforseo --config '{"username":"your_username","password":"your_password"}'

全局安装

也可以选择全局安装,步骤如下:

npm install -g @skobyn/mcp-dataforseo
mcp-dataforseo --config '{"username":"your_username","password":"your_password"}'

💻 使用示例

基础用法

将 JSON 请求发送到标准输入,并从标准输出接收 JSON 响应,示例命令如下:

echo '{"type":"dataforseo_serp","keyword":"artificial intelligence"}' | npx @skobyn/mcp-dataforseo --config '{"username":"your_username","password":"your_password"}'

高级用法

以下是在 Node.js 代码中使用这个 MCP 服务器的示例:

const { spawn } = require('child_process');

// 启动 MCP 服务器
const server = spawn('npx', ['@skobyn/mcp-dataforseo', '--config', '{"username":"your_username","password":"your_password"}']);

// 定义请求
const request = {
  type: 'dataforseo_serp',
  keyword: 'artificial intelligence'
};

// 发送请求
server.stdin.write(JSON.stringify(request) + '\n');
server.stdin.end();

// 处理响应
server.stdout.on('data', (data) => {
  const response = JSON.parse(data.toString());
  console.log(response);
});

// 处理错误
server.stderr.on('data', (data) => {
  console.error(`Error: ${data}`);
});

📚 详细文档

支持的请求类型

SERP API

{
  "type": "dataforseo_serp",
  "keyword": "artificial intelligence",
  "location_code": 2840,
  "language_code": "en",
  "device": "desktop",
  "os": "windows"
}

Keywords Data API

{
  "type": "dataforseo_keywords_data",
  "keywords": ["seo", "search engine optimization"],
  "location_code": 2840,
  "language_code": "en"
}

Backlinks API

{
  "type": "dataforseo_backlinks",
  "target": "example.com",
  "limit": 100
}

On - Page API

{
  "type": "dataforseo_onpage",
  "url": "https://example.com",
  "check_spell": true,
  "enable_javascript": true
}

Domain Analytics API

{
  "type": "dataforseo_domain_analytics",
  "domain": "example.com"
}

App Data API

{
  "type": "dataforseo_app_data",
  "app_id": "com.example.app"
}

Merchant API

{
  "type": "dataforseo_merchant",
  "keyword": "bluetooth speakers",
  "location_code": 2840,
  "language_code": "en"
}

Business Data API

{
  "type": "dataforseo_business_data",
  "keyword": "pizza delivery",
  "location_code": 2840,
  "language_code": "en"
}

使用环境变量

你也可以使用环境变量而不是配置,示例如下:

export DATAFORSEO_USERNAME=your_username
export DATAFORSEO_PASSWORD=your_password
npx @skobyn/mcp-dataforseo

发布到 npm

要将此包发布到 npm,可以按以下步骤操作:

  1. 如果尚未登录,请先登录:

    npm login
    
  2. 发布包:

    npm publish --access public
    
  3. 后续更新包时:

    npm version patch
    npm publish
    
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