Google Analytics MCP Server: GA4 Setup With Claude and What It Can Answer for Shopify

Google publishes an official MCP server for Google Analytics 4. It's open source (googleanalytics/google-analytics-mcp on GitHub, analytics-mcp on PyPI), it runs on your own machine or server, and it gives Claude, Gemini-based tools, Cursor or any other MCP client access to the GA4 Data API and Admin API. Out of the box it can only read: it runs standard, funnel, realtime and conversions reports and inspects property settings. Versions 0.8.0 (October 22, 2026) and 1.1.0 (November 6, 2026) added three opt-in write tools, and they stay off unless you start the server with --allow-write.

Google doesn't list a hosted URL to paste into a connector, the way Klaviyo does for its server. You install Python, enable two Google Cloud APIs, sign in with Application Default Credentials and add the server to your client's config. The steps below follow Google's developer guide and the GitHub README as of November 12, 2026.

Watch the 5-minute walkthrough

What the server can do

Tool What it returns Default
get_account_summaries GA accounts and properties your login can see On
get_property_details Settings for one property On
list_google_ads_links Google Ads accounts linked to a property On
list_property_annotations Annotations on a property On
list_key_events Events marked as key events (formerly conversions) On
get_custom_dimensions_and_metrics Custom dimensions and metrics defined on a property On
run_report A standard Data API report On
run_funnel_report A funnel report On
run_conversions_report Ad costs, conversions, ROAS and attribution models On
run_realtime_report A realtime report On
create_property_annotation Adds an annotation Needs --allow-write
create_custom_dimension Adds a custom dimension (Editor role) Needs --allow-write
create_key_event Marks an event as a key event (Marketer or Editor role) Needs --allow-write

Google's developer guide still describes the server as read-only, which matches the default. The write tools are documented in the README and the release notes for 0.8.0 (annotations) and 1.1.0 (custom dimensions and key events).

Set it up in five steps

  1. Install Python 3.10 or newer and either pipx or uv.
  2. In a Google Cloud project, enable the Google Analytics Admin API (analyticsadmin.googleapis.com) and the Google Analytics Data API (analyticsdata.googleapis.com).
  3. In GA4, give the Google account or service account you'll use at least the Viewer role on the property.
  4. Sign in with Application Default Credentials and the read-only scope:
gcloud auth application-default login \
  --scopes="https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/cloud-platform"

The command prints the path of the saved credentials file. Copy it for the next step.

  1. Add the server to your client. For Claude Desktop, put this in claude_desktop_config.json, using the absolute path you copied and your project ID:
{
  "mcpServers": {
    "analytics-mcp": {
      "command": "pipx",
      "args": ["run", "analytics-mcp"],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "PATH_TO_CREDENTIALS_JSON",
        "GOOGLE_CLOUD_PROJECT": "YOUR_PROJECT_ID"
      }
    }
  }
}

For Claude Code, one command registers it:

claude mcp add analytics-mcp --scope user \
  -e GOOGLE_APPLICATION_CREDENTIALS="PATH_TO_CREDENTIALS_JSON" \
  -e GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID" \
  -- pipx run analytics-mcp

Cursor takes a similar block in .cursor/mcp.json, and Google's example there runs the server with uvx. Gemini CLI is marked deprecated in Google's guide, which now shows Antigravity instead. If you'd sooner not use a personal login, a service account with Viewer access works too: point GOOGLE_APPLICATION_CREDENTIALS at its JSON key file, or impersonate it with gcloud.

To share one server across a team, the README describes an HTTP mode (--transport http) in which each person signs in with their own Google account through OAuth, plus a Dockerfile for Cloud Run. That takes a developer to set up; for one analyst, the local setup is enough.

Fixes for the usual setup errors

