Connect
Ahrefs to
Claude Code
- Which linked pages are broken?
https://mcp.lemonado.io/mcpUse Claude Code to find broken pages that still have backlinks and fix the redirects in your repo. Lemonado connects them in about 1 minute, no API keys needed.
https://mcp.lemonado.io/mcpWhy connect Ahrefs to Claude Code?
Lost link value usually hides in code: a renamed route, a missing redirect, a page that now 404s. Claude Code sees your routes and redirects, and with Lemonado it reads which URLs Ahrefs still sees links to, so it can fix them in the same session.
All your Ahrefs data
Backlinks, new and lost, ready to ask about.
Always today's numbers
Organic keywords and positions, synced from Ahrefs automatically, so answers use today's numbers.
Connect all your tools
Questions like "Do estimates match real clicks?" use Ahrefs and Search Console, Semrush at once.
How to connect Ahrefs to Claude Code
Before you start
- A Ahrefs account you can sign in to
- Claude Code installed
- A Lemonado account (the free trial works)
- 1
Connect Ahrefs in Lemonado
In Lemonado, open Connectors, find Ahrefs and sign in. Use an Ahrefs account on a paid plan with API access. Free and trial accounts can't share data.
- 2
Turn on external access
In the company's settings, open External tools, turn the connection on, choose which sources it can reach and copy the server URL.
texthttps://mcp.lemonado.io/mcp - 3
Add the server
With Claude Code installed, run one of these in your terminal. Most people want the first: it adds Lemonado to every project.
bash# every project (recommended) claude mcp add --scope user --transport http lemonado https://mcp.lemonado.io/mcp # this project only claude mcp add --transport http lemonado https://mcp.lemonado.io/mcp - 4
Sign in
Start Claude Code with claude and run /mcp. Choose Lemonado and finish the sign-in in your browser.
bashclaude /mcp - 5
Ask Claude Code about Ahrefs
Ask a question about the accounts your connection can reach. Claude Code can also write the numbers into a file or a script for you. Try "Find URLs on our site that have backlinks in Ahrefs but no longer exist in our routes, and add 301 redirects to the closest current page." Or ask: "Which pages need internal links?" or "Can this run every week?"
Good to know
- The command uses Claude Code's default local scope. Use --scope user to share the server across projects.
What can Claude Code do with Ahrefs?
Claude Code queries your Ahrefs data while it works in your repo: it saves data as files, checks tracking against code and runs headless with claude -p.
Find URLs on our site that have backlinks in Ahrefs but no longer exist in our routes, and add 301 redirects to the closest current page.
12 URLs with 87 referring domains between them. Added 12 redirects to next.config.ts; the biggest is /guides/tents-2023 with 31 domains.
Source: Ahrefs + your code
Pull our pages with the most referring domains from Ahrefs and check which of them link to our product pages in the code.
Of the 15 most-linked pages, 9 don't link to any product page. Added a related-products block to those 9 templates.
Source: Ahrefs + your code
Write a prompt file that pulls lost backlinks from Ahrefs for the last 7 days and saves reports/lost-links.md.
Saved prompts/lost-links.md. Run it with claude -p every Monday and it lists lost links with the page each one pointed to.
Source: Ahrefs + your code
Save our Ahrefs organic keywords with position, volume and URL to data/ahrefs_keywords.csv.
Saved 4,210 keywords. 312 of them rank 4 to 10 with over 500 searches, the best list to work from.
Source: Ahrefs + your code
Show keywords where two competitors rank and we don't, with difficulty under 20, grouped by topic.
86 keywords in 5 topics. Camp cooking is the biggest: 24 keywords, about 19,000 searches a month, average difficulty 11.
Source: Ahrefs
Compare Ahrefs' estimated traffic for our top 20 pages with Search Console clicks for the same pages last month.
Ahrefs estimates 31,000 visits, Search Console shows 44,500 clicks. The gap is mostly long-tail queries Ahrefs doesn't track.
Source: Ahrefs
Connect Ahrefs to another AI app.
Claude
Connect Ahrefs to Claude
ChatGPT
Connect Ahrefs to ChatGPT
Cursor
Connect Ahrefs to Cursor
VS Code (GitHub Copilot)
Connect Ahrefs to VS Code (GitHub Copilot)
Codex
Connect Ahrefs to Codex
Perplexity
Connect Ahrefs to Perplexity
Google Antigravity
Connect Ahrefs to Google Antigravity
Windsurf (Devin Desktop)
Connect Ahrefs to Windsurf (Devin Desktop)
Zed
Connect Ahrefs to Zed
n8n
Connect Ahrefs to n8n
Other integrations for Claude Code
All Claude Code integrations- Google Search Console in Claude CodeAsk Claude, ChatGPT or Cursor about your search queries, rankings and lost clicks.
- Semrush in Claude CodeAsk Claude, ChatGPT or Cursor about rankings and keyword gaps, with Search Console and Google Ads in the same answer.
- Google Analytics in Claude CodeAsk Claude, ChatGPT or Cursor about GA4 traffic, conversions and funnels, next to your ad spend.
- Google Ads in Claude CodeAsk Claude, ChatGPT or Cursor about your Google Ads campaigns, search terms and spend.
- Mixpanel in Claude CodeAsk Claude, ChatGPT or Cursor which campaigns bring users who stick, with Mixpanel next to your ad spend.
- PostHog in Claude CodePut PostHog product data next to your ad spend in Claude, ChatGPT or Cursor.
Reading this as an AI agent?
Everything an agent needs to set this up, in plain text. Paste this page's link into Claude Code and ask it to connect you, or copy the block.
# Connect Ahrefs to Claude Code (Lemonado MCP) - Server URL: https://mcp.lemonado.io/mcp - Transport: Streamable HTTP - Auth: OAuth; the user signs in to Lemonado in the browser. No API keys. - In Lemonado: connect the Ahrefs account. Use an Ahrefs account on a paid plan with API access. Free and trial accounts can't share data. - In Claude Code: Terminal: claude mcp add ```bash # every project (recommended) claude mcp add --scope user --transport http lemonado https://mcp.lemonado.io/mcp # this project only claude mcp add --transport http lemonado https://mcp.lemonado.io/mcp ``` If you are Claude Code, run the setup yourself: Add the Lemonado MCP server for all my projects by running: claude mcp add --scope user --transport http lemonado https://mcp.lemonado.io/mcp Then tell me to run /mcp and sign in to Lemonado. Once I've signed in, list the Ahrefs accounts Lemonado can reach. First question to try: "Find URLs on our site that have backlinks in Ahrefs but no longer exist in our routes, and add 301 redirects to the closest current page." More: https://lemonado.io/integrations/ahrefs · https://lemonado.io/llms.txt
Frequently Asked Questions
Yes. Every Ahrefs request uses units from your plan, wherever it comes from. In Claude Code it helps to save a pull as a file in the project and work from that, instead of asking Ahrefs again for every step.
Yes. Ahrefs' official MCP server is hosted, so Claude Code can use it too. It covers Ahrefs only. Lemonado covers Ahrefs plus your ad platforms, GA4 and the rest of your stack in one connection, so Claude Code can answer questions across them.
Run claude mcp list to see whether lemonado is connected. If it needs authentication, run /mcp inside Claude Code and sign in again. In Lemonado, check that Ahrefs is connected and External tools is on for the company. If Ahrefs returns nothing, check that your plan includes API access and has units left. Each request uses some.
Yes, if both are connected in Lemonado. One connection reaches every source you allow, so you can ask things like "Compare Ahrefs' estimated traffic for our top 20 pages with Search Console clicks for the same pages last month."
MCP is included in Lemonado's paid plans and in the free trial, so you can try it before you pay.
Still have a question?
Shoot us an email at hello@lemonado.io.
Try for freeStop fighting with data. Start feeding your AI.
Connect your data to AI and free your team from reporting and busywork.
Try Lemonado free