Serpstat API 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.

Serpstat MCP Server

npm version License: MIT

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

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)

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"
      }
    }
  }
}

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"

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 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"

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

Tool NameDescriptionKey Parameters
get_domains_infoGet SEO information for multiple domainsdomains, se, filters
get_domain_competitorsGet list of competitor domainsdomain, se, size, filters
get_domain_keywordsGet keywords that domain ranks fordomain, se, page, size
get_domain_urlsGet URLs within a domain and their keyword countsdomain, se, page, size
get_domain_regions_countGet keyword count by region for a domaindomain, sort, order
get_domain_uniq_keywordsGet unique keywords for two domains not ranked by a third domainse, domains, minusDomain

Keyword Research Tools

Tool NameDescriptionKey Parameters
get_keywordsGet related organic keywords for a given keywordkeyword, se, filters
get_related_keywordsGet semantically related keywords with frequency, CPC, competition, and difficulty datakeyword, se, filters, sort
get_keyword_suggestionsGet search suggestions for a keyword using full-text search with geographic names infokeyword, se, filters
get_keywords_infoGet keyword overview with volume, CPC, competition, difficulty, and SERP featureskeywords, se, withIntents
get_keyword_full_topGet Google's top-100 search results for analyzed keywordskeyword, se, size
get_keyword_top_urlsGet website pages that rank for the largest amount of analyzed keyword variationskeyword, se, page, page_size
get_keyword_competitorsGet domains that rank for the given keyword in Google top-20 results with competitor analysiskeyword, se, filters, sort
get_keyword_topGet Google's top-100 search results for the analyzed keyword with position, URL, and SERP featureskeyword, se, filters, size

URL Analysis Tools

Tool NameDescriptionKey Parameters
get_url_summary_traffGet traffic and keyword statistics for website pages matching a specific URL maskse, domain, urlContains
get_url_competitorsGet list of URL competitors showing domains competing for same keywords in top-10 resultsse, url, sort, page
get_url_keywordsGet keywords for which specified URL ranks in top-100 Google and top-50 Bing search resultsse, url, filters, sort
get_url_missing_keywordsGet keywords that competitors rank for but the given URL does not, identifying keyword gapsurl, se, filters, sort

Backlinks Analysis Tools

Tool NameDescriptionKey Parameters
get_backlinks_summaryGet comprehensive backlinks summary with referring domains, quality metrics, and changesdomain, subdomain
get_anchorsGet anchor text analysis for backlinks with metrics on referring domains and backlinksquery, searchType, anchor, sort
get_active_backlinksGet a list of active backlinks showing linking pages, target pages, and link attributesquery, searchType, sort, page
get_referring_domainsGet a list of referring domains with domain rank metrics and referring pages countquery, searchType, sort, page
get_lost_backlinksGet a list of lost backlinks showing linking pages, target pages, and deletion datesquery, searchType, sort, page
get_top_pages_by_backlinksGet a list of top pages by backlinks with various filtering and sorting parametersquery, searchType, sort, size
get_top10_anchorsGet TOP-10 anchors with the number of backlinks and referring domainsquery, searchType
get_backlinks_intersectionGet backlinks from domains that link to multiple analyzed sites for competitive analysisquery, intersect, sort, page
get_active_outlinksGet active outbound links from a domain or URL with target URLs and anchor textquery, searchType, sort, filters
get_active_outlink_domainsGet external domains that receive outbound links from analyzed domainquery, searchType, sort, filters
get_threat_backlinksGet malicious backlinks pointing to analyzed domain from sites flagged for security threatsquery, searchType, sort, filters

Project Management Tools

Tool NameDescriptionKey Parameters
create_projectCreate a new project in Serpstat for tracking SEO metrics and site auditsdomain, name, groups
delete_projectDelete an existing project from Serpstat by project IDproject_id
list_projectsRetrieve a list of projects associated with the account with paginationpage, size

Credits & Usage Monitoring Tools