Google's troubleshooting list covers most first-day problems:

  • 403 PERMISSION_DENIED means one of the two APIs isn't enabled in the project named in GOOGLE_CLOUD_PROJECT, or the login doesn't have Viewer on the property.
  • "Request had insufficient authentication scopes" means the gcloud login ran without the analytics.readonly scope. Run it again with both scopes.
  • 403 ACCESS_NOT_CONFIGURED or a missing quota project means GOOGLE_CLOUD_PROJECT isn't set. Add it to the env block or run gcloud auth application-default set-quota-project YOUR_PROJECT_ID.
  • 401 or "credentials file not found" usually comes from a ~ in the path. Many MCP hosts don't expand it, so use the full path.
  • spawn pipx ENOENT or uvx: command not found happens because desktop apps such as Claude Desktop and Cursor often don't inherit your shell's PATH. Replace pipx with the full path from which pipx.

Questions worth asking for a Shopify store

Shopify's help center adds GA4 to a store through the Google & YouTube sales channel, which installs the Google tag. Once purchase and product events reach GA4, these prompts map onto Data API fields:

  • "Revenue and purchases by default channel group for the last 28 days, compared with the 28 days before." The assistant should call run_report with sessionDefaultChannelGroup, purchaseRevenue and ecommercePurchases.
  • "Top 20 products by item revenue last month, with items purchased." That uses itemName, itemRevenue and itemsPurchased.
  • "Funnel from view_item to add_to_cart to begin_checkout to purchase for mobile versus desktop, last 30 days." That's run_funnel_report.
  • "Which landing pages brought the most first-time purchasers from paid social?" A run_report with a landing page dimension and a channel filter.
  • "How many people are on the site right now, and on which pages?" during a launch or a drop. That's run_realtime_report.

Ask the assistant to print the dimensions and metrics it used. GA4 field names are close enough to plain English that a model can pick a similar field that means something else, such as total revenue in place of purchase revenue.

Quota is rarely an issue for one person. A standard GA4 property gets 200,000 core tokens per day and 40,000 per hour, and Google says most requests use 10 tokens or fewer. An assistant that runs dozens of exploratory reports in a long session can still hit the hourly limit, and run_report can return the current quota if you ask.

What GA4 can't tell you about a Shopify store

The server is only as accurate as the GA4 data behind it. GA4 purchase counts usually fall short of Shopify orders, because consent banners, ad blockers and checkout setups stop some events from firing. Shopify's own help pages say Google Analytics doesn't fire on direct checkouts inside AI channels like Copilot and Google AI Mode, which we covered in our agentic commerce checklist. Subscription renewals that a subscription app bills in the background don't go through the storefront checkout either, so GA4 usually doesn't see them as purchases.

GA4 has no view of margin, product costs, refunds processed weeks later or customer lifetime value. So when you ask "which channel brings customers who come back?", the assistant needs Shopify order history, and "is Meta profitable?" needs ad spend and product costs sitting next to the orders. Our comparisons of GA4 and Triple Whale and of Shopify attribution options go through where each number comes from. If your GA4 setup itself is shaky, start with the GA4 ecommerce setup guide before you connect an assistant to it.

Should you turn on the write tools?

The three write tools change property settings, not data. Annotations are low risk. A new key event changes what your reports count as a conversion from that day on, and it can reach Google Ads if you import key events there. GA4 also caps how many custom dimensions a property can have, so a stray one takes up a slot. If you enable --allow-write, the login also needs the analytics.edit scope, and you'll want your client to ask before each write call. Our post on approval-gated AI agents describes that pattern in more detail.

When GA4 isn't the whole answer

The GA MCP server is a good fit for traffic, funnel and on-site behavior questions. For questions that mix GA4 with Shopify orders, ad spend and email, Finsi MCP gives Claude or ChatGPT one read-only, logged set of numbers that already includes Google Analytics next to the rest of your stack. Finsi's AI agents can then act on those numbers, with approval before every change. For other servers in the same space, see our guides to the Klaviyo MCP server, Shopify's MCP servers, the Meta Ads MCP server and the Google Ads MCP server.

Sources