ai-agent-similarweb-mcp-server
v1.0.0
Published
SimilarWeb MCP Server for website analytics data
Downloads
42
Maintainers
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
- Node.js 18 or higher
- SimilarWeb API key (sign up at SimilarWeb Pro)
Installation
- Install dependencies:
cd mcp-servers/similarweb
npm install- Build the server:
npm run build- 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: falseAvailable 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 domaingranularity(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 domaingranularity(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 domainstart_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 domaininclude_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.comComprehensive Analysis
Analyze the website analytics for shopify.com including demographics and traffic sourcesDemographics Only
Show me the demographic breakdown for linkedin.com usersTesting
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.jsData 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://andhttps://prefixes - Removes
www.prefixes - Removes trailing slashes
Examples:
https://www.example.com/→example.comwww.github.com→github.com
Development
Running in Development Mode
npm run devBuilding
npm run buildProject 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 definitionsLicense
MIT License
Support
For issues related to this MCP server, please check:
- Your SimilarWeb API key is valid and has sufficient quota
- The domain you're querying has sufficient traffic data
- Your network connection is stable
For SimilarWeb API-specific issues, consult the SimilarWeb API documentation.
