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.
- About MCP
- Prerequisites
- Installation
- Configuration
- Usage Examples
- MCP Tools
- Troubleshooting
- Development
- API Rate Limits
- Contributing
- Support
- License
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.
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.
- 🔍 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
- 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
npm install -g @serpstat/serpstat-mcp-server
npm install @serpstat/serpstat-mcp-server
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)
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"
}
}
}
}
After installation and configuration in Claude Desktop, you can ask Claude:
- "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"
- "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"
- "Show me competitor domains ranking for
pizza delivery
keyword with visibility metrics" - "Get top search results for
laptop computers
keyword showing positions, domains and SERP features" - "Get unique keywords for domain1.com vs domain2.com"
- "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"
Tool Name | Description | Key Parameters |
---|---|---|
get_domains_info | Get SEO information for multiple domains | domains, se, filters |
get_domain_competitors | Get list of competitor domains | domain, se, size, filters |
get_domain_keywords | Get keywords that domain ranks for | domain, se, page, size |
get_domain_urls | Get URLs within a domain and their keyword counts | domain, se, page, size |
get_domain_regions_count | Get keyword count by region for a domain | domain, sort, order |
get_domain_uniq_keywords | Get unique keywords for two domains not ranked by a third domain | se, domains, minusDomain |
get_keywords | Get related organic keywords for a given keyword | keyword, se, filters |
get_keyword_suggestions | Get search suggestions for a keyword using full-text search with geographic names info | keyword, se, filters |
get_keywords_info | Get keyword overview with volume, CPC, competition, difficulty, and SERP features | keywords, se, withIntents |
get_keyword_full_top | Get Google's top-100 search results for analyzed keywords | keyword, se, size |
get_keyword_top_urls | Get website pages that rank for the largest amount of analyzed keyword variations with highest traffic | keyword, se, page, page_size |
get_keyword_competitors | Get domains that rank for the given keyword in Google top-20 results with competitor analysis | keyword, se, filters, sort |
get_keyword_top | Get Google's top-100 search results for the analyzed keyword with position, URL, domain and SERP features | keyword, se, filters, size |
get_backlinks_summary | Get comprehensive backlinks summary with referring domains, quality metrics, and changes | domain, subdomain |
get_anchors | Get anchor text analysis for backlinks with metrics on referring domains, total backlinks, and nofollow counts | query, searchType, anchor, sort |
get_active_backlinks | Get a list of active backlinks showing linking pages, target pages, link attributes, and discovery dates | query, searchType, sort, page |
get_referring_domains | Get a list of referring domains with domain rank metrics, referring pages count, and filtering options | query, searchType, sort, page |
get_lost_backlinks | Get a list of lost backlinks showing linking pages, target pages, link attributes, and deletion dates | query, searchType, sort, page |
get_related_keywords | Get semantically related keywords with frequency, CPC, competition, and difficulty data | keyword, se, filters, sort |
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
"Command not found: serpstat-mcp-server"
- Make sure you installed the package globally with
-g
flag - 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_TOKEN
is 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-server
in 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
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"
}
}
}
}
-
Clone the repository:
git clone git@github.com: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
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"
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
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
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.
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
- 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
See CHANGELOG.md for details about changes in each version.
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 support@serpstat.com.
- Model Context Protocol by Anthropic
- Serpstat API for SEO data services
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