How OpenSEO Competitor Analysis Extracts Ranked Keywords and SERP Competitors

OpenSEO extracts ranked keywords and SERP competitors by integrating with DataForSEO Labs endpoints, using get_competitor_keywords to retrieve organic keywords for a domain and find_serp_competitors to identify domains competing for specific target keywords.

The every-app/open-seo repository implements a comprehensive competitor analysis system that automates SEO intelligence gathering. By leveraging DataForSEO’s Labs API, the platform surfaces critical competitive data including keyword positions, search volumes, and SERP visibility scores. This article examines the exact implementation details, file paths, and function signatures that power these capabilities.

How Ranked Keywords Are Extracted

The get_competitor_keywords Implementation

OpenSEO retrieves a competitor’s organic keyword portfolio through the get_competitor_keywords tool defined in src/server/features/onboarding/onboardingMarketTools.ts (lines 155-162). This tool forwards the request to dfsClient.labs.getKeywords(), passing the target domain as a parameter.

The DataForSEO endpoint returns a payload containing each keyword’s position, search volume, keyword difficulty, and estimated traffic. The service layer filters this response and formats it into a standardized array of objects:

// src/server/features/onboarding/onboardingMarketTools.ts
export async function getCompetitorKeywords(domain: string) {
  const result = await dfsClient.labs.getKeywords({ domain });
  // Returns: [{ keyword, position, volume, difficulty, traffic }, …]
  return result.keywords;
}

The UI renders these results in sortable tables, allowing marketers to identify high-value keywords where competitors rank but their own domain does not.

How SERP Competitors Are Identified

The find_serp_competitors Tool

To discover who competes for specific target keywords, OpenSEO uses the find_serp_competitors tool implemented in src/server/mcp/tools/dataforseo-research-tools.ts (around line 833). This tool accepts an array of 2-5 target keywords and invokes client.labs.serpCompetitors().

According to the source code, the raw response includes each competitor’s domain, visibility score, keyword coverage count, and estimated traffic. The implementation applies filtering logic (lines 845-854) to remove entries with zero visibility and sorts the results by visibility in descending order:

// src/server/mcp/tools/dataforseo-research-tools.ts
export async function findSerpCompetitors(keywords: string[]) {
  const raw = await dfsClient.labs.serpCompetitors({ keywords });
  
  const sorted = raw
    .filter(c => c.visibility > 0)               // Remove empty entries
    .sort((a, b) => b.visibility - a.visibility); // Highest visibility first
  
  return sorted.map(c => ({
    domain: c.domain,
    visibility: c.visibility,
    keywordCoverage: c.keywordCoverage,
    traffic: c.traffic
  }));
}

This processing ensures users receive a prioritized list of domains that pose the strongest competition for their target queries.

Data Flow and Architecture

The competitor analysis workflow relies on a centralized client wrapper located in src/server/lib/dataforseo/client.ts. This file exports dfsClient with methods like fetchSerpCompetitors and fetchKeywords that handle authentication, rate limiting, and error handling for the DataForSEO API.

When a user initiates analysis from the frontend (triggered in src/web/src/pages/competitor-analysis.tsx), the system executes the appropriate tool based on input type:

  1. Domain input → Triggers get_competitor_keywords → Returns ranked keyword data
  2. Keyword input → Triggers find_serp_competitors → Returns competing domains

Both paths return JSON payloads that the UI consumes to render interactive grids and tables, enabling marketers to plan keyword gap analyses and content strategies.

Summary

Frequently Asked Questions

What DataForSEO endpoints does OpenSEO use for competitor analysis?

OpenSEO uses two primary DataForSEO Labs endpoints: the Keywords endpoint (accessed via dfsClient.labs.getKeywords()) to retrieve ranked keywords for a domain, and the Serp Competitors endpoint (accessed via client.labs.serpCompetitors()) to find domains competing for specific keywords. These provide position data, search volumes, visibility scores, and traffic estimates.

How many keywords can I analyze at once with the SERP competitor tool?

The find_serp_competitors tool accepts between 2 and 5 target keywords per request. This limitation ensures accurate competitor identification while maintaining API performance. For larger keyword sets, the system processes them in batches or recommends using the ranked keyword extraction method instead.

What filtering logic applies to SERP competitor results?

The implementation in src/server/mcp/tools/dataforseo-research-tools.ts filters out competitors with zero visibility scores and sorts the remaining results by visibility in descending order (lines 845-854). Additional filtering may remove explicit exclusions or domains below certain traffic thresholds before returning data to the frontend.

Can I extract competitor keywords for any domain?

Yes, the get_competitor_keywords tool accepts any valid domain string as input. The system queries DataForSEO’s database for organic ranking data associated with that domain, returning keywords where the domain holds positions in Google’s SERPs along with corresponding metrics like volume and difficulty.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →