MCP server for Fathom Analytics
npm install mcp-fathom-analyticsAn unofficial Model Context Protocol (MCP) server for accessing Fathom Analytics data through an AI assistant. This implementation uses the @mackenly/fathom-api unofficial SDK to interact with the Fathom Analytics API. Not affiliated, endorsed, or supported by Fathom Analytics.
The MCP server provides the following Fathom Analytics tools:
get-account: Retrieve details about your Fathom Analytics accountlist-sites: List all your Fathom Analytics siteslist-events: List events for a specific siteget-aggregation: Generate aggregated analytics reports with flexible filtering and grouping optionsget-current-visitors: Get real-time data about current site visitorsjson
{
"mcpServers": {
"fathom-analytics": {
"command": "npx",
"args": [
"-y",
"mcp-fathom-analytics"
],
"env": {
"FATHOM_API_KEY": "your_api_key_here"
}
}
}
}
`You can find more information about other MCP Clients here: Model Context Protocol Example Clients
API Structure
The MCP server uses the @mackenly/fathom-api SDK to interface with the Fathom Analytics API endpoints:
1. Account API:
https://api.usefathom.com/v1/account
2. Sites API: https://api.usefathom.com/v1/sites
3. Events API: https://api.usefathom.com/v1/sites/SITE_ID/events
4. Aggregation API: https://api.usefathom.com/v1/aggregations
5. Current Visitors API: https://api.usefathom.com/v1/current_visitorsAggregation Examples
The aggregation tool is highly flexible. Here are some example use cases:
1. Daily pageview statistics for the last 30 days:
`json
{
"entity": "pageview",
"entity_id": "SITE_ID",
"aggregates": "pageviews,uniques,visits",
"date_grouping": "day",
"date_from": "2023-08-01 00:00:00"
}
`2. Performance of individual pages:
`json
{
"entity": "pageview",
"entity_id": "SITE_ID",
"aggregates": "pageviews,uniques,avg_duration",
"field_grouping": "pathname",
"sort_by": "pageviews:desc",
"limit": 10
}
`3. Traffic from specific countries:
`json
{
"entity": "pageview",
"entity_id": "SITE_ID",
"aggregates": "visits",
"field_grouping": "country_code",
"sort_by": "visits:desc"
}
``Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.