DataForSEO MCP Server

by dataforseo
Apache 2.0
21

Integrations

  • Provides access to Google SERP data through DataForSEO's SERP API, allowing retrieval of real-time search engine results including titles, descriptions, and URLs.

  • Supports server implementation built on Node.js, requiring v14 or higher for handling DataForSEO API requests and responses.

  • Offers a TypeScript-based implementation for creating and extending tools that interact with DataForSEO APIs.

DataForSEO MCP 服务器

DataForSEO 的模型上下文协议 (MCP) 服务器实现,使 Claude 能够与选定的 DataForSEO API 进行交互并通过标准化接口获取 SEO 数据。

特征

  • SERP API:Google、Bing 和 Yahoo 的实时搜索引擎结果页面 (SERP) 数据;
  • KEYWORDS_DATA API:关键词研究和点击流数据,包括搜索量、每次点击费用和其他指标;
  • ONPAGE API:允许根据可定制的参数抓取网站和网页,以获取页面 SEO 性能指标;
  • DATAFORSEO_LABS API:基于 DataForSEO 内部数据库和专有算法的关键字、SERP 和域数据。

先决条件

  • Node.js(v14 或更高版本)
  • DataForSEO API 凭证(API 登录名和密码)

安装

  1. 克隆存储库:
git clone https://github.com/dataforseo/mcp-server-typescript cd mcp-server-typescript
  1. 安装依赖项:
npm install
  1. 设置环境变量:
# Required export DATAFORSEO_USERNAME=your_username export DATAFORSEO_PASSWORD=your_password # Optional: specify which modules to enable (comma-separated) # If not set, all modules will be enabled export ENABLED_MODULES="SERP,KEYWORDS_DATA,ONPAGE,DATAFORSEO_LABS"

构建和运行

构建项目:

npm run build

运行服务器:

node build/index.js

可用模块

以下模块可以启用/禁用:

  • SERP :Google、Bing 和 Yahoo 的实时 SERP 数据;
  • KEYWORDS_DATA :关键词研究和点击流数据;
  • ONPAGE :抓取网站和网页以获取页面 SEO 性能指标;
  • DATAFORSEO_LABS :基于 DataForSEO 数据库和算法的关键字、SERP 和域数据。

添加新工具/模块

模块结构

每个模块对应一个特定的DataForSEO API:

实施选项

您可以:

  1. 向现有模块添加新工具
  2. 创建一个全新的模块

添加新工具

以下是向任何新模块或现有模块添加新工具的方法:

// src/modules/your-module/tools/your-tool.tool.ts import { BaseTool } from '../../base.tool'; import { DataForSEOClient } from '../../../client/dataforseo.client'; import { z } from 'zod'; export class YourTool extends BaseTool { constructor(private client: DataForSEOClient) { super(client); // DataForSEO API returns extensive data with many fields, which can be overwhelming // for AI agents to process. We select only the most relevant fields to ensure // efficient and focused responses. this.fields = [ 'title', // Example: Include the title field 'description', // Example: Include the description field 'url', // Example: Include the URL field // Add more fields as needed ]; } getName() { return 'your-tool-name'; } getDescription() { return 'Description of what your tool does'; } getParams(): z.ZodRawShape { return { // Required parameters keyword: z.string().describe('The keyword to search for'), location: z.string().describe('Location in format "City,Region,Country" or just "Country"'), // Optional parameters fields: z.array(z.string()).optional().describe('Specific fields to return in the response. If not specified, all fields will be returned'), language: z.string().optional().describe('Language code (e.g., "en")'), }; } async handle(params: any) { try { // Make the API call const response = await this.client.makeRequest({ endpoint: '/v3/dataforseo_endpoint_path', method: 'POST', body: [{ // Your request parameters keyword: params.keyword, location: params.location, language: params.language, }], }); // Validate the response for errors this.validateResponse(response); //if the main data array is specified in tasks[0].result[:] field const result = this.handleDirectResult(response); //if main data array specified in tasks[0].result[0].items field const result = this.handleItemsResult(response); // Format and return the response return this.formatResponse(result); } catch (error) { // Handle and format any errors return this.formatErrorResponse(error); } } }

创建新模块

  1. src/modules/下为您的模块创建一个新目录:
mkdir -p src/modules/your-module-name
  1. 创建模块文件:
// src/modules/your-module-name/your-module-name.module.ts import { BaseModule } from '../base.module'; import { DataForSEOClient } from '../../client/dataforseo.client'; import { YourTool } from './tools/your-tool.tool'; export class YourModuleNameModule extends BaseModule { constructor(private client: DataForSEOClient) { super(); } getTools() { return { 'your-tool-name': new YourTool(this.client), }; } }
  1. src/config/modules.config.ts中注册您的模块:
export const AVAILABLE_MODULES = [ 'SERP', 'KEYWORDS_DATA', 'ONPAGE', 'DATAFORSEO_LABS', 'YOUR_MODULE_NAME' // Add your module name here ] as const;
  1. src/index.ts中初始化你的模块:
if (isModuleEnabled('YOUR_MODULE_NAME', enabledModules)) { modules.push(new YourModuleNameModule(dataForSEOClient)); }

您希望我们接下来支持哪些端点/API?

我们始终致力于扩展此 MCP 服务器的功能。如果您希望支持特定的 DataForSEO 端点或 API,请:

  1. 查看DataForSEO API 文档,了解可用内容
  2. 在我们的 GitHub 存储库中打开一个问题:
    • 您希望支持的 API/端点;
    • 您的用例的简要描述;
    • 描述您希望实现的任何具体功能。

您的反馈有助于我们确定下一步要支持的 API 的优先级!

资源

-
security - not tested
A
license - permissive license
-
quality - not tested

模型上下文协议服务器使 Claude 能够与 DataForSEO API 进行交互,从而允许访问 SEO 数据,包括 SERP、关键字研究、页面指标和域分析。

  1. 特征
    1. 先决条件
      1. 安装
        1. 构建和运行
          1. 可用模块
            1. 添加新工具/模块
              1. 模块结构
              2. 实施选项
              3. 添加新工具
              4. 创建新模块
            2. 您希望我们接下来支持哪些端点/API?
              1. 资源

                Related MCP Servers

                • -
                  security
                  A
                  license
                  -
                  quality
                  A Model Context Protocol server that enables web search, scraping, crawling, and content extraction through multiple engines including SearXNG, Firecrawl, and Tavily.
                  Last updated -
                  35
                  11
                  TypeScript
                  MIT License
                • -
                  security
                  F
                  license
                  -
                  quality
                  A Model Context Protocol server that enables Claude to perform Google Custom Search operations by connecting to Google's search API.
                  Last updated -
                  Python
                  • Linux
                • -
                  security
                  F
                  license
                  -
                  quality
                  A stdio-based server that enables interaction with the DataForSEO API through the Model Context Protocol, allowing users to fetch SEO data including search results, keywords data, backlinks, on-page analysis, and more.
                  Last updated -
                  145
                  JavaScript
                • -
                  security
                  A
                  license
                  -
                  quality
                  A Model Context Protocol server that enables Claude to perform web research by integrating Google search, extracting webpage content, and capturing screenshots.
                  Last updated -
                  854
                  4
                  MIT License
                  • Apple

                View all related MCP servers

                ID: mrhdc9pzer