Serpstat MCP Server
A TypeScript server that integrates Serpstat SEO API with Anthropic's Model Context Protocol (MCP), enabling AI assistants like Claude to access comprehensive SEO data and analysis tools.
Table of Contents
- About MCP
- Prerequisites
- Installation
- Configuration
- Usage Examples
- MCP Tools
- Troubleshooting
- Development
- API Rate Limits
- Contributing
- Support
- License
About MCP
The Model Context Protocol (MCP) is an open standard developed by Anthropic that enables AI assistants to securely connect to external data sources and tools. This server implements MCP to provide Claude and other compatible AI assistants with access to Serpstat's powerful SEO analytics API.
Description
This project implements a TypeScript server that provides an API interface for working with Serpstat tools via the MCP protocol. The server supports request handling, parameter validation, logging, and working with multiple SEO analysis tools.
Features
- 🔍 Comprehensive SEO Analysis: Access domain info, keyword research, competitor analysis, and backlink data
- ✅ Input Validation: Robust parameter validation using Zod schemas
- 📊 Event Logging: Detailed logging with Winston for debugging and monitoring
- ⚙️ Flexible Configuration: Environment-based configuration with sensible defaults
- 🧪 Well Tested: Jest tests for parameter validation and business logic
- 🚀 TypeScript: Full type safety throughout the codebase
Prerequisites
- Node.js 18.0.0 or higher (Download Node.js)
- Valid Serpstat API token (get one from Serpstat)
- Compatible AI Assistant: Claude Desktop, Gemini CLI, or any MCP-compatible client
Installation
Global Installation (Recommended)
npm install -g @serpstat/serpstat-mcp-server
Local Installation
npm install @serpstat/serpstat-mcp-server
Configuration
Environment Variables
Set the following environment variables (can be in .env file):
SERPSTAT_API_TOKEN— Your Serpstat API token (required)SERPSTAT_API_URL— Serpstat API URL (default: https://api.serpstat.com/v4)LOG_LEVEL— Logging level: error, warn, info, debug (default: info)SERPSTAT_ENABLED_CATEGORIES— Filter tools by categories (optional, comma-separated, default: all categories enabled)
Claude Desktop & Gemini CLI Configuration
Add to your Claude Desktop config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
Add to your Gemini CLI config:
Linux: ~/.gemini/settings.json
{
"mcpServers": {
"serpstat": {
"command": "npx",
"args": ["-y", "@serpstat/serpstat-mcp-server"],
"env": {
"SERPSTAT_API_TOKEN": "YOUR_SERPSTAT_API_TOKEN_HERE",
"LANG": "en_US.UTF-8",
"LC_ALL": "en_US.UTF-8"
}
}
}
}
For local development, use the full path:
{
"mcpServers": {
"serpstat": {
"command": "node",
"args": ["/path/to/node_modules/serpstat-mcp-server/dist/index.js"],
"env": {
"SERPSTAT_API_TOKEN": "YOUR_SERPSTAT_API_TOKEN_HERE"
}
}
}
}
Filtering Tools by Category
You can limit which tools are available by specifying SERPSTAT_ENABLED_CATEGORIES environment variable. This is useful for:
- Reducing context window usage in AI assistants
- Focusing on specific SEO analysis areas
- Creating specialized configurations for different use cases
Available categories:
domain- Domain analysis tools (domain info, competitors, domain keywords, etc.)keywords- Keyword research tools (keyword suggestions, search volume, difficulty, etc.)backlinks- Backlink analysis tools (backlink summary, anchors, referring domains, etc.)url- URL analysis tools (URL traffic, competitors, keywords, etc.)projects- Project management tools (create, list, delete projects)credits- Credits and usage monitoring toolsrt- Rank tracking tools (rank history, SERP tracking, etc.)audit- Site audit tools (full site SEO audit, error reports, etc.)page-audit- One-page audit tools (single page analysis, on-page SEO, etc.)
Example: Enable only keyword and domain tools
{
"mcpServers": {
"serpstat": {
"command": "npx",
"args": ["-y", "@serpstat/serpstat-mcp-server"],
"env": {
"SERPSTAT_API_TOKEN": "YOUR_SERPSTAT_API_TOKEN_HERE",
"SERPSTAT_ENABLED_CATEGORIES": "keywords,domain"
}
}
}
}
Example: Enable only backlink analysis
{
"mcpServers": {
"serpstat": {
"command": "npx",
"args": ["-y", "@serpstat/serpstat-mcp-server"],
"env": {
"SERPSTAT_API_TOKEN": "YOUR_SERPSTAT_API_TOKEN_HERE",
"SERPSTAT_ENABLED_CATEGORIES": "backlinks"
}
}
}
}
Default behavior (all tools enabled):
If SERPSTAT_ENABLED_CATEGORIES is not specified or is empty, all tools are available (65 total tools across all categories).
Usage Examples
After installation and configuration in Claude Desktop, you can ask Claude:
Domain Analysis
- "Show me domain info for example.com"
- "Find competitors for my-site.com in Google US"
- "Get top 50 keywords that example.com ranks for"
Market Research
- "Show me all available market research categories"
- "Find top domains in 'E-commerce' category for Google US"
- "Get top 20 domains in '/Arts & Entertainment/TV & Video' category sorted by traffic"
- "Analyze competitive landscape in 'Business & Industrial' category with domains that have SDR above 50"
- "Find leading players in 'Health & Fitness' market with minimum 100k monthly traffic"
Keyword Research
- "Find related keywords to 'digital marketing'"
- "Get keyword suggestions for 'iphone 15' excluding 'rent' keywords"
- "Get comprehensive keyword data for [
iphone,samsung,googel pixel] including search volume, CPC, and difficulty"
Competitor Analysis
- "Show me competitor domains ranking for
pizza deliverykeyword with visibility metrics" - "Get top search results for
laptop computerskeyword showing positions, domains and SERP features" - "Get unique keywords for domain1.com vs domain2.com"
Backlink Analysis
- "Analyze backlinks summary for domain.com"
- "Get anchor text analysis for domain.com backlinks"
- "Get active backlinks for domain.com showing linking pages and target URLs"
- "Get referring domains for domain.com with domain authority metrics"
- "Get lost backlinks for domain.com showing removed links and deletion dates"
- "Get top 10 anchors for domain.com with backlink counts and referring domains"
- "Get backlinks intersection for domain.com vs competitor1.com and competitor2.com showing shared referring domains"
- "Get threat backlinks for domain.com showing malicious links from sites flagged for security threats"
Project Management
- "Create a new project for example.com named My SEO Project"
- "List all my projects with pagination"
- "Delete project with ID 1234567"
Credits & Usage Monitoring
- "Show me my audit credits statistics"
- "Check my API credits usage and remaining quota"
Rank Tracking
- "List all my rank tracker projects"
- "Check parsing status for project 12345 in region 2840"
Site Audit
- "Get audit settings for project 1113915"
- "Start site audit for project 1113915"
- "Stop site audit for project 1113915"
MCP Tools
Domain Analysis Tools
Keyword Research Tools
URL Analysis Tools
Backlinks Analysis Tools
Project Management Tools
Credits & Usage Monitoring Tools
Rank Tracking Tools
Site Audit Tools
One Page Audit Tools
Search Engines (se parameter)
Common search engine codes:
g_us- Google USAg_uk- Google United Kingdomg_ca- Google Canadag_au- Google Australiag_de- Germanyg_fr- Google Franceg_es- Google Spaing_it- Google Italyg_pl- Google Polandg_ua- Google Ukraine
See a full list of Search Engines Short Names
Troubleshooting
Common Issues
"Command not found: serpstat-mcp-server"
- Make sure you installed the package globally with
-gflag - Verify your PATH includes npm global binaries:
npm config get prefix - Try reinstalling:
npm uninstall -g @serpstat/serpstat-mcp-server && npm install -g @serpstat/serpstat-mcp-server
"API token error" or "Unauthorized"
- Check that
SERPSTAT_API_TOKENis set correctly in your environment - Verify your token is valid and active in your Serpstat account
- Ensure your token has sufficient API credits and permissions
"Module not found" errors
- Make sure all dependencies are installed:
npm install - Try rebuilding:
npm run clean && npm run build
Claude Desktop doesn't recognize the server
- Restart Claude Desktop after configuration changes
- Check the config file path and JSON syntax
- Verify the server starts correctly: run
serpstat-mcp-serverin terminal
"Can't find npx"
- You need to install Node.js - download and install Node.js
Rate limit errors
- Most Serpstat plans have 1 RPS (1 request per second) limit
- Wait between requests or contact Serpstat support for higher limits
- Check your API usage in the Serpstat dashboard
Debug Mode
Enable debug logging by setting:
export LOG_LEVEL=debug
Or in your Claude Desktop config:
{
"mcpServers": {
"serpstat": {
"command": "npx",
"args": ["-y", "@serpstat/serpstat-mcp-server"],
"env": {
"SERPSTAT_API_TOKEN": "YOUR_TOKEN_HERE",
"LANG": "en_US.UTF-8",
"LC_ALL": "en_US.UTF-8",
"LOG_LEVEL": "debug"
}
}
}
}
Development
Getting Started
-
Clone the repository:
git clone [email protected]:SerpstatGlobal/serpstat-mcp-server-js.git cd serpstat-mcp-server-js -
Install dependencies:
npm install -
Set environment variables:
cp .env.example .env # Edit .env with your Serpstat API token -
Build the project:
npm run build -
Start the server:
npm start -
For development mode (auto-reload):
npm run dev
Testing
To run tests:
npm test
Run specific test file:
npx jest src/__tests__/services/keyword_tools.test.ts
Run specific test by name:
npx jest --testNamePattern="methodName"
Scripts
npm run build— Compile TypeScript sources to JavaScript (output indist/)npm start— Run the compiled server fromdist/npm run dev— Run the server in development mode with hot-reloadnpm test— Run all testsnpm run lint— Run lintingnpm run clean— Clean build directory
Project Structure
serpstat-mcp-server/
├── src/
│ ├── index.ts # Entry point
│ ├── server.ts # Main MCP server
│ ├── handlers/ # Tool handlers
│ ├── services/ # Services for Serpstat API
│ ├── types/ # Data types
│ ├── utils/ # Utilities (config, logger, validation)
│ └── __tests__/ # Tests
├── dist/ # Compiled JavaScript (after build)
├── package.json
├── tsconfig.json
├── README.md
└── .env.example
API Rate Limits
By default, most Serpstat plans have 1 RPS (1 request per second) - this is sufficient for most tasks. If you need higher throughput, contact Serpstat support to discuss plan upgrades.
Important: The server respects rate limits automatically. If you encounter rate limit errors, wait before making additional requests.
Contributing
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes
- Add tests for new functionality
- Ensure tests pass:
npm test - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Submit a pull request
Development Guidelines
- Follow existing code style and TypeScript conventions
- Add tests for new features
- Update documentation as needed
- Use conventional commit messages
- Ensure all linting passes:
npm run lint
Changelog
See CHANGELOG.md for details about changes in each version.
Support
The most effective way to receive support from Serpstat is to use their live chat feature directly within the platform. Alternatively, you can email them at [email protected].
Acknowledgments
- Model Context Protocol by Anthropic
- Serpstat API for SEO data services
License
MIT License
This project is under MIT license, which means you can copy, use, modify, and even sell any part of this code without any hassle.
- See the LICENSE file for details
- Want to grab a chunk for your project? Go for it
- Want to rewrite half of it and ship a commercial product? Be my guest
- The only thing you need to do is not delete the copyright and the license itself from the files you take, and remember the Serpstat team with a kind word when you get that paycheck
With love, Serpstat R&D Team