Ahrefs MCP Server
OfficialThe Ahrefs MCP Server connects AI assistants like Claude to Ahrefs' comprehensive SEO and analytics platform, enabling data retrieval and analysis across multiple domains.
Core Capabilities:
Rank Tracking: Monitor keyword rankings, positions, traffic, and competitor performance with historical comparisons and device-specific filtering
Keywords Explorer: Research search volume, CPC, difficulty, traffic potential, intent, matching terms, related keywords, and search suggestions
Site Explorer: Analyze domain/URL ratings, backlinks, referring domains, anchors, internal/external links, and organic keywords with historical data
Backlink Analysis: Retrieve comprehensive data on all backlinks, broken links, referring domains, and anchor texts with aggregation options
SERP Overview: View detailed search results metrics for specific keywords and countries, including top positions and traffic data
Batch Analysis: Perform bulk analysis of multiple URLs, domains, or subdomains for SEO metrics, backlinks, and organic/paid traffic
Site Audit: Access available site audit projects and retrieve audit data
Page Analysis: Identify top-performing pages by organic traffic or links, analyze paid search results with detailed SEO metrics
Project Management: Access project details, keywords, locations, competitors, and management data associated with Ahrefs accounts
All functions support filtering, historical data analysis, country-specific breakdowns, and include full documentation for understanding input schemas and capabilities.
Provides runtime environment for the Ahrefs MCP server, enabling connection between AI assistants and Ahrefs SEO platform
Used for installing and managing the Ahrefs MCP server package
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Ahrefs MCP Server what are the top keywords for my competitor's website?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
This repository is no longer maintained! We have released aremote Ahrefs MCP server, which doesn't require local setup and works directly in popular AI tools. Learn more here: Remote MCP server documentation
This repository is for the local Ahrefs MCP server which works with API v3 keys only. It DOES NOT work with MCP keys. It IS NOT maintained. It is OUTDATED. And we do not recommend using it.
Ahrefs MCP
A Model Context Protocol server to connect Claude desktop and other compatible AI assistants to Ahrefs.
Installation
npm commands need to be executed in a terminal:
macOS: open the Terminal from your Applications folder
Windows: press Windows + R, type
cmd, and press Enter
Install Node.js and npm
Download Node.js from nodejs.org
Follow the installation instructions for your operating system
Verify installation by running:
npm -vA version number will be printed if installation was successful
Windows Users
When installing Node.js, use the official installer and make sure the folder is added to PATH when selecting installation options.
Install Ahrefs MCP Server
npm install --prefix=~/.global-node-modules @ahrefs/mcp -gUpgrading versions
If you've installed our MCP server before, and just want to upgrade, run this command:
npm install --prefix=~/.global-node-modules @ahrefs/mcp@latest -gRelated MCP server: MCP Deep Web Research Server
Configuration
You can now add the Ahrefs MCP to your favourite AI assistant app by adding the ahrefs part to your app's configuration file:
{
"mcpServers": {
"ahrefs": {
"command": "npx",
"args": [
"--prefix=~/.global-node-modules",
"@ahrefs/mcp"
],
"env": {
"API_KEY": "YOUR_API_KEY_HERE"
}
}
}
}Specific for Windows OS
{
"mcpServers": {
"ahrefs": {
"command": "npx",
"args": [
"--prefix=C:\\Users\\YOUR_USERNAME_HERE\\.global-node-modules\\node_modules",
"@ahrefs/mcp"
],
"env": {
"API_KEY": "YOUR_API_KEY_HERE"
}
}
}
}Take note of the double escape backslashes
Take note that the prefix directory is slightly different
Take note of the forward slash for
@ahrefs/mcpIf you are working with Claude Desktop, run Ctrl-Alt-Del to open Task Manager and kill Claude Desktop. Otherwise, your newly changed config will not be loaded.
To learn more about creating or controlling API keys, refer to the official documentation.
Where to find the configuration file
Claude Desktop
Download Claude for Desktop
Select
Settings...
Click on
Developerin the left panel, thenEdit Config
Paste the configuration above into the open file
Restart the Claude app! If the installation is successful, it should look like this:
If you prefer directly navigating to the file, the paths are:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
If there are any issues, please refer to the official documentation
Cursor
Cursor supports configurations that are either project-specific or global: the MCP configuration file will be at .cursor/mcp.json or ~/.cursor/mcp.json respectively.
For more details, read the official documentation.
Common Installation Issues & Fixes
1. Node.js or npm Not Installed / Recognized
Symptoms:
Running
npm -vshows an error likecommand not foundor'npm' is not recognized.
Fix:
Ensure you've installed Node.js from nodejs.org.
Restart your terminal after installation.
On Windows, make sure the Node.js installer added
npmto your PATH.
Platform-Specific Checks:
Windows: Open Command Prompt (
Win + R → cmd) and run:node -v npm -vmacOS/Linux: Open Terminal and run:
which node && which npm
If it returns nothing, Node.js may not be in your $PATH.
2. Permission Errors During Global Installation
Symptoms:
Errors like
EACCES: permission denied, especially on macOS or Linux.
Fix:
Install using a user-scoped global prefix as shown in the installation guide:
npm install --prefix=~/.global-node-modules @ahrefs/mcp -gThis avoids requiring elevated privileges (
sudo).
Extra Tip:
If you used sudo previously and created permission issues, reset folder ownership:
sudo chown -R $(whoami) ~/.global-node-modules2a. macOS Terminal Permissions
Symptoms:
Terminal shows "Operation not permitted" errors
Unable to create folders or files
Permission denied messages when running npm commands
Fix: Check if Terminal has Full Disk Access:
Open System Settings (or System Preferences)
Go to Privacy & Security → Full Disk Access
Make sure Terminal.app is in the list and checked
If not present, click '+', navigate to Applications → Utilities → Terminal.app
Note: Modern macOS versions require explicit permissions for Terminal access. Without proper permissions, npm installations and other file operations may fail silently or with permission errors.
3. npx Cannot Find the Ahrefs MCP Command
Symptoms:
Error:
Cannot find package '@ahrefs/mcp'
Fix: Ensure your config uses the same prefix used during install:
"command": "npx",
"args": [
"--prefix=~/.global-node-modules",
"@ahrefs/mcp"
]Note:
Do not omit the --prefix unless you're installing globally system-wide (not recommended).
4. Configuration File Not Detected
Symptoms:
Claude does not list the MCP under “tools”.
Fix:
Make sure the config file path is correct:
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonLinux: (Rare, but if applicable)
~/.config/Claude/claude_desktop_config.json
Double-check you pasted the configuration inside the correct section and restarted Claude after saving.
5. API Key Problems
Symptoms:
MCP fails silently or throws an error about
API_KEY.Claude responds with a message that it ran into authentication issues.
Fix: Ensure this line is present in the MCP config:
"env": {
"API_KEY": "YOUR_API_KEY_HERE"
}Replace YOUR_API_KEY_HERE with your actual key. Ensure that your API key settings give you the necessary permissions.
For more help, refer to Ahrefs API key docs.
6. Path Expansion Issues
Symptoms:
Error messages containing
ENOENTor "no such file or directory"npm commands fail with path-related errors
~or environment variables not being expanded correctly
Fix: Use absolute paths instead of relying on path expansion:
Windows:
C:\Users\<username>\.global-node-modulesReplace <username> with your actual Windows username.
macOS:
/Users/<username>/.global-node-modulesReplace <username> with your macOS username.
Linux:
/home/<username>/.global-node-modulesReplace <username> with your Linux username.
Example Configuration:
{
"mcpServers": {
"ahrefs": {
"command": "npx",
"args": [
"--prefix=/Users/username/.global-node-modules", // Replace with your absolute path
"@ahrefs/mcp"
],
"env": {
"API_KEY": "YOUR_API_KEY_HERE"
}
}
}
}How to Find Your Absolute Path:
Windows:
Open Command Prompt
Type
echo %USERPROFILE%
macOS/Linux:
Open Terminal
Type
echo $HOME
Note: Using absolute paths eliminates issues with path expansion and ensures the configuration works regardless of environment variables or shell configurations.
🧪 Diagnostic Commands Per Platform
Issue | Windows Command | macOS/Linux Command |
Check Node version |
|
|
Check if MCP is installed |
|
|
Clear corrupted install | Delete folder manually |
|
📍 Summary of Key Paths
Purpose | Windows | macOS | Linux |
Claude config file |
|
|
|
Global MCP install location |
|
|
|
📘 Still Having Issues?
Check the official MCP documentation
Or reach out to internal support at Ahrefs through your usual engineering support channel.
Let us know what errors you're seeing, along with your OS and the output of:
npm list -g --prefix=~/.global-node-modules @ahrefs/mcpAvailable Tools
42 toolsbatch-analysis-batch-analysisC
Performs a batch analysis of multiple URLs, domains, or subdomains to retrieve selected SEO, backlink, organic, and paid traffic metrics. Use doc tool first to get the real input schema.
Inputs: select (required), targets (required), country, order_by, +1 more.
docA
Full documentation for Ahrefs tools. You must use this tool to get the input schema for any other tool.
Inputs: tool.
keywords-explorer-matching-termsC
Retrieves keyword ideas and their associated SEO metrics by matching input terms or phrases in a specified country, with extensive support for filtering, sorting, and metric selection. Use doc tool first to get the real input schema.
Inputs: country (required), select (required), keyword_list_id, keywords, +6 more.
keywords-explorer-overviewC
Provides an overview of keyword metrics—including search volume, CPC, ranking difficulty, traffic potential, and intent—for specified keywords, domains, or URLs within a given country. Use doc tool first to get the real input schema.
Inputs: country (required), select (required), keyword_list_id, keywords, +7 more.
keywords-explorer-search-suggestionsC
Provides keyword search suggestions and related keyword metrics (e.g., search volume, difficulty, CPC) for specified queries or keyword lists, with options to filter, sort, and customize returned fields by country. Use doc tool first to get the real input schema.
Inputs: country (required), select (required), keyword_list_id, keywords, +4 more.
keywords-explorer-volume-by-countryC
Retrieves search volume metrics for a specified keyword broken down by country. Use doc tool first to get the real input schema.
Inputs: keyword (required), limit.
keywords-explorer-volume-historyC
Retrieves historical search volume data for a specified keyword within a given country and date range. Use doc tool first to get the real input schema.
Inputs: country (required), keyword (required), date_from, date_to.
management-locationsC
Retrieves a list of management locations filtered by country code and optionally by US state. Use doc tool first to get the real input schema.
Inputs: country_code (required), us_state.
management-project-competitorsC
Retrieves the list of competitors associated with a specific Rank Tracker project in Ahrefs, using the project's unique identifier. Use doc tool first to get the real input schema.
Inputs: project_id (required).
management-project-keywordsB
Retrieves keywords associated with a specific project in Ahrefs' Rank Tracker by project ID. Use doc tool first to get the real input schema.
Inputs: project_id (required).
management-projectsC
Retrieves information about existing projects, including ownership, access type, presence of Rank Tracker keywords, and project ID. Use doc tool first to get the real input schema.
Inputs: access, has_keywords, owned_by, project_id.
rank-tracker-competitors-overviewC
Provides an overview of competitor rankings and keyword metrics for a specified project and date in Ahrefs Rank Tracker, allowing comparison between current and previous data. Use doc tool first to get the real input schema.
Inputs: date (required), device (required), project_id (required), select (required), +6 more.
rank-tracker-overviewC
Provides an overview of tracked keyword rankings and related search metrics for a specified project and date, with support for historical comparison, filtering, column selection, and device type. Use doc tool first to get the real input schema.
Inputs: date (required), device (required), project_id (required), select (required), +6 more.
serp-overview-serp-overviewC
Returns an overview of the top search results (SERP) for a specified keyword and country, including detailed metrics about each result like position, backlinks, traffic, domain rating, and related keywords. Use doc tool first to get the real input schema.
Inputs: country (required), keyword (required), select (required), date, +1 more.
site-audit-projectsA
Retrieves a list of site audit projects available in the system. Use doc tool first to get the real input schema.
Inputs: no named parameters.
site-explorer-all-backlinksC
Retrieves detailed information about all backlinks pointing to a specified URL or domain, with extensive filtering, sorting, selection, and aggregation options. Use doc tool first to get the real input schema.
Inputs: select (required), target (required), aggregation, history, +6 more.
site-explorer-anchorsC
Retrieves anchor text and associated backlink metrics for a specified domain or URL, with filtering and selection options. Use doc tool first to get the real input schema.
Inputs: select (required), target (required), history, limit, +5 more.
site-explorer-backlinks-statsC
Provides backlink statistics for a specified URL or domain as of a given date, with options to control protocol and scope. Use doc tool first to get the real input schema.
Inputs: date (required), target (required), mode, protocol.
site-explorer-best-by-external-linksC
Returns a list of a site's or URL's best-performing pages, ranked by the number of referring external links, with flexible filtering and sorting options. Use doc tool first to get the real input schema.
Inputs: select (required), target (required), history, limit, +5 more.
site-explorer-best-by-internal-linksC
Retrieves a site's or page's internal link metrics, allowing analysis of how pages within the given domain or URL are interconnected and which pages receive the most internal links. Use doc tool first to get the real input schema.
Inputs: select (required), target (required), limit, mode, +4 more.
site-explorer-broken-backlinksC
Retrieves a list of broken backlinks (i.e., links pointing to non-functioning pages) for a specified domain or URL, with customizable filtering, field selection, and aggregation options. Use doc tool first to get the real input schema.
Inputs: select (required), target (required), aggregation, limit, +5 more.
site-explorer-domain-ratingC
Retrieves the domain rating and related metrics for a specified domain or URL as of a specific date. Use doc tool first to get the real input schema.
Inputs: date (required), target (required), protocol.
site-explorer-domain-rating-historyC
Retrieves the historical domain rating data for a specified domain or URL over a defined date range and grouping interval. Use doc tool first to get the real input schema.
Inputs: date_from (required), target (required), date_to, history_grouping.
site-explorer-keywords-historyC
Retrieves historical data on the number of organic keywords a specified website or URL has ranked for, segmented by various search position ranges and grouped by a chosen time interval. Use doc tool first to get the real input schema.
Inputs: date_from (required), target (required), country, date_to, +4 more.
site-explorer-linked-anchors-externalC
Retrieves data about external anchor text (the clickable words in outbound links) used on a specified domain, subdomain, or URL, including metrics like dofollow link counts, distinct linked domains, and other attributes about the links. Use doc tool first to get the real input schema.
Inputs: select (required), target (required), limit, mode, +4 more.
site-explorer-linked-anchors-internalC
Retrieves internal anchor text data for a given website or URL, detailing how anchor texts are used in links between pages on the same site. Use doc tool first to get the real input schema.
Inputs: select (required), target (required), limit, mode, +4 more.
site-explorer-linkeddomainsC
Retrieves information about external domains that are linked from a specified target domain or URL, allowing for filtering, field selection, and various scopes of analysis. Use doc tool first to get the real input schema.
Inputs: select (required), target (required), limit, mode, +4 more.
site-explorer-metricsC
Provides SEO performance metrics for a specified domain, URL, or site section as of a given date, with options to customize search scope, protocol, country, and search volume mode. Use doc tool first to get the real input schema.
Inputs: date (required), target (required), country, mode, +2 more.
site-explorer-metrics-by-countryC
Provides organic and paid search performance metrics for a specified website, broken down by country, for a specific date. Use doc tool first to get the real input schema.
Inputs: date (required), target (required), mode, protocol, +2 more.
site-explorer-metrics-historyC
Retrieves historical data on key organic and paid search traffic and cost metrics for a specified domain, URL, or path over a selectable date range and grouping interval. Use doc tool first to get the real input schema.
Inputs: date_from (required), target (required), country, date_to, +5 more.
site-explorer-organic-competitorsC
Retrieves a list of organic search competitors for a specified website or URL, providing comparative SEO metrics such as common keywords, traffic estimations, and domain strength for a chosen country and date. Use doc tool first to get the real input schema.
Inputs: country (required), date (required), select (required), target (required), +8 more.
site-explorer-organic-keywordsC
Retrieves detailed organic keyword data for a given domain, URL, or path, including rankings, search intent, SERP features, traffic and CPC metrics, with the ability to filter, sort, and compare metrics across dates and regions. Use doc tool first to get the real input schema.
Inputs: date (required), select (required), target (required), country, +8 more.
site-explorer-outlinks-statsC
Retrieves statistical data about the outbound links (outlinks) from a specified URL, domain, or site section. Use doc tool first to get the real input schema.
Inputs: target (required), mode, protocol.
site-explorer-pages-by-trafficC
Retrieves pages from a specified domain, subdomain, path, or exact URL, ranked by their estimated organic search traffic for a selected country and protocol. Use doc tool first to get the real input schema.
Inputs: target (required), country, mode, protocol, +1 more.
site-explorer-pages-historyC
Retrieves historical data about pages from a specified domain, URL, or section of a site, grouped by a chosen time interval. Use doc tool first to get the real input schema.
Inputs: date_from (required), target (required), country, date_to, +3 more.
site-explorer-paid-pagesC
Returns detailed metrics about pages on a specified site or URL that are ranking in paid search results, including traffic, keyword data, ad presence, and changes over time, with powerful filtering and comparison capabilities. Use doc tool first to get the real input schema.
Inputs: date (required), select (required), target (required), country, +8 more.
site-explorer-refdomainsC
Retrieves detailed information about referring domains that link to a specified target domain or URL, with flexible filtering, selection, and sorting of backlink-related metrics. Use doc tool first to get the real input schema.
Inputs: select (required), target (required), history, limit, +5 more.
site-explorer-refdomains-historyC
Provides historical data on referring domains linking to a specified target (domain or URL) over a defined date range, with customizable grouping and analysis scope. Use doc tool first to get the real input schema.
Inputs: date_from (required), target (required), date_to, history_grouping, +2 more.
site-explorer-top-pagesC
Returns a list of the top-performing pages for a specified website or URL, including detailed SEO metrics (such as organic rankings, traffic, top keyword, and changes over time), with support for comparison between two dates and flexible filtering. Use doc tool first to get the real input schema.
Inputs: date (required), select (required), target (required), country, +8 more.
site-explorer-total-search-volume-historyC
Retrieves the historical total organic search volume, traffic, and traffic value for a given site or URL over a specified time period and grouping. Use doc tool first to get the real input schema.
Inputs: date_from (required), target (required), country, date_to, +5 more.
site-explorer-url-rating-historyC
Retrieves the historical URL rating data for a specified domain or URL over a defined date range, grouped by a chosen time interval. Use doc tool first to get the real input schema.
Inputs: date_from (required), target (required), date_to, history_grouping.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 42 tools
The tools are organized into clear categories (keywords-explorer, site-explorer, management, etc.), which helps differentiate them, but within categories there is significant overlap. For example, site-explorer-metrics, site-explorer-metrics-by-country, and site-explorer-metrics-history all retrieve metrics with slight variations, which could cause confusion. The descriptions are detailed but many tools share similar purposes with minor scope differences.
Tool names follow a consistent hyphen-separated pattern with a clear category-action structure (e.g., keywords-explorer-overview, site-explorer-metrics). However, there are minor deviations like 'batch-analysis-batch-analysis' (redundant) and 'serp-overview-serp-overview' (redundant), and some names are lengthy but generally predictable.
With 42 tools, this server is overly large for a single MCP server, making it cumbersome for agents to navigate. While Ahrefs is a comprehensive SEO platform, the tool count could be reduced by consolidating overlapping functionalities (e.g., multiple metrics tools) or splitting into focused sub-servers for better manageability.
The tool set provides extensive coverage of Ahrefs' SEO capabilities, including keyword research, site analysis, backlink tracking, rank tracking, and management features. It supports CRUD-like operations (e.g., retrieval, analysis, historical data) across all major domains, with no obvious gaps for typical SEO workflows.
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
Official Ahrefs MCP server. Access SEO data, including backlinks, keywords, and competitor research.
Hosted DataForSEO MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables AI assistants like Claude to interact with GitHub repositories, issues, and pull requests.ISC
- AlicenseBqualityDmaintenanceA Model Context Protocol server that enables Claude to perform advanced web research with intelligent search queuing, enhanced content extraction, and deep research capabilities.31MIT

302AI BrowserUse MCP Serverofficial
AlicenseAqualityDmaintenanceA Model Context Protocol server that enables Claude Desktop to browse the web, likely allowing the AI to access and interact with web content.229 npm9MIT- FlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server that allows Claude AI to interact with custom tools, enabling extension of Claude's capabilities through the MCP framework.-