Skip to main content
Glama
ahrefs-mcp

ahrefs-mcp

by newilu

ahrefs-mcp

Unofficial community server, not affiliated with Ahrefs.

MCP server for the Ahrefs API v3. Gives Claude and any other MCP client live SEO data: keyword research, SERP analysis, backlink profiles, domain authority.

Built to be frugal with API units: narrow select lists per endpoint, in-memory response caching with per-endpoint TTLs (a cache hit costs 0 units), retries with backoff on 429/5xx. Monetary fields arrive from Ahrefs in USD cents and are normalized to dollars.

Tools

16 tools across four groups.

Group

Tool

What it returns

Keywords

keyword-metrics

Keyword ideas with volume, KD, CPC, traffic potential, intents

Keywords

keyword-suggestions

Autocomplete-style queries people actually type

Keywords

related-keywords

Terms top-ranking pages also rank for

Keywords

keyword-volume-history

Monthly volume trend and seasonality

Keywords

keyword-volume-by-country

Demand split by country

SERP

serp-overview

Top results with DR, UR, traffic, page type, AI overview presence

Site

domain-rating

DR and Ahrefs Rank

Site

site-metrics

Organic traffic, keywords, top-3 count, traffic value

Site

site-metrics-history

Monthly organic traffic trajectory

Site

site-metrics-by-country

Traffic split by country

Site

backlinks-stats

Live and all-time backlinks and referring domains

Site

referring-domains

Who links to a site, by authority

Site

organic-keywords

Keywords a domain ranks for, with positions

Site

organic-competitors

Competing domains with keyword overlap

Site

top-pages

Pages pulling the most traffic

Account

subscription-usage

API units used vs plan limit, never cached

Related MCP server: Haloscan MCP Server

Setup

Requires Node 18+ and an Ahrefs API key with API v3 access (get one here).

git clone https://github.com/newilu/ahrefs-mcp.git
cd ahrefs-mcp
npm install
npm run build

Claude Code

claude mcp add ahrefs -e AHREFS_API_KEY=your_key -- node /absolute/path/to/ahrefs-mcp/dist/index.js

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "ahrefs": {
      "command": "node",
      "args": ["/absolute/path/to/ahrefs-mcp/dist/index.js"],
      "env": { "AHREFS_API_KEY": "your_key" }
    }
  }
}

Example

Pull the top 20 organic keywords for competitor.com in the US, then check SERP overview for the three with the lowest difficulty. Which ones have no site above DR 40 in the top 10?

The agent chains organic-keywords and serp-overview and answers with live data.

Cost notes

Ahrefs bills per row and per selected field, so limit matters. Defaults here are deliberately small. Check subscription-usage before large batches. Cached responses (SERP 6h, keyword metrics 7d, site metrics 3d) are free.

License

MIT

Available Tools

16 tools
domain-ratingDomain ratingC

Domain Rating (0 to 100) and Ahrefs Rank for a domain.

Inputs: target (required).

keyword-metricsKeyword metricsB

Keyword ideas matching a seed term, with volume, difficulty, CPC, traffic potential, parent topic, and search intents. Ahrefs Keywords Explorer matching-terms.

Inputs: keyword (required), limit, country, min_volume.

keyword-suggestionsKeyword suggestionsA

Real autocomplete-style search suggestions for a seed keyword, with volume, CPC, and intents. What people actually start typing into Google around the term.

Inputs: keyword (required), limit, country.

keyword-volume-by-countryKeyword volume by countryA

Search volume of a keyword split by country. Shows where the demand actually lives geographically.

Inputs: keyword (required).

keyword-volume-historyKeyword volume historyB

Monthly search volume history for a keyword. Shows trend and seasonality.

Inputs: keyword (required), country.

organic-competitorsOrganic competitorsB

Domains competing with a target in organic search, with shared keywords and traffic.

Inputs: target (required), limit, country.

organic-keywordsOrganic keywordsB

Keywords a domain ranks for, with volume, difficulty, CPC, best position, and traffic. The clonable demand behind a competitor.

Inputs: target (required), limit, country.

referring-domainsReferring domainsA

Domains linking to a target, ordered by domain rating. Shows who links to a site and how authoritative they are.

Inputs: target (required), limit.

serp-overviewSERP overviewB

Top search results for a keyword with domain rating, URL rating, traffic, page type, and result type (organic, featured snippet, AI overview, etc).

Inputs: keyword (required), country, top_positions.

site-metricsSite metricsA

Organic profile of a domain: organic traffic, ranking keywords, top-3 keywords, traffic value, and paid traffic. Optionally scoped to one country.

Inputs: target (required), country.

site-metrics-by-countrySite metrics by countryC

Organic traffic of a domain split by country. Shows the site's real geography.

Inputs: target (required), limit.

site-metrics-historySite metrics historyA

Monthly organic traffic history for a domain. Shows whether a site is growing, flat, or declining.

Inputs: target (required), months.

subscription-usageSubscription usageA

Current API units usage against the plan limit. Never cached. Check before running expensive batches.

Inputs: no named parameters.

top-pagesTop pagesB

Pages that pull the most organic traffic on a domain, with top keyword and traffic value. What to study or beat first.

Inputs: target (required), limit, country.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 16 tools

    Disambiguation4/5

    Most tools target distinct resources (keyword data, domain data, backlinks, SERP). Some overlap exists among keyword-related tools like keyword-metrics, keyword-suggestions, and related-keywords, but their descriptions clarify the differences. Overall, an agent can usually pick the right tool without confusion.

    Naming Consistency5/5

    All tool names follow a consistent lowercase-hyphenated noun-phrase pattern (e.g., keyword-volume-history, site-metrics-by-country). No mixed conventions or verb-style changes. Names are predictable and align well with their purposes, despite 'keyword-metrics' being slightly misleading about its actual function.

    Tool Count4/5

    16 tools is slightly above the typical 3-15 range but reasonable for a comprehensive SEO toolkit covering keyword research, domain metrics, backlinks, and SERP data. It is well-scoped for the server's purpose and does not feel bloated or redundant.

    Completeness4/5

    The tool set covers the core Ahrefs workflows: keyword research (volume, metrics, suggestions, related), domain organic search profiles (competitors, top pages, site metrics), backlink analysis (stats, referring domains), and SERP overviews. Minor gaps exist (e.g., no rank-tracker history or site audit data) but they are beyond the apparent scope and agents can work around them using available tools.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      C
      maintenance
      A Model Context Protocol server that enables Claude to interact with DataForSEO APIs, allowing access to SEO data including SERPs, keyword research, on-page metrics, and domain analytics.
      17
      12,753 npm
      262
      Apache 2.0
    • -
      license
      C
      quality
      Not graded
      maintenance
      A Model Context Protocol server that exposes Haloscan SEO API functionality, allowing users to access keyword insights, domain analysis, and competitor research through Claude for Desktop and other MCP-compatible clients.
      32
      109 npm
      -
    • A
      license
      C
      quality
      F
      maintenance
      A Model Context Protocol server that connects Claude desktop and other compatible AI assistants to Ahrefs, allowing them to access Ahrefs functionality.
      42
      100
      MIT
    • A
      license
      C
      quality
      D
      maintenance
      An MCP server that integrates with the Haloscan SEO API to provide tools for keyword research, SERP analysis, and domain performance tracking. It enables users to perform comprehensive SEO tasks, including competitor analysis and visibility monitoring, within MCP-compatible clients.
      33
      1
      MIT