Tool NameDescriptionKey Parameters
get_credits_for_audit_statsCheck available audit credits (one-page audit, JavaScript scanning, crawl limits) No costnone
get_credits_statsCheck API credits usage, account info, and browser plugin limits No costnone

Rank Tracking Tools

Tool NameDescriptionKey Parameters
get_rt_projects_listGet rank tracker projects with ID, name, domain, creation date, and tracking status No costpage, pageSize
get_rt_project_statusCheck if rank tracker project is parsing (true=processing, false=ready) No costprojectId, regionId
get_rt_project_regions_listGet list of regions for a rank tracker project with status, SERP type, device, and location No costprojectId
get_rt_project_keyword_serp_historyGet Google's top-100 SERP history for rank tracker keywords with positions and URLs No costprojectId, projectRegionId, page
get_rt_project_url_serp_historyGet ranking history of URLs for rank tracker keywords with historical position data No costprojectId, projectRegionId, page

Site Audit Tools

Tool NameDescriptionKey Parameters
get_site_audit_settingsGet audit settings for a project including scan parameters, scheduling, and error thresholds No costprojectId
set_site_audit_settingsUpdate audit settings for a project with scan configuration, scheduling, and notifications No costprojectId, mainSettings, ...
start_site_auditStart audit session for a project and receive reportId for tracking progress (1 credit/page, 10 credits/page with JS rendering)projectId
stop_site_auditStop active audit session for a project No costprojectId
get_site_audit_results_by_categoriesGet audit results statistics grouped by issue categories (pages status, meta tags, links, etc.) No costreportId
get_site_audit_historyGet historical error count data for a specific error type across multiple audit reports No costprojectId, errorName, limit, offset
get_site_audits_listGet list of all audit reports for a project with summary statistics and progress information No costprojectId, limit, offset
get_site_audit_scanned_urls_listGet list of URLs that will be scanned based on project scan settings No costprojectId
get_site_audit_project_default_settingsGet default audit settings template to use when creating new projects No cost-
get_site_audit_bref_infoGet essential summary information from latest audit including SDO score, issue counts by priority, scan progress, and completion status No costreportId
get_site_audit_deteailed_reportGet number of errors categorized by type with comparison to previous report showing countAll, countNew, and countFixed No costreportId, compareReportId (optional)
get_site_audit_pages_spec_errorsGet list of all pages where a specific error was detected with filtering by mode (all/new/solved) and pagination support No costreportId, compareReportId, projectId, errorName, mode, limit, offset
get_site_audit_elements_with_issuesGet list of sub-elements (URLs) containing specific errors using CRC from get_site_audit_pages_spec_errors response No costreportId, projectId, errorName, crc, compareReportId (optional), mode, limit, offset

Search Engines (se parameter)

Common search engine codes:

  • g_us - Google USA
  • g_uk - Google United Kingdom
  • g_ca - Google Canada
  • g_au - Google Australia
  • g_de - Germany
  • g_fr - Google France
  • g_es - Google Spain
  • g_it - Google Italy
  • g_pl - Google Poland
  • g_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 -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"

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

  1. Clone the repository:

    git clone git@github.com:SerpstatGlobal/serpstat-mcp-server-js.git
    cd serpstat-mcp-server-js
    
  2. Install dependencies:

    npm install
    
  3. Set environment variables:

    cp .env.example .env
    # Edit .env with your Serpstat API token
    
  4. Build the project:

    npm run build
    
  5. Start the server:

    npm start
    
  6. 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 in dist/)
  • npm start โ€” Run the compiled server from dist/
  • npm run dev โ€” Run the server in development mode with hot-reload
  • npm test โ€” Run all tests
  • npm run lint โ€” Run linting
  • npm 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:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes
  4. Add tests for new functionality
  5. Ensure tests pass: npm test
  6. Commit your changes: git commit -m 'Add amazing feature'
  7. Push to the branch: git push origin feature/amazing-feature
  8. 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 support@serpstat.com.

Acknowledgments

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

Related Servers