seo
Ahrefs MCP, CLI, and Lua Integration for AI Agents
Ahrefs integration docs for AI agents: MCP gateway setup, Ahrefs CLI commands, Lua API reference, credentials, and function schemas.
7 functions 7 read 0 write API key auth
Ahrefs for agents
Credentials can be configured manually in web or CLI hosts.
Use this integration from Lua code mode, the headless integrations CLI, or the KosmoKrator MCP gateway. The same package metadata powers all three surfaces.
Machine-Readable Metadata
- integration_slug
ahrefs- route_slug
ahrefs- package
ahrefs- auth_strategy
api_keyAPI key- cli_setup_supported
true- cli_runtime_supported
true- mcp_gateway_supported
true- lua_supported
true- supports_multi_account
true
Quick Links
Lua APIAgent-facing namespace and function reference. Ahrefs CLIHeadless setup and direct function calls. Ahrefs MCPMCP gateway setup for external clients. Submit feedbackReport missing tools, auth problems, wrong docs, or runtime issues. ContributeAdd tools or improve metadata in the integrations repo.
Ahrefs MCP Client Matrix
Use these pages when a specific agent client or framework needs copy-pasteable MCP setup for Ahrefs.
Claude Code Ahrefs MCP setup for Claude Code. Cursor Ahrefs MCP setup for Cursor. Codex Ahrefs MCP setup for Codex. OpenAI Agents Ahrefs MCP setup for OpenAI Agents SDK. Claude Agent SDK Ahrefs MCP setup for Claude Agent SDK. Vercel AI SDK Ahrefs MCP setup for Vercel AI SDK. LangChain Ahrefs MCP setup for LangChain. LangGraph Ahrefs MCP setup for LangGraph. CrewAI Ahrefs MCP setup for CrewAI. MCP clients Ahrefs MCP setup for Generic MCP Clients.
Ahrefs CLI Matrix
Use these pages for direct Ahrefs CLI workflows in scripts, CI, cron, and agent wrappers.
CI Ahrefs CLI for CI. Cron Jobs Ahrefs CLI for cron jobs. Shell Scripts Ahrefs CLI for shell scripts. Headless Automation Ahrefs CLI for headless automation. Coding Agents Ahrefs CLI for coding agents.
Function Catalog
| Function | Type | Parameters | Description |
|---|---|---|---|
ahrefs.ahrefs_list_backlinks | Read read | 4 | List backlinks pointing to a target website or URL. Use this to analyze a site's link profile, find linking pages, anchor texts, and backlink quality metrics. |
ahrefs.ahrefs_list_referring_domains | Read read | 4 | List referring domains that link to a target website. Shows domain-level metrics like domain rating (DR), the number of backlinks from each domain, and first/last seen dates. |
ahrefs.ahrefs_list_organic_keywords | Read read | 4 | List organic keywords that a target website or URL ranks for in search results. Returns keyword, position, search volume, traffic, keyword difficulty, and the ranking URL. |
ahrefs.ahrefs_list_pages | Read read | 4 | List top pages for a target website ranked by traffic or other metrics. Returns page URLs along with traffic data, keyword counts, and backlink information. |
ahrefs.ahrefs_list_paid_keywords | Read read | 3 | List paid (PPC) keywords that a target website bids on in search advertising. Returns keyword, position, search volume, CPC, traffic, and the landing page URL. |
ahrefs.ahrefs_list_anchors | Read read | 3 | List anchor texts used in backlinks pointing to a target website. Shows anchor text distribution, the number of referring pages using each anchor, and backlink counts. |
ahrefs.ahrefs_get_current_user | Read read | 0 | Get the authenticated Ahrefs user's profile information. Returns account details like name, email, and subscription plan. Use this to verify API connectivity. |