A Model Context Protocol server to connect Claude desktop and other compatible AI assistants to Ahrefs.
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
- Download Node.js from nodejs.org
- Follow the installation instructions for your operating system
- Verify installation by running:
npm -v- A version number will be printed if installation was successful
npm install --prefix=~/.global-node-modules @ahrefs/mcp -gIf you've installed our MCP server before, and just want to upgrade, run this command:
npm install --prefix=~/.global-node-modules @ahrefs/mcp@latest -gYou 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.
- 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.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
If there are any issues, please refer to the official documentation
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