How to Set Up the Ahrefs MCP Server in Claude

SEO analyst researching backlinks with an AI assistant on a laptop

The Ahrefs MCP is Ahrefs' hosted Model Context Protocol server. It lets Claude and other AI assistants pull Site Explorer, Keywords Explorer, Site Audit and Brand Radar data from your Ahrefs account inside a chat. Most data calls spend API units from your plan's monthly allowance. Access starts on the Lite plan.

This guide covers the setup for Claude Desktop and Claude Code as of December 2026. It also explains how calls are priced in API units and how to cap spend before the first chat. It belongs to our MCP series with the DataForSEO MCP, Google Search Console MCP and Chrome DevTools MCP guides.

What is the Ahrefs MCP server?

Ahrefs runs the server for you. The Ahrefs MCP documentation lists one connection URL over Streamable HTTP.

https://api.ahrefs.com/mcp/mcp

Nothing runs on your machine for the main routes. The connection syncs across every device linked to your personal or company account.

Older tutorials point to a local server in the ahrefs/ahrefs-mcp-server GitHub repository. That repository is archived. Its README says the local server works with API v3 keys only and does not work with MCP keys. Ahrefs marks it as unmaintained and outdated and does not recommend it. Use the hosted server.

Ahrefs also sets a usage rule. Its documentation says calling the MCP endpoint from custom scripts, bridges or standalone HTTP and JSON-RPC clients is unsupported and not permitted. The endpoint is meant for AI clients. Code that needs Ahrefs data should go through the Ahrefs API.

Which Ahrefs plans include MCP access?

The hosted server is available on paid plans from Lite upward. Each plan caps how many rows an agent can pull in one request and comes with a monthly allowance of API units. The figures below come from the Ahrefs pricing page, checked in December 2026. Prices are monthly billing and exclude tax.

PlanMonthly priceMCP rows per request
Lite$129100
Standard$249250
Advanced$449500
EnterpriseCustomUnlimited

Higher tiers include more API units. Enterprise customers can buy unit add-ons. The same pricing page says pay-as-you-go purchases such as API units last for three billing months, including the current one. You can track what you've used in Account settings under Limits and usage.

How many API units does an Ahrefs MCP call use?

An MCP call costs the same as the equivalent API call. Ahrefs' limits consumption guide gives the formula.

units = max(base_cost, per_row_cost * num_rows)

The base cost is 50 units per request. The per-row cost adds up every unique field that appears in the result or in the filter and sort parameters. Most fields cost 1 unit. Some metrics cost 5 or 10 units. The endpoint's documentation flags them. Requests served from cache cost nothing. Rank Tracker, Management and Public endpoints are free, along with a few others marked free on their pages.

Ahrefs' own example shows how fast this grows. A backlinks request that touches title, refdomains_source and traffic costs 1 + 1 + 10 = 12 units per row, since traffic is a 10-unit field. Return 500 rows and the request costs 6,000 units. A single domain rating lookup returns one cheap row and costs the 50-unit base.

Row count drives the bill once it passes the base. Ask for 20 referring domains when 20 answer the question.

Cap API unit spend before you connect

An agent can fan one question out into many calls. Ahrefs gives you two controls, both covered in its MCP and API key docs.

  • A per-key monthly limit. Each OAuth connection creates a dedicated API key tagged with MCP scope. New keys created through OAuth for MCP default to 200,000 API units a month. Workspace admins can change or remove that limit in the API keys report. Keys you create by hand have no per-key limit by default.
  • A pay-as-you-go ceiling. If your plan allows pay-as-you-go charges, you can cap the extra units or switch them off in Limits and usage. Plan limits still apply to every key.

Lower the 200,000 default if you're testing on a Lite plan with other API users in the workspace. Only workspace owners and admins can open the API keys section.

Step 1. Connect Ahrefs to Claude Desktop

Ahrefs' Claude Desktop and web guide gives two methods. The OAuth connector is the quicker one.

  1. Open the Customize section in Claude, select Connectors and click the + button.
  2. Search for Ahrefs in the list of approved connectors and click its card.
  3. Click Connect, then choose your Ahrefs workspace and account.
  4. Click Allow on the consent screen. Ahrefs then appears in your connector list.

The connector also reaches the Claude mobile app. Ahrefs' mobile guide says you can't add a custom connector from the app itself. Add it on web or desktop first.

A second method uses an MCP key in the desktop config file. Generate the key under Account settings, then API keys, then Generate MCP key. Open Settings, then Developer, then Edit config, and add this block to claude_desktop_config.json.

{
  "mcpServers": {
    "Ahrefs": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://api.ahrefs.com/mcp/mcp",
        "--header",
        "Authorization:${AUTH_HEADER}"
      ],
      "env": {
        "AUTH_HEADER": "Bearer YOUR_MCP_KEY"
      }
    }
  }
}

This route runs mcp-remote through npx. Node.js has to be installed for it to start. Restart Claude Desktop after saving.

Step 2. Connect Ahrefs to Claude Code

Register the remote server from your terminal. Ahrefs' Claude Code guide uses the short -t http flag. The long form from the Claude Code MCP docs does the same thing.

claude mcp add --transport http ahrefs https://api.ahrefs.com/mcp/mcp

Start Claude Code and run /mcp. Pick the Ahrefs server and authenticate. A browser window opens where you sign in to Ahrefs, select the workspace and click Allow. The claude mcp login ahrefs command runs the same OAuth flow from your shell.

The command writes to local scope by default. Claude Code stores that entry in ~/.claude.json and loads it for the current project only. Add --scope user to load Ahrefs in every project. OAuth keeps the key out of the shared .mcp.json file that project scope writes. A teammate who adds the server signs in with their own account.

