Skip to main content

A free SEO tool MCP (Model Control Protocol) service based on Ahrefs data. Includes features such as backlinks, keyword ideas, and more.

Project description

SEO MCP

A free SEO tool MCP (Model Control Protocol) service based on Ahrefs data. Includes features such as backlinks, keyword ideas, and more.

中文版

Overview

This service provides APIs to retrieve SEO data for websites. It handles the entire process, including captcha solving, authentication, and fetching data from Ahrefs.

This MCP service is for learning purposes only. Please do not abuse it, or you will bear the consequences. This project was inspired by the @GoFei Community.

For more information about this MCP service, please refer to Claude MCP SEO MCP Introduction.

Features

  • 🔍 Retrieve backlink data for any domain
  • 🔎 Get keyword ideas and SEO suggestions
  • 🔒 Automatically solve captchas using CapSolver
  • 💾 Signature caching to reduce API calls
  • 🚀 Fast and efficient data retrieval
  • 🧹 Simplified output providing the most relevant SEO information

Installation

Prerequisites

  • Python 3.10 or higher
  • CapSolver account and API key (register here)
  • pip or uv installed (on macOS, you may need to install with brew install uv)

Install from PyPI

pip install seo-mcp

Or use uv:

uv pip install seo-mcp

Manual Installation

  1. Clone the repository:

    git clone https://github.com/cnych/seo-mcp.git
    cd seo-mcp
    
  2. Install dependencies using pip or uv:

    pip install -e .
    # or
    uv pip install -e .
    
  3. Set the CapSolver API key:

    export CAPSOLVER_API_KEY="your-capsolver-api-key"
    

Usage

Running the service

You can run the service in several ways:

Install in Claude Desktop

To install this service and interact with it immediately in Claude Desktop:

fastmcp install src/seo_mcp/server.py

Use MCP Inspector for testing

For development and testing:

fastmcp dev src/seo_mcp/server.py

Install in Cursor IDE

In the Cursor settings, switch to the MCP tab, click the + Add new global MCP service button, and then input the following content:

{
  "mcpServers": {
    "SEO MCP": {
      "command": "uvx",
      "args": ["--python 3.10", "seo-mcp"],
      "env": {
        "CAPSOLVER_API_KEY": "CAP-xxxxxx"
      }
    }
  }
}

You can also create a .cursor/mcp.json file in the project root directory and input the above content, so it becomes a specific project's MCP service.

The CAPSOLVER_API_KEY environment variable can be obtained from here.

Next, we can use this MCP in Cursor:

Use SEO MCP Backlinks Tool on Cursor

Use SEO MCP Keyword Tool on Cursor

API Reference

The service exposes the following MCP tools:

get_backlinks_list(domain: str)

Retrieve the backlink list for a specified domain.

Parameters:

  • domain (string): The domain to query (e.g. "example.com")

Returns:

A list of backlink objects, each containing:

  • anchor:The anchor text of the backlink
  • domainRating:The domain rating (0-100)
  • title:The title of the linked page
  • urlFrom:The URL of the page containing the backlink
  • urlTo:The URL of the page being linked to
  • edu:A boolean value indicating whether the backlink is from an educational website
  • gov:A boolean value indicating whether the backlink is from a government website

Example Response:

[
  {
    "anchor": "Example link",
    "domainRating": 76,
    "title": "Useful resource",
    "urlFrom": "https://referringsite.com/resources",
    "urlTo": "https://example.com/page",
    "edu": false,
    "gov": false
  },
  ...
]

keyword_generator(keyword: str, country: str = "us", search_engine: str = "Google")

Get creative and SEO suggestions for a specified keyword.

Parameters:

  • keyword (string): The keyword to query
  • country (string): The country code (e.g. "us")
  • search_engine (string): The search engine (e.g. "Google")

Returns:

  • A list of keyword ideas, containing two types:

    • keyword ideas:Regular keyword suggestions, containing keyword, country, difficulty, volume, and update time
    • question ideas:Question-based keyword suggestions, with the same format

    Each keyword object contains:

    • keyword:The keyword text
    • country:The country code
    • difficulty:The difficulty rating (Easy, Medium, Hard, or Unknown)
    • volume:The search volume level (e.g. MoreThanOneHundred, MoreThanOneThousand)
    • updatedAt:The data update time

Development

For development purposes, you can clone the repository and install the development dependencies:

git clone https://github.com/cnych/seo-mcp.git
cd seo-mcp
uv sync  # or use pip install -e .

How it works

  1. The service first attempts to retrieve the cached signature of the domain
  2. If no valid cache exists, it will:
    • Use CapSolver to solve the Cloudflare Turnstile captcha
    • Retrieve the signature and expiration date from Ahrefs
    • Cache this information for future use
  3. Use the signature to retrieve SEO data
  4. Process and return simplified SEO information

Troubleshooting

  • CapSolver API key error:Ensure the CAPSOLVER_API_KEY environment variable is correctly set
  • Rate limiting:If you encounter rate limiting, try reducing the frequency of using the service
  • No results:Some domains may have no backlinks or not indexed by Ahrefs
  • Issues:If you encounter issues with SEO MCP, please refer to the SEO MCP GitHub repository for troubleshooting guides

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

seo_mcp-0.2.4.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

seo_mcp-0.2.4-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file seo_mcp-0.2.4.tar.gz.

File metadata

  • Download URL: seo_mcp-0.2.4.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for seo_mcp-0.2.4.tar.gz
Algorithm Hash digest
SHA256 08278e3a94880970f98ee62a64ea9070edc6081162233989c3321984c2254e4a
MD5 d2ad814ea358caf8fc130b16030f0a85
BLAKE2b-256 b044ff516b2b9ced1e59d4813650f408e67a30cc4bc44d034ffd8828d4c743d8

See more details on using hashes here.

File details

Details for the file seo_mcp-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: seo_mcp-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for seo_mcp-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b28f2a9e5f9c3e561afedc2e88a7d16753dd3d2a5e549b185c2b7aae3ce129f6
MD5 ae518de3f1bf638f32df3c9858f4fc0d
BLAKE2b-256 3ae709a3ad6b26ba86f2ddbaa863b453a53a1ce1b1d447def61b5348e46ee74e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page