semrush cli

Model Context Protocol (MCP)

Connect Claude Desktop, Cursor, and autonomous agents to Semrush operations via stdio.

semrush-cli includes a Model Context Protocol (MCP) server that exposes all research, audit, project, and tracking report operations as native tools for AI agents. Authentication and setup commands are CLI-only operations and are not exposed as MCP tools.

Client configuration

The MCP server communicates exclusively over standard input/output (stdio). Add semrush to your client configuration:

Claude Desktop

In claude_desktop_config.json:

{
  "mcpServers": {
    "semrush": {
      "command": "semrush",
      "args": ["mcp"]
    }
  }
}

If the global semrush executable is not in your client's default system path, provide its absolute path or invoke via npx:

{
  "mcpServers": {
    "semrush": {
      "command": "npx",
      "args": ["-y", "semrush-cli@latest", "mcp"]
    }
  }
}

Tool naming and conventions

Every report command has a direct MCP tool equivalent:

  • Names: Hyphens in CLI verbs become underscores (for example, domain-overview becomes domain_overview, and keyword-magic becomes keyword_magic).
  • Arguments: Argument keys use snake_case (for example, page_size, basket_id, campaign_id).
  • Read tools: Annotated with readOnlyHint: true.
  • Write tools: Annotated with readOnlyHint: false and require confirm: true to execute. Pass dry_run: true to preview mutations without modifying account data.
  • Destructive tools: Annotated with destructiveHint: true for operations that permanently delete data or clear ranking history.

Example read tool invocation:

{
  "name": "keyword_overview",
  "arguments": {
    "keyword": "typescript",
    "database": "us"
  }
}

Example write mutation:

{
  "name": "project_create",
  "arguments": {
    "name": "New Client",
    "domain": "example.com",
    "confirm": true
  }
}

A write call without confirm: true fails immediately before sending network requests.

Request timeouts

Native Semrush report queries can take up to 90 seconds to execute. If your MCP client enforces tool call timeouts, ensure it allows sufficient headroom for browser initialization and long-running queries. Export tasks can take longer.

File exports and resources

Export tools (such as domain_strategy_export, saved_keywords_export, or audit_export_all) return an artifact object with uri, filename, mime_type, and size_bytes:

  1. The client reads exported content using standard MCP resources/read.
  2. File contents are transferred as base64-encoded chunks. Chunks default to 64 KiB (65,536 bytes) and support a maximum chunk size of 1 MiB (1,048,576 bytes).
  3. To read a large file in successive slices, append offset and limit query parameters to the resource URI:
    semrush-export://<export-id>?offset=65536&limit=65536
  4. Continue requesting slices until the total bytes read matches size_bytes.

On this page