Configuration

Enable MCP

Connect an AI assistant to your self-hosted Umami analytics using the Model Context Protocol.

Model Context Protocol (MCP) lets AI tools such as Claude, ChatGPT, and Cursor answer questions about your website traffic in natural language.

Umami's MCP server is read-only. It calls the same API as the dashboard, so it respects the API key owner's existing website and team permissions. It never accesses your database directly.

Turn on the MCP endpoint#

MCP is disabled by default. Use a version of Umami that includes MCP support, then add the following runtime environment variable to your deployment configuration:

Restart Umami after changing the variable. For Docker Compose deployments, add it to the umami service environment and run docker compose up -d to recreate the container.

Connect#

Create an API key from your profile menu: select Settings, open API keys, and click Create key. Save the value when it is shown; it is only displayed once.

Your MCP endpoint is the public URL of your Umami instance followed by /mcp:

If your instance uses a base path, include it in the endpoint, for example https://analytics.example.com/umami/mcp.

Authenticate with the API key using the Bearer scheme:

The remote MCP endpoint accepts self-hosted API keys only; browser login tokens are not supported.

Client setup#

Use an MCP client that supports Streamable HTTP and bearer-token or custom-header authentication. For example, configure a remote server with your endpoint and API key:

The exact configuration screen and format vary by client. Keep the API key private: the analytics returned by MCP are shared with the AI application to answer your questions.

Local stdio clients#

For a client that only supports local stdio servers, run the @umami/mcp package with npx:

This configuration connects to Umami's API rather than the remote /mcp endpoint. Do not include /api in UMAMI_URL.

Tools#

ToolPurpose
list_websitesFind the websites you can access. Call this first to get a websiteId.
get_website_daterangeEarliest and latest dates with recorded data.
get_website_statsPageviews, visitors, visits, bounce rate, duration, and previous period.
get_website_trafficPageview and visit time series by minute, hour, day, month, or year.
get_website_metricsTop pages, referrers, channels, countries, browsers, devices, UTM, and events.
get_realtimeVisitors active right now.
get_eventsIndividual tracked events.
get_event_statsCustom event totals and previous period.
get_event_seriesCustom event counts over time, grouped by event name.
get_event_propertiesCustom event property names, or the values of one property.
get_sessionsVisitor sessions.
get_sessionOne session with its activity timeline and properties.
get_session_statsSession-level totals: visitors, visits, pageviews, events, and countries.
get_annotationsDated timeline notes that explain changes.
list_segmentsSaved segments and cohorts.
list_funnelsSaved funnels with their steps.
run_funnelConversion funnel from a saved funnel or ad-hoc page and event steps.
get_goalsSaved goals with conversions, visitors, and rate for a date range.
run_journeyMost common paths visitors take.
run_retentionCohort retention table.
run_attributionFirst-click or last-click attribution for a conversion.
get_revenueRevenue totals, series, and breakdowns.
get_performanceCore Web Vitals percentiles, trend, and breakdown.

Dates use ISO 8601. Results that return individual events or sessions are paginated and have a maximum page size.

Example prompts#

  • Show my websites.
  • How many visitors did example.com get last week?
  • What were the top 10 pages this month?
  • Compare traffic this month with the previous month.
  • Where is traffic coming from?
  • What signup events occurred yesterday?
  • Run my checkout funnel for last month.
  • How are we doing against our goals this quarter?
  • Which pages have the worst LCP on mobile?

Revoke access#

Access is tied to the API key. Delete that key under Settings → API keys to disconnect the AI tool.