Skip to content

Set up the Google Analytics MCP server

Run GA4 standard, funnel, realtime, and conversion reports from your AI client with Google’s analytics-mcp server.

Official · Google

Add it to your client

Before you start

  1. 01

    Prepare your Google OAuth client JSON and use an account with access to the GA4 property.

  2. 02

    Run the command below, replacing YOUR_CLIENT_JSON_FILE with the path to that client JSON.

  3. 03

    Set GOOGLE_APPLICATION_CREDENTIALS to the ADC credentials JSON created by the login, not to the OAuth client JSON.

  4. 04

    Google also recommends setting GOOGLE_CLOUD_PROJECT to your quota project ID alongside the credentials variable.

gcloud auth application-default login \
  --scopes https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/cloud-platform \
  --client-id-file=YOUR_CLIENT_JSON_FILE
  1. 01

    In the AI panel, open Customize › Connections.

  2. 02

    Under Add connection, choose Local command.

  3. 03

    Name the connection Google Analytics. Set the command to pipx and the arguments to run analytics-mcp.

  4. 04

    Add the environment variable GOOGLE_APPLICATION_CREDENTIALS. Replace PATH_TO_CREDENTIALS_JSON with your own value, using the setup above where provided.

  5. 05

    Save the connection, then review the tools it makes available.

What you can do

  • Read account summaries and property details.

  • Run standard GA4 reports.

  • Query funnel and realtime reports.

  • Read conversion reports.

Try asking

“Show the details of this GA4 property.”
“Run a realtime report for this property.”

What it can change

The command shown only reads Google Analytics data. Adding --allow-write and the analytics.edit scope makes write tools available, including property annotations, custom dimensions, and key events.

Browse 6 tools

  • get_account_summaries
  • get_property_details
  • run_reportA GA4 report with dimensions, metrics and filters.
  • run_funnel_report
  • run_realtime_report
  • run_conversions_report

Try Pro free for 14 days

Every new account gets the trial with no card, then moves to Free and keeps its data. For Mac and Windows.