Ahrefs 标志

Ahrefs

组织
ahrefs

Official Ahrefs MCP Server

发布者ahrefs
代码仓库ahrefs-mcp-server
语言TypeScript
复刻数
22
星标数
101
可用工具
0
传输类型streamable-http
分类
链接
  • 将工具接入 AI 工作流

    Ahrefs 提供 MCP 功能,可供兼容的 AI 客户端和智能体使用。

  • 0 个可用工具

    浏览下方可调用的操作;如果服务器提供了名称和描述,也会一并显示。

  • 可直接复制的配置

    使用安装配置片段,在您首选的 MCP 客户端中配置此服务器。

  • 开源社区热度

    关联的代码仓库有 101 个 Star 和 22 个 Fork。

[!WARNING] This repository is no longer maintained! We have released a remote 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

  1. Download Node.js from nodejs.org
  2. Follow the installation instructions for your operating system
  3. Verify installation by running:
sh
npm -v
  1. A 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

sh
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:

sh
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:

json
{
    "mcpServers": {
        "ahrefs": {
            "command": "npx",
            "args": [
                "--prefix=~/.global-node-modules",
                "@ahrefs/mcp"
            ],
            "env": {
                "API_KEY": "YOUR_API_KEY_HERE"
            }
        }
    }
}

Specific for Windows OS

json
{
    "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"
            }
        }
    }
}
  1. Take note of the double escape backslashes
  2. Take note that the prefix directory is slightly different
  3. Take note of the forward slash for @ahrefs/mcp
  4. If 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

  1. Download Claude for Desktop
  2. Select Settings...
  1. Click on Developer in the left panel, then Edit Config
  1. Paste the configuration above into the open file

  2. 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

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 -v shows an error like command not found or '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 npm to your PATH.

Platform-Specific Checks:

  • Windows: Open Command Prompt (Win + R → cmd) and run:
    node -v
    npm -v
  • macOS/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:
    sh
    npm install --prefix=~/.global-node-modules @ahrefs/mcp -g
  • This avoids requiring elevated privileges (sudo).

Extra Tip: If you used sudo previously and created permission issues, reset folder ownership:

sh
sudo chown -R $(whoami) ~/.global-node-modules

2a. 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:

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

json
"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 ENOENT or "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:

sh
C:\Users\<username>\.global-node-modules

Replace <username> with your actual Windows username.

macOS:

sh
/Users/<username>/.global-node-modules

Replace <username> with your macOS username.

Linux:

sh
/home/<username>/.global-node-modules

Replace <username> with your Linux username.

Example Configuration:

