@tavarezme

How to Connect Ahrefs to Cursor AI with MCP

How to Connect Ahrefs to Cursor AI with MCP

Share the Post:

If you’re using Cursor for dev and want live SEO data in your flow, this is for you. Ahrefs rolled out an MCP server and published guides for Claude and ChatGPT, not Cursor. So here’s the Cursor setup that actually works, end to end. Ahrefs’ own post confirms the remote MCP URL and that their docs focus on other assistants.

What is MCP and why it matters in Cursor

Model Context Protocol lets AI clients connect to external tools and APIs. In Cursor, that means you can ask for backlinks, rankings, traffic, and get real data back without context switching. Cursor documents MCP support, and there’s a de-facto JSON config standard most clients use.

Example from my workflow:

Me: show me the top 10 pages by organic traffic
Cursor: pulls live data from Ahrefs

No browser tabs. No CSV exports. Just ask.

Prerequisites

You’ll need:

  • Cursor (current version)
  • An Ahrefs account with API access
  • 5 minutes to wire this up

Step 1: Grab your Ahrefs API token

Sign in to your Ahrefs account and copy your API key from the API settings. Their MCP article also links out to setup resources if you need them.

Step 2: Open Cursor’s MCP configuration file

Cursor reads a global JSON file for MCP servers at this path:

  • macOS and Linux~/.cursor/mcp.json
  • Windows%USERPROFILE%\.cursor\mcp.json

If it doesn’t exist, create it. This file path and format are widely adopted across MCP clients, including Cursor.

Step 3: Add the Ahrefs remote MCP server

Ahrefs exposes a remote MCP endpoint you can hit directly:

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

That URL is straight from Ahrefs’ post.

Use the lightweight mcp-remote shim so Cursor can speak to a remote server with headers. It supports custom headers via --header, which is perfect for bearer tokens.

Open ~/.cursor/mcp.json and add:

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

If you already have other servers in there, just add the ahrefs block alongside them. The mcpServers structure and env pattern match the standard MCP JSON used across clients.

Tip: if npx nags you, add -y as the first arg.

Step 4: Restart Cursor

Save the file, fully quit Cursor, then reopen. Cursor initializes MCP servers on startup. There’s even an open issue thread noting how Cursor defers to editing the JSON file directly for global servers, so a clean restart helps.

Step 5: Test the connection

In Cursor chat, try:

pull my Ahrefs subscription info

You should see details like plan and usage. Ahrefs recommends checking usage and limits from your dashboard if you need to confirm units.

What you can ask Cursor now

SEO analysis

show broken backlinks to my site
top 10 pages by organic traffic
check keyword rankings for "punta cana tours"

Competitive research

who are my top 5 organic competitors
list competitor backlinks to their homepage

Performance tracking

domain rating history last 6 months
how many keywords rank in positions 1 to 3
estimated organic traffic value this month

Real-time debugging

show recent referring domains
pull backlink data for /blog/post-slug/

Troubleshooting

Connection failed or no response

  1. Verify your API key and the Authorization: Bearer ... header string in env.
  2. Validate ~/.cursor/mcp.json syntax.
  3. Fully quit and relaunch Cursor after changes.
  4. If npx fails, prepend -y or install mcp-remote globally.

Still stuck? Use the MCP Inspector to test the URL and headers outside of Cursor. It supports bearer tokens and custom headers, which makes debugging easy. Or shoot me an email.

Final notes

  • Ahrefs’ remote MCP URL: https://api.ahrefs.com/mcp/mcp
  • Cursor uses a JSON config at ~/.cursor/mcp.json with a mcpServers object
  • mcp-remote lets you attach headers via --header Authorization: Bearer ...

Sources and references: Ahrefs’ MCP article, Cursor MCP docs, and the mcp-remote header docs.

Subscribe to receive my latest posts directly in your inbox!