ahrefs-mcp-server

MCP.Pizza Chef: ahrefs

Ahrefs holds the search and link data many people use to work out why a site ranks the way it does. This is the official connection to it, so an assistant can fetch that data while you are working — who links to a page, which keywords a site ranks for, how traffic has moved. It works in Claude Desktop and Cursor, installs by pasting a config entry, and needs your Ahrefs key.

Archived · The author made this repository read-only on GitHub.
Data
Web/Research

Use This MCP server To

Check who links to a page Find which keywords a site ranks for See how a site's traffic has moved Compare two sites on search visibility Look up a page's backlink profile Pull data for a report without the dashboard

README

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

  1. Download Node.js from nodejs.org
  2. Follow the installation instructions for your operating system
  3. Verify installation by running:
npm -v
  1. A version number will be printed if installation was successful

Install Ahrefs MCP Server

npm install --prefix=~/.global-node-modules @ahrefs/mcp -g

Upgrading 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 -g

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"
            }
        }
    }
}

To learn more about creating or controlling API keys, refer to the official documentation.

Where to find the configuration file

Claude Desktop
  1. Download Claude for Desktop
  2. Select Settings...

Open the Claude menu

  1. Click on Developer in the left panel, then Edit Config

Open the MCP config file

  1. Paste the configuration above into the open file

  2. Restart the Claude app! If the installation is successful, it should look like this:

ahrefs MCP appears under 'tools'

If you prefer directly navigating to the file, the paths are:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %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.

ahrefs-mcp-server FAQ

Can I use this to check who links to my site?
Yes — backlink data can be pulled directly into the conversation.
Do I need an Ahrefs account?
Yes, along with a key; the data comes from your own subscription.
Is this the official connection?
Yes, it is published by Ahrefs rather than being a third-party wrapper.
Which apps does it work with?
It is documented for Claude Desktop and Cursor.
How hard is it to set up?
You install it with a single command and paste a config entry with your key.