ahrefs
Official Ahrefs MCP Server
claude mcp add --transport stdio ahrefs-ahrefs-mcp-server npx --prefix=~/.global-node-modules @ahrefs/mcp \ --env API_KEY="YOUR_API_KEY_HERE"
How to use
This MCP server provides a local integration that lets compatible AI assistants, such as Claude Desktop, connect to Ahrefs using the MCP (Model Context Protocol). It exposes the Ahrefs MCP plugin through the npm package @ahrefs/mcp, which you run via npx with a user-wide prefix to avoid global install issues. The server expects an API key from Ahrefs (API_KEY) to authenticate API requests. Once configured in your assistant's MCP config, your assistant can issue Ahrefs API calls and receive results within its conversation context. Note that this local server is outdated and separate from Ahrefs’ remote MCP server, which is the recommended option for current workflows. If you plan to use Claude Desktop or Cursor, ensure the configuration is loaded and that the host application is restarted after updating the MCP settings.
How to install
Prerequisites:
- Node.js and npm installed on your system
- Access to an Ahrefs API key (for API_KEY)
Install steps:
- Install Node.js and npm (if not already installed). Verify with:
node -v
npm -v
- Install the Ahrefs MCP server globally using the recommended user-local prefix:
npm install --prefix=~/.global-node-modules @ahrefs/mcp -g
- (Optional) If you previously installed an older version, upgrade to latest with:
npm install --prefix=~/.global-node-modules @ahrefs/mcp@latest -g
- Create or update your MCP configuration in your AI assistant app with the following (see example below). Replace YOUR_API_KEY_HERE with your actual API key:
{
"mcpServers": {
"ahrefs": {
"command": "npx",
"args": [
"--prefix=~/.global-node-modules",
"@ahrefs/mcp"
],
"env": {
"API_KEY": "YOUR_API_KEY_HERE"
}
}
}
}
- Restart the AI assistant app (Claude Desktop, Cursor, etc.) to load the updated MCP configuration.
Additional notes
Notes and tips:
- This local server is older and not actively maintained; Ahrefs also provides a remote MCP server. Consider the remote option if you want a maintained, cloud-based integration.
- The MCP config uses a per-user global node_modules prefix; ensure the path matches your OS (macOS/Linux: ~/.global-node-modules; Windows users may need to adjust the prefix path accordingly).
- Always supply the API_KEY via the environment variable in the MCP config: API_KEY = YOUR_API_KEY_HERE.
- If Claude or Cursor does not detect the MCP server, verify the configuration is in the correct location for your app and that the app was restarted after changes.
- When troubleshooting, ensure there are no path expansion issues and that the npx command can resolve @ahrefs/mcp from the given prefix.
- For Windows, be mindful of backslashes in any explicit paths and use the Windows-specific examples provided in the README.
- The npm_package field is set to the name of the npm package used to run the server.
Related MCP Servers
iterm
A Model Context Protocol server that executes commands in the current iTerm session - useful for REPL and CLI assistance
mcp
Octopus Deploy Official MCP Server
furi
CLI & API for MCP management
editor
MCP Server for Phaser Editor
DoorDash
MCP server from JordanDalton/DoorDash-MCP-Server
mcp
MCP сервер для автоматического создания и развертывания приложений в Timeweb Cloud