json
{
    "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:

  1. Open Command Prompt
  2. Type echo %USERPROFILE%

macOS/Linux:

  1. Open Terminal
  2. 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

IssueWindows CommandmacOS/Linux Command
Check Node versionnode -v && npm -vnode -v && npm -v
Check if MCP is installednpm list -g --prefix=%USERPROFILE%\.global-node-modules @ahrefs/mcpnpm list -g --prefix=~/.global-node-modules @ahrefs/mcp
Clear corrupted installDelete folder manuallyrm -rf ~/.global-node-modules

📍 Summary of Key Paths

PurposeWindowsmacOSLinux
Claude config file%APPDATA%\Claude\claude_desktop_config.json~/Library/Application Support/Claude/claude_desktop_config.json~/.config/Claude/claude_desktop_config.json (if applicable)
Global MCP install location%USERPROFILE%\.global-node-modules~/.global-node-modules~/.global-node-modules

📘 Still Having Issues?

Let us know what errors you're seeing, along with your OS and the output of:

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

安装

TypingMind
{
  "mcpServers": {
    "ahrefs": {
      "url": "https://api.ahrefs.com/mcp/mcp"
    }
  }
}

将 Ahrefs MCP 与多个 AI 模型配合使用

TypingMind 在工作区级别连接 MCP 工具,因此连接 Ahrefs 后,您就可以在 TypingMind 中搭配不同的 AI 模型使用,无需为每个模型单独设置。 此 MCP 通过远程托管的 MCP 服务器 URL 在 TypingMind 中连接。

添加 MCP 服务器 URL

如果 Ahrefs 已托管在远程服务器上,或您的团队希望让多个用户共用一个连接器,请选择此方式。

1

打开 MCP 连接器

在 TypingMind 中,前往“插件”,打开“MCP 连接器”,然后选择“添加 URL”。

  1. 在您的浏览器中打开 TypingMind。
  2. 进入“插件”。
  3. 打开“MCP 连接器”。
  4. 点击“添加 URL”。
TypingMind 的“添加自定义 MCP 服务器 URL”表单
2

粘贴服务器 URL

在“服务器 URL”字段中输入 https://api.ahrefs.com/mcp/mcp。根据服务器要求,添加连接名称、描述、图标、自定义 HTTP 请求头或 OAuth 客户端设置。

  1. 将 https://api.ahrefs.com/mcp/mcp 粘贴到“服务器 URL”字段中。
  2. 为 Ahrefs 输入连接名称。
  3. 您可以添加描述和图标,以便更容易识别此连接。
  4. 如果服务器需要身份验证,请添加自定义 HTTP 请求头或 OAuth 客户端信息。
3

创建连接

点击“创建连接”,然后返回插件列表,确认新的 MCP 连接显示为“有效”。

  1. 点击“创建连接”。
  2. 返回 MCP 连接器列表。
  3. 确认 Ahrefs 连接显示为“有效”。
  4. 如果连接未立即出现,请刷新插件列表。
4

切换模型,无需重新连接

使用您偏好的模型开始聊天,在“插件”中启用 Ahrefs 工具,并根据需要随时切换到其他模型。该 MCP 连接在 TypingMind 工作区中仍然可用。

  1. 在 TypingMind 中开始新聊天。
  2. 选择您想使用的 AI 模型。
  3. 在“插件”中启用 Ahrefs 工具。
  4. 需要时,请让模型使用该工具。
  5. 切换到其他 AI 模型,继续使用同一个 MCP 连接。
在 TypingMind 聊天中使用已启用的 MCP 工具和选定的 AI 模型
您能使用 Ahrefs 帮我完成这项任务吗?
Ahrefs
当然。我已阅读。
以下是我使用 Ahrefs 得到的结果。

常见问题

Ahrefs MCP 服务器有什么用途?

Ahrefs 是一个 MCP 服务器,可让兼容的 AI 客户端连接外部工具并获取上下文。在 TypingMind 中,只需添加一次此 MCP 服务器,即可在您的 AI 工作区中使用其工具。

可以在 TypingMind 中让多个 AI 模型使用 Ahrefs MCP 吗?

可以。TypingMind 在工作区层面连接 MCP 工具,因此您可以让 Claude、ChatGPT、Gemini 等不同 AI 模型,或您在 TypingMind 中配置的其他模型使用 Ahrefs,而无需为每个模型单独配置 MCP 服务器。

为什么在 TypingMind 中使用 Ahrefs MCP?

TypingMind 将多个 AI 模型、提示词、插件、AI 智能体、API 密钥和 MCP 工具整合到同一个工作区中,是优秀的大语言模型聊天前端之一。连接 Ahrefs 后,您可以在偏好的不同模型中使用其 MCP 工具,同时在 TypingMind 中井然有序地管理聊天工作流程。

如何将 Ahrefs MCP 连接到 TypingMind?

在 TypingMind 中添加 Ahrefs 托管的 MCP 服务器 URL,即可连接。如果您希望在 TypingMind 工作区中使用远程 MCP 连接,这种方式很适合。

Ahrefs MCP 在 TypingMind 中提供哪些工具?

Ahrefs 提供 MCP 功能,您可以在 TypingMind 的插件页面启用这些功能,然后在聊天中使用,或将其分配给 AI 智能体。

使用 Ahrefs MCP 需要向 TypingMind 提供我的 API 密钥吗?

不需要。TypingMind 采用本地优先的设计,让您自行掌控模型提供商、API 密钥、提示词和 MCP 配置。如果 Ahrefs 需要身份验证,请在创建连接时,为该 MCP 服务器添加所需的请求头、OAuth 设置或本地配置。

相关 MCP 服务器

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