home / mcp / ahrefs mcp server
Official Ahrefs MCP Server
Configuration
View docs{
"mcpServers": {
"ahrefs-ahrefs-mcp-server": {
"command": "npx",
"args": [
"--prefix=~/.global-node-modules",
"@ahrefs/mcp"
],
"env": {
"API_KEY": "YOUR_API_KEY_HERE"
}
}
}
}The Ahrefs MCP Server lets you connect Claude Desktop and other compatible AI assistants to Ahrefs data sources via a Model Context Protocol (MCP). It enables natural-language queries and actions on Ahrefs data through your AI tools, making it easier to access insights and automate tasks.
Set up the local Ahrefs MCP Server to enable your AI assistant to query Ahrefs data. You will run the MCP server locally and point your AI client to it using the provided configuration. Provide your API key in the environment to authorize requests. Once configured, your AI assistant can send requests to Ahrefs data through the MCP bridge.
Prerequisites you need before installation:
Step-by-step commands to install the MCP server globally for your user:
npm install --prefix=~/.global-node-modules @ahrefs/mcp -gConfigure your AI client to load the Ahrefs MCP server using a local stdio configuration. The following snippet shows how to reference the MCP server from your assistant’s configuration:
{
"mcpServers": {
"ahrefs": {
"command": "npx",
"args": [
"--prefix=~/.global-node-modules",
"@ahrefs/mcp"
],
"env": {
"API_KEY": "YOUR_API_KEY_HERE"
}
}
}
}If you previously installed the MCP server and want to upgrade to the latest version, run the following command to update the package in your user-scoped global modules:
npm install --prefix=~/.global-node-modules @ahrefs/mcp@latest -g