Coding agents
MCP server
Connect Claude Code, Codex, Cursor or any MCP client to Logdash, so your coding agent can read your web analytics and build insights for you.
The Logdash MCP server lets your coding agent read your web analytics and save insights to your dashboard. Ask it questions such as "where do signups come from this month?" or "add a funnel from first open to first project, and a weekly cohort table".
The server answers at https://api.logdash.io/mcp over Streamable HTTP. Agents that support sign-in through the browser need no key. Other agents use a personal API key.
Connect your agent
claude mcp add --transport http logdash https://api.logdash.io/mcp # ~/.codex/config.toml
[mcp_servers.logdash]
url = "https://api.logdash.io/mcp"
bearer_token_env_var = "LOGDASH_PERSONAL_KEY" {
"mcpServers": {
"logdash": {
"url": "https://api.logdash.io/mcp",
"headers": { "Authorization": "Bearer ${env:LOGDASH_PERSONAL_KEY}" }
}
}
} Sign in through the browser
On first use, Claude Code opens a Logdash consent page that names the agent and what it asks for: Read your analytics, or Read your analytics and manage your saved insights. Press Approve to connect, or Decline.
- The agent gets a key labelled
MCP (<client>)in your API keys. It reaches every domain you are a member of. - The key expires after 30 days. Then you approve the agent again.
- To disconnect the agent, revoke its key in API keys.
Use a personal API key
For Codex, Cursor and other clients, create a personal API key and keep it in LOGDASH_PERSONAL_KEY. Set Web analytics to Read so the agent can only read, or to Write so it can also save, change and remove insights. Under Access, pick the domains the agent may see.
Tools
The agent calls describe first, to get the IDs of your domains and the names of your events. The other tools take a domain ID, and most take a number of days, cut to the retention of your plan. They return short summaries, never raw events.
| Tool | What it returns |
|---|---|
describe | The domains the key reaches, with their sites, goals, saved insights and retention, and the custom events with their counts and property keys. |
overview | Visits, people, pageviews, bounce rate, session length and conversion against the period before, with the top 5 of every breakdown. |
breakdown | Visits and events by one dimension, such as sources, campaigns, pages or countries. |
person_funnel | How many visitors or signed-in users went through pages and goals in order. |
events_funnel | Event counts for each step, with conversion and drop-off. |
trend | Event counts per day, week or month, for up to 5 series. |
distribution | A histogram of a numeric event property, with its mean and median. |
cohort_table | Cohorts by a date property, with the share of each cohort that sent each later event. |
retention | Retention, daily and monthly active users and comebacks of signed-in users. |
list_insights | The saved insights of the dashboard, in order. |
run_insight | The current result of one saved insight. |
create_insight | Adds an insight to the end of the dashboard, up to 50 per domain. Needs Write. |
update_insight | Replaces the setup of an insight. Needs Write. |
reorder_insights | Sets the order of the insights. Needs Write. |
delete_insight | Removes an insight. Needs Write. |
With Read only, the agent does not see the tools that need Write.
Measure a product loop
Funnels, trends and cohorts count events, so they work for apps that send no user ID. Send each milestone once per install, such as first_open and then first_project, with a cohort property set to the date of the first open. Then ask your agent for a funnel of the milestones and a weekly cohort table. See Insights for more patterns.