Trim the tool list with Ahrefs tool categories

The server advertises a large set of tools. Ahrefs' tool categories page says many MCP clients cap how many tools a server may advertise. Ahrefs goes over that cap for many of them. A tools query parameter on the URL picks the groups you need.

claude mcp add --transport http ahrefs \
  "https://api.ahrefs.com/mcp/mcp?tools=site-explorer-overview,site-explorer-reports,keywords-explorer"

Leave the parameter off and you get every tool. Documentation and rendering helpers are always included.

GroupWhat it covers
site-explorer-overviewDomain rating, backlink stats, organic and paid overview, metrics history
site-explorer-reportsBacklinks, referring domains, anchors, organic keywords, competitors, top pages
competitive-analysisKeyword gaps and link intersect across competitors
keywords-explorerKeyword overview, volume by country and history, matching and related terms
serp-overviewSERP overview for one keyword
site-auditSite Audit projects, issues, page explorer and page content
brand-radar-simpleBrand Radar reports at domain or URL level
gscSearch Console keywords, pages, positions and history through Ahrefs
subscription-infoYour subscription limits and usage

The page lists more groups for Web Analytics, Bot Analytics, Rank Tracker, social media and account management. Two special values exist. tools=essentials returns a curated set of the most used tools and can't be combined with other groups. tools=search-exec exposes a search, doc and exec trio that finds and runs any operation by name. Ahrefs notes that per-tool approval rules then apply to exec as a whole. One approval setting covers every operation behind it.

Step 3. Test the Ahrefs MCP connection

Ahrefs' setup guide suggests a first prompt like this one.

"In table form, using site-explorer-refdomains, display the top 10 referring domains for ahrefs.com from the past 7 days."

Ahrefs' API docs list free test queries. Site Explorer requests that target ahrefs.com, yep.com or firehose.com consume no units. Keywords Explorer and SERP Overview requests for the keywords ahrefs, yep or firehose alone are free too. That page covers the API. Ahrefs' MCP docs don't say whether the same targets are free over MCP. Check Limits and usage after your first test call to see what it cost. You can also ask Claude to call the subscription info tool, which reports your subscription limits and usage.

One habit shows up in Ahrefs' MCP use cases post. The assistant may search the web for a question it could answer from Ahrefs. Name the Ahrefs MCP at the start of the prompt.

SEO prompts to run with the Ahrefs MCP

The prompts below are illustrative. Each names the tool group, the market and a row limit. That keeps the unit cost predictable.

Competitor keyword gap

"Using the Ahrefs MCP competitive analysis tools, find keywords where competitor-a.com and competitor-b.com rank in the top 10 in Indonesia and example.com doesn't rank. Limit to 50 rows. Group them by intent in one table."

Volume and difficulty are Ahrefs estimates. Check the shortlist against impressions in the Search Console MCP before you plan pages around it.

Referring domains and top pages

"Using site-explorer-refdomains, list the 30 highest-DR referring domains that linked to competitor.com in the last 90 days. Then list its 20 top pages by organic traffic."

Both questions fit inside a Lite plan's 100-row cap. Larger pulls need several paged calls. Each one costs units.

Site Audit triage

"Using the Ahrefs Site Audit tools, list the issues in my latest crawl of example.com by number of affected URLs. For the top three, show 10 example URLs each."

Site Audit data comes from projects and crawls already set up in your Ahrefs account.

Ahrefs MCP vs DataForSEO MCP

Both give Claude third-party SEO data. The billing model is the main difference.

Ahrefs MCPDataForSEO MCP
BillingAPI units from a monthly plan allowance, Lite plan or higherPay-as-you-go balance per API call
HostingHosted by AhrefsHosted remote server or local npm package
Spend controlPer-key monthly unit limit and pay-as-you-go capDaily spending limits in the dashboard
Best fitTeams already paying for AhrefsTeams that want per-call pricing without a subscription

The DataForSEO details come from our DataForSEO MCP setup guide, which also lists its per-call prices.

Troubleshooting the Ahrefs MCP

SymptomLikely causeFix
Authorization fails or no data comes backThe workspace is on a plan below LiteUpgrade to Lite or higher. The hosted server needs a paid plan.
invalid tool category error on connectA misspelled group in the tools parameter, or essentials combined with another groupCheck the spelling against Ahrefs' tool categories page. Use essentials on its own.
Tools you expect are missing in the clientThe client capped the number of advertised toolsReconnect with a tools parameter that lists only the groups you need
Results stop at 100, 250 or 500 rowsYour plan's max rows per MCP requestAsk for fewer rows per call, or move to a higher plan
Calls fail partway through the monthThe OAuth key hit its 200,000-unit default, or the plan allowance ran outCheck Limits and usage. An admin can raise the key limit in the API keys report.
A key you pasted is rejected by the old local serverThe archived local server accepts API v3 keys onlyRemove the local server and connect to the hosted URL
spawn npx ENOENT with the MCP key methodNode.js is missing or the desktop app can't see your PATHInstall Node.js, or switch to the OAuth connector
Claude answers from a web searchThe prompt didn't steer it to the Ahrefs toolsName the Ahrefs MCP and the tool group in the prompt

Ahrefs data shows what a competitor earns. Your own Search Console data shows what you earn. Our guide to using Claude for SEO covers how we keep both in one workflow. Our SEO team runs this research for clients each month.

Want this for your brand

See where your brand stands in AI answers today, benchmarked against your competitors, no pitch required.