Use Mayfly with AI tools (MCP)
Mayfly runs a Model Context Protocol server, so an AI assistant can read a website’s aggregated reports with the same read-only key as the API, and answer questions about them.
Create a key
The MCP server uses the keys from Exports & API. See Create a read key. A key reads one website’s reports and can’t change anything. Create one key per tool, so you can revoke one without the others.
Claude Code
claude mcp add --transport http mayfly https://getmayfly.com/api/mcp \
--header "Authorization: Bearer YOUR_KEY"Replace YOUR_KEY with your key. Add --scope user to use it in every project. Run /mcp in Claude Code to check that mayfly is connected.
Claude Desktop
Claude Desktop starts local servers listed in claude_desktop_config.json (Settings, Developer, Edit Config). Mayfly authenticates with a key in a header, so connect through mcp-remote, an open-source bridge that runs with Node.js:
{
"mcpServers": {
"mayfly": {
"command": "npx",
"args": [
"-y", "mcp-remote", "https://getmayfly.com/api/mcp",
"--header", "Authorization:${MAYFLY_AUTH}"
],
"env": { "MAYFLY_AUTH": "Bearer YOUR_KEY" }
}
}
}Restart Claude Desktop after saving the file.
Cursor
Add the server to ~/.cursor/mcp.json for every project, or to .cursor/mcp.json in one project:
{
"mcpServers": {
"mayfly": {
"url": "https://getmayfly.com/api/mcp",
"headers": { "Authorization": "Bearer YOUR_KEY" }
}
}
}A project file holds the key, so keep it out of version control.
Other clients
Any client that speaks the Streamable HTTP transport can connect: send each JSON-RPC message as a POST to https://getmayfly.com/api/mcp with the Authorization header. The server answers with JSON, never a stream, and keeps no session. It accepts protocol versions 2026-07-28, 2025-11-25, 2025-06-18, 2025-03-26.
Tools
| Tool | Returns |
|---|---|
list_sites | The site this key reads, with its id, timezone and the periods it accepts. |
get_summary | Visitors, pageviews, sessions, bounce rate, visit duration, conversions and revenue, each with its change against the previous equal window. |
get_breakdown | Top pages, entry pages, outbound links, channels, sources, referrers, UTM source, medium and campaign, countries, regions, cities, devices, browsers, operating systems or hostnames. |
get_timeseries | Visitors, pageviews and sessions per hour, day, week or month. |
get_live | Visitors in the last 90 seconds, counted by country and by page. |
get_search_console | Search queries or landing pages from Google Search Console, if it is connected. |
get_web_vitals | Real-user LCP, INP and CLS at the 75th percentile, per page, with sample counts. |
get_goals | Each goal’s completions, unique conversions, conversion rate and revenue. |
get_audit_summary | The latest site audit: pages crawled and each failing rule with affected pages and a fix. |
Tools that report on a period take period (today, yesterday, 24h, 7d, 30d, 90d, 12m) or from and to as dates in the site’s timezone, both included. Every result is compact JSON that states the range it used, the timezone and the units. Visitors are daily uniques, as on the dashboard, and revenue is in minor units, such as cents.
Limits
- Read-only. No tool creates, changes or deletes anything. Goals, audits and the Search Console connection are managed on the dashboard.
- Aggregates only. Tools return the same totals the dashboard shows. The live tool returns counts by country and page. No tool returns an individual visitor, session or identifier.
- One key, one website.
list_sitesreturns the key’s website, and any othersite_idis refused. - The API’s rate limits. Each tool call counts as one request against the website’s 30 a minute, and every message also counts against the API’s per-address limit. A refused call says when to try again.
- No payment reports. The Stripe payment report is available through the read API only.
- No filters. A tool reads the whole website for the period. It can’t narrow to, say, mobile visitors from one country.
- The data’s own limits apply. Search Console lags about three days. A Core Web Vitals metric needs 30 samples before it’s reported. Periods over 92 days read daily rollups, so their visitor counts are approximate.
- A key, not a sign-in. There’s no OAuth. Revoke the key on Exports & API and the client is refused on its next request.
Something here doesn’t match what you see? Write to kirylapps@gmail.com.