by cnych
A free SEO tool MCP (Model Control Protocol) service based on Ahrefs data, offering features like backlink analysis, keyword research, and traffic estimation.
SEO MCP is a free Model Control Protocol (MCP) service designed to provide SEO data based on Ahrefs. It acts as an API to retrieve various SEO metrics, handling complex processes like CAPTCHA solving, authentication, and data retrieval. The service also incorporates caching to enhance performance and minimize API costs.
To use SEO MCP, you first need to install it. You can install it via pip or uv:
pip install seo-mcp
# Or
uv pip install seo-mcp
Alternatively, you can clone the repository and install it manually:
git clone https://github.com/cnych/seo-mcp.git
cd seo-mcp
pip install -e .
# Or
uv pip install -e .
Before running, ensure you have Python 3.10 or higher and set your CapSolver API key as an environment variable:
export CAPSOLVER_API_KEY="your-capsolver-api-key"
You can run the service within the Cursor IDE by adding it to your MCP server settings or by creating a .cursor/mcp.json
file in your project root. The service provides several API endpoints for different SEO functionalities:
get_backlinks_list(domain: str)
: Retrieves backlink data for a given domain.keyword_generator(keyword: str, country: str = "us", search_engine: str = "Google")
: Generates keyword ideas.get_traffic(domain_or_url: str, country: str = "None", mode: str = "subdomains")
: Estimates website traffic.keyword_difficulty(keyword: str, country: str = "us")
: Gets the keyword difficulty score.SEO MCP offers a comprehensive set of features for SEO analysis:
SEO MCP is ideal for:
Q: What is Ahrefs data? A: Ahrefs is a popular SEO toolset that provides data on backlinks, keywords, organic search traffic, and more. SEO MCP leverages this data.
Q: Is SEO MCP truly free? A: Yes, SEO MCP is a free service, but it requires a CapSolver account and API key for CAPTCHA solving, which may incur costs depending on your usage.
Q: What if I encounter a "CapSolver API key error"?
A: Ensure that your CAPSOLVER_API_KEY
environment variable is correctly set.
Q: Why am I experiencing "Rate limiting"? A: This could be due to sending too many requests in a short period. Try reducing your request frequency.
Q: What if I get "No results" for a domain? A: The domain you are querying might not be indexed by Ahrefs.
Q: Is this project for commercial use? A: The project states it is for educational purposes only and advises against misuse. Please refer to the MIT License for more details.
A MCP (Model Control Protocol) SEO tool service based on Ahrefs data. Includes features such as backlink analysis, keyword research, traffic estimation, and more.
This service provides an API to retrieve SEO data from Ahrefs. It handles the entire process, including solving the CAPTCHA, authentication, and data retrieval. The results are cached to improve performance and reduce API costs.
This MCP service is for educational purposes only. Please do not misuse it. This project is inspired by
@哥飞社群
.
🔍 Backlink Analysis
🎯 Keyword Research
📊 Traffic Analysis
🚀 Performance Optimization
pip install seo-mcp
Or use uv
:
uv pip install seo-mcp
Clone the repository:
git clone https://github.com/cnych/seo-mcp.git
cd seo-mcp
Install dependencies:
pip install -e .
# Or
uv pip install -e .
Set the CapSolver API key:
export CAPSOLVER_API_KEY="your-capsolver-api-key"
You can run the service in the following ways:
In the Cursor settings, switch to the MCP tab, click the +Add new global MCP server
button, and then input:
{
"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, with the same content.
The service provides the following MCP tools:
get_backlinks_list(domain: str)
Get the backlinks of a domain.
Parameters:
domain
(string): The domain to analyze (e.g. "example.com")Returns:
{
"overview": {
"domainRating": 76,
"backlinks": 1500,
"refDomains": 300
},
"backlinks": [
{
"anchor": "Example link",
"domainRating": 76,
"title": "Page title",
"urlFrom": "https://referringsite.com/page",
"urlTo": "https://example.com/page",
"edu": false,
"gov": false
}
]
}
keyword_generator(keyword: str, country: str = "us", search_engine: str = "Google")
Generate keyword ideas.
Parameters:
keyword
(string): The seed keywordcountry
(string): Country code (default: "us")search_engine
(string): Search engine (default: "Google")Returns:
[
{
"keyword": "Example keyword",
"volume": 1000,
"difficulty": 45,
"cpc": 2.5
}
]
get_traffic(domain_or_url: str, country: str = "None", mode: str = "subdomains")
Get the traffic estimation.
Parameters:
domain_or_url
(string): The domain or URL to analyzecountry
(string): Country filter (default: "None")mode
(string): Analysis mode ("subdomains" or "exact")Returns:
{
"traffic_history": [...],
"traffic": {
"trafficMonthlyAvg": 50000,
"costMontlyAvg": 25000
},
"top_pages": [...],
"top_countries": [...],
"top_keywords": [...]
}
keyword_difficulty(keyword: str, country: str = "us")
Get the keyword difficulty score.
Parameters:
keyword
(string): The keyword to analyzecountry
(string): Country code (default: "us")Returns:
{
"difficulty": 45,
"serp": [...],
"related": [...]
}
For development:
git clone https://github.com/cnych/seo-mcp.git
cd seo-mcp
uv sync
CAPSOLVER_API_KEY
environment variableMIT License - See LICENSE file
Reviews feature coming soon
Stay tuned for community discussions and feedback