Connect Ahrefs to Claude Code

Read backlinks, organic keywords, competitors and keyword research data from Ahrefs. Add Toolspoke to Claude Code once and it can use 15 Ahrefs actions. Your Ahrefs credential stays in Toolspoke, and you choose which actions Claude Code may call.

Set it up in Claude Code

Three steps, the first one once for every toolkit you will ever add.

  1. Add Toolspoke to Claude Code

    Run it in your project, then /mcp to sign in

    claude mcp add --transport http toolspoke https://toolspoke.com/mcp

    The sign-in opens in your browser, and Toolspoke asks you to approve it.

  2. Install Ahrefs and connect it

    Add Ahrefs to a project in your Toolspoke workspace.

    API key. You provide it once, when you install the connector. Toolspoke encrypts it at rest and decrypts it only for the length of a single call, and the gateway attaches it to the outbound request itself, so it is never part of the arguments an agent sends.

    API key
    Ahrefs → Account settings → API keys (app.ahrefs.com/account/api-keys) → Create API key. Only workspace owners and admins can create one, and the plan must include API units.
  3. Choose what Claude Code may do

    All 15 actions only read, and any of them can be switched off for a project.

What you can ask Claude Code for

A few of the Ahrefs actions that only read, so they are safe to try first.

  • The subscription, API-unit limits and units used so far for this key and its workspace
  • A domain's Domain Rating (0-100) and Ahrefs Rank on a date (today by default)
  • Backlink totals for a site, live and all-time backlinks and referring domains
  • The domains linking to a site, with each one's Domain Rating, link count and first and last seen dates

What Claude Code can do in Ahrefs

15 actions read.

Reads

  • Get limits and usage

    The subscription, API-unit limits and units used so far for this key and its workspace. Free. Ahrefs charges no units for it, and it fails on a revoked key or a workspace without API access, so an install tests itself with it.

  • Domain rating

    A domain's Domain Rating (0-100) and Ahrefs Rank on a date (today by default).

  • Site metrics

    Organic and paid headline metrics for a site, organic keywords, traffic and traffic value, paid keywords and traffic.

  • Backlinks stats

    Backlink totals for a site, live and all-time backlinks and referring domains.

  • List backlinks

    Individual backlinks pointing at a site, with source and target URL, anchor, source Domain Rating and follow status. Billed per row.

  • List refdomains

    The domains linking to a site, with each one's Domain Rating, link count and first and last seen dates. Billed per row.

  • Organic keywords

    The keywords a site ranks for in organic search, with volume, best position, ranking URL and traffic. Billed per row.

  • Top pages

    A site's pages ranked by organic traffic, with each page's top keyword. Billed per row.

  • Organic competitors

    The sites competing with this one for organic keywords in one country, with shared keywords and traffic. Billed per row.

  • Keywords overview

    Volume, difficulty, CPC, traffic potential and parent topic for a list of keywords in one country.

  • Matching terms

    Keyword ideas containing the seed terms, or questions built on them, with volume and difficulty. Billed per row.

  • Related terms

    Keywords related to the seeds, ones the top-ranking pages also rank for, or that searchers also talk about. Billed per row.

  • Serp overview

    The pages ranking for one keyword in one country, with position, Domain Rating, backlinks and traffic.

  • List projects

    The projects in this Ahrefs workspace, the id rank_tracker_overview needs, plus each project's URL and keyword count. Free.

  • Rank tracker overview

    Rank Tracker positions for one project's tracked keywords on a date, keyword, position, ranking URL, volume and traffic.

Ahrefs in Claude Code: questions

Does Claude Code see my Ahrefs credential?

No. The credential is stored encrypted in Toolspoke, and the gateway adds it to each call. Claude Code only ever talks to Toolspoke, and the dashboard shows the last four characters of the credential and nothing more.

Will 15 actions crowd Claude Code's context?

No. Toolspoke shows Claude Code five bridge tools, plus a guide where a toolkit has one, and Claude Code searches for the Ahrefs action it needs when it needs it. Adding more toolkits does not add more tools to its list.

Can I add it once for every project?

Yes. Add --scope user to the command and Claude Code keeps Toolspoke in every project on this machine. Without it, the server is added to the project you ran the command in.

What does it cost?

Tool calls are free on every plan, and a Ahrefs call does not run in a sandbox, so it bills nothing.

Try Ahrefs in Claude Code

Free to start, and tool calls cost nothing on any plan.