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 MCP (Model Control Protocol) SEO tool service based on Ahrefs data. Includes features such as backlink analysis, keyword research, traffic estimation, and more.
Overview
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
@哥飞社群.
Features
-
🔍 Backlink Analysis
- Get detailed backlink data for any domain
- View domain rating, anchor text, and link attributes
- Filter educational and government domains
-
🎯 Keyword Research
- Generate keyword ideas from a seed keyword
- Get keyword difficulty score
- View search volume and trends
-
📊 Traffic Analysis
- Estimate website traffic
- View traffic history and trends
- Analyze popular pages and country distribution
- Track keyword rankings
-
🚀 Performance Optimization
- Use CapSolver to automatically solve CAPTCHA
- Response caching
Installation
Prerequisites
- Python 3.10 or higher
- CapSolver account and API key (register here)
Install from PyPI
pip install seo-mcp
Or use uv:
uv pip install seo-mcp
Manual Installation
-
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"
Usage
Run the service
You can run the service in the following ways:
Use in Cursor IDE
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.
API Reference
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": [...]
}
Development
For development:
git clone https://github.com/cnych/seo-mcp.git
cd seo-mcp
uv sync
How it works
- The user sends a request through MCP
- The service uses CapSolver to solve the Cloudflare Turnstile CAPTCHA
- The service gets the authentication token from Ahrefs
- The service retrieves the requested SEO data
- The service processes and returns the formatted results
Troubleshooting
- CapSolver API key error:Check the
CAPSOLVER_API_KEYenvironment variable - Rate limiting:Reduce request frequency
- No results:The domain may not be indexed by Ahrefs
- Other issues:See GitHub repository
License
MIT License - See LICENSE file
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file iflow_mcp_cnych_seo_mcp-0.2.4.tar.gz.
File metadata
- Download URL: iflow_mcp_cnych_seo_mcp-0.2.4.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.25 {"installer":{"name":"uv","version":"0.9.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1c9c000fca0fa8795e3658a653cde735ac14add89302e1cba0cb61db98b1091
|
|
| MD5 |
26e471efc0691841c7dccda3f99a7d5b
|
|
| BLAKE2b-256 |
83be9bc682dd3bb6c519c2a48addcad44d4f6cb3463685c753e70ca67f5a5e74
|
File details
Details for the file iflow_mcp_cnych_seo_mcp-0.2.4-py3-none-any.whl.
File metadata
- Download URL: iflow_mcp_cnych_seo_mcp-0.2.4-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.25 {"installer":{"name":"uv","version":"0.9.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fceedc53ed63b7d5b14c93fbcede16993b2df96f6e8b68903a55240f92f70cf7
|
|
| MD5 |
f260d98b9b1c7101a573e6a74072944b
|
|
| BLAKE2b-256 |
dce49ba943a06ac497b61e9447fbae445795bd5ee0db0b03f1d13b3cf7054a8e
|