Skip to content

Connect Ahrefs to Claude Code

  • Which linked pages are broken?

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

MCPhttps://mcp.lemonado.io/mcp

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

    text
    https://mcp.lemonado.io/mcp
  3. 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. 4

    Sign in

    Start Claude Code with claude and run /mcp. Choose Lemonado and finish the sign-in in your browser.

    bash
    claude
    /mcp
  5. 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.

Claude Code logoClaude Code

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

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.

For agents · markdown
# 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
FAQ

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.

See plans and pricing

Still have a question?

Shoot us an email at hello@lemonado.io.

Try for free

Stop fighting with data. Start feeding your AI.

Connect your data to AI and free your team from reporting and busywork.

Try Lemonado free