npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ai-agent-similarweb-mcp-server

v1.0.0

Published

SimilarWeb MCP Server for website analytics data

Downloads

42

Readme

SimilarWeb MCP Server

A Model Context Protocol (MCP) server that provides access to SimilarWeb website analytics data. This server enables AI agents to fetch website traffic, engagement metrics, demographics, and comprehensive analytics reports.

Features

  • Total Traffic Analysis: Get website visit counts and engagement metrics
  • Page Views Data: Retrieve detailed page view statistics
  • Traffic Sources: Analyze where website traffic originates from
  • Demographics: Access audience gender and age distribution data
  • Comprehensive Reports: Get all analytics data in a single comprehensive report

Prerequisites

Installation

  1. Install dependencies:
cd mcp-servers/similarweb
npm install
  1. Build the server:
npm run build
  1. Set up your API key:
export SIMILARWEB_API_KEY="your-api-key-here"

Configuration

Environment Variables

  • SIMILARWEB_API_KEY (required): Your SimilarWeb API key

Agent Configuration

Add the SimilarWeb MCP server to your agent's configuration:

# agent.yaml
mcpServers:
  - name: similarweb
    url: node ./mcp-servers/similarweb/dist/server.js
    env:
      SIMILARWEB_API_KEY: ${SIMILARWEB_API_KEY}
    required: false

Available Tools

1. similarweb_total_traffic

Get total traffic and engagement metrics for a website.

Parameters:

  • domain (required): Website domain (e.g., "example.com")
  • granularity (optional): Data granularity - "monthly", "weekly", or "daily" (default: "monthly")
  • main_domain_only (optional): Include only main domain data (default: false)

Example:

{
  "domain": "github.com",
  "granularity": "monthly"
}

2. similarweb_page_views

Get total page views for a website.

Parameters:

  • domain (required): Website domain
  • granularity (optional): Data granularity (default: "monthly")
  • main_domain_only (optional): Include only main domain data (default: false)

3. similarweb_traffic_sources

Get traffic sources breakdown for a website.

Parameters:

  • domain (required): Website domain
  • granularity (optional): Data granularity (default: "monthly")
  • main_domain_only (optional): Include only main domain data (default: false)

4. similarweb_demographics

Get demographic data (gender and age) for a website audience.

Parameters:

  • domain (required): Website domain
  • start_date (optional): Start date in YYYY-MM format (default: 8 months ago)
  • end_date (optional): End date in YYYY-MM format (default: 2 months ago)

5. similarweb_comprehensive_analysis

Get comprehensive analytics data including traffic, page views, and demographics.

Parameters:

  • domain (required): Website domain
  • include_demographics (optional): Include demographic data (default: true)
  • include_traffic_sources (optional): Include traffic sources (default: true)

Usage Examples

Basic Traffic Analysis

Get the total traffic data for reddit.com

Comprehensive Analysis

Analyze the website analytics for shopify.com including demographics and traffic sources

Demographics Only

Show me the demographic breakdown for linkedin.com users

Testing

Test the server directly:

# Test tool listing
echo '{"method": "tools/list"}' | node dist/server.js

# Test with environment variable
SIMILARWEB_API_KEY=your-key node dist/server.js

Data Limitations

  • Demographics data: Usually available 2-8 months behind current date
  • Traffic data: May have delays depending on website size and SimilarWeb's data collection
  • API limits: Subject to your SimilarWeb API plan limits

Error Handling

The server provides detailed error messages for:

  • Missing or invalid API keys
  • Invalid domain formats
  • API rate limiting
  • Network connectivity issues
  • Data availability issues

Domain Format

Domains are automatically cleaned and normalized:

  • Removes http:// and https:// prefixes
  • Removes www. prefixes
  • Removes trailing slashes

Examples:

  • https://www.example.com/example.com
  • www.github.comgithub.com

Development

Running in Development Mode

npm run dev

Building

npm run build

Project Structure

src/
├── server.ts           # Main MCP server
├── auth/
│   └── api-manager.ts  # API key management
├── handlers/
│   └── analytics.ts    # SimilarWeb API handlers
└── types/
    └── index.ts        # TypeScript type definitions

License

MIT License

Support

For issues related to this MCP server, please check:

  1. Your SimilarWeb API key is valid and has sufficient quota
  2. The domain you're querying has sufficient traffic data
  3. Your network connection is stable

For SimilarWeb API-specific issues, consult the SimilarWeb API documentation.