Skip to main content
← Back to Articles
mcpgoogle-analyticsga4cursorideanalyticssetup2026

Google Analytics MCP Server Cursor IDE Setup (2026): Read-Only GA4 Reports via pipx

Connect Google's official analytics-mcp server to Cursor IDE: pipx install, Application Default Credentials with the analytics.readonly scope, exact mcp.json config, and real GA4 reporting workflows.

By Web MCP GuideAugust 11, 20268 min read


Google Analytics MCP Server Cursor IDE Setup (2026)

How do you set up the Google Analytics MCP server in Cursor? Google publishes an official server, analytics-mcp, that you run with pipx run analytics-mcp and authenticate via Google's Application Default Credentials (ADC), scoped to analytics.readonly. Add one command-based entry to ~/.cursor/mcp.json pointing at pipx, set GOOGLE_APPLICATION_CREDENTIALS and GOOGLE_PROJECT_ID, and Cursor can pull real GA4 reports — traffic sources, conversion rates, audience breakdowns — straight into chat. The server is read-only by design: it can query and report on GA4 data, but it can't change your Analytics configuration.

That read-only constraint is worth knowing upfront if you were expecting to manage GA4 properties or events through this connection — this server is for pulling real numbers into a coding or analysis session, not for administering Analytics itself.

What You Can Do With Google Analytics MCP in Cursor


  • Run GA4 reports — query dimensions and metrics (sessions, conversions, traffic source, device category, and more) without opening the GA4 UI

  • Pull historical and segmented data — compare periods, filter by audience segment, or break down by channel

  • Ground a data-driven feature in real numbers — check actual conversion rates before writing copy or code that references them

  • Cross-reference with app behavior — pull real GA4 event counts while debugging why a tracked event isn't firing as expected

  • Answer ad hoc analytics questions from chat — skip building a one-off report in the GA4 interface for a question you'll only ask once
  • Prerequisites


  • Python 3.9+ and pipx installed

  • A Google Cloud project with the Google Analytics Admin API and Google Analytics Data API enabled

  • A Google account with access to the GA4 property you want to query

  • Cursor IDE with MCP support for local command-based servers
  • Step 1: Enable the Required APIs

    In your Google Cloud project, enable:

  • Google Analytics Admin API

  • Google Analytics Data API
  • Both need to be turned on before the server can authenticate and query successfully — a missing API enablement produces a permission-denied-style error that looks like a credentials problem but isn't.

    Step 2: Set Up Application Default Credentials

    Authenticate with the read-only Analytics scope:

    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
    

    This generates local ADC credentials scoped specifically to read-only Analytics access plus the general Cloud Platform scope the flow needs. Note the path where gcloud writes the resulting credentials file — you'll reference it directly in mcp.json.

    Step 3: Add the Server to mcp.json

    {
      "mcpServers": {
        "analytics-mcp": {
          "command": "pipx",
          "args": ["run", "analytics-mcp"],
          "env": {
            "GOOGLE_APPLICATION_CREDENTIALS": "/path/to/your/adc-credentials.json",
            "GOOGLE_PROJECT_ID": "your-gcp-project-id"
          }
        }
      }
    }
    

    GOOGLE_APPLICATION_CREDENTIALS should point at the actual credentials file path from Step 2, and GOOGLE_PROJECT_ID at the Cloud project where you enabled the two APIs. Both are required — the server won't fall back to an ambient default credential silently.

    Step 4: Restart Cursor and Verify

    Fully quit and reopen Cursor. In chat, try:

    Show me total sessions and conversion rate for the last 30 days from my GA4 property
    

    or

    Break down last week's traffic by source/medium for my main GA4 property
    

    A response with real numbers confirms the connection. If you get an authentication error, re-check that the credentials file path in GOOGLE_APPLICATION_CREDENTIALS is correct and that the account used in Step 2's gcloud auth command actually has viewer-level (or higher) access to the GA4 property in question.

    Practical Workflows

    Ground a launch retro in real numbers

    Pull conversion rate and total sessions for the 7 days before and after last Tuesday's feature launch, so I can see if it moved the needle
    

    Debug a tracking gap

    Show me event counts for "checkout_started" over the last 14 days — I want to check if the drop I'm seeing in the dashboard matches what the API reports
    

    Channel performance check before a copy change

    What's the current conversion rate by traffic source for the pricing page, so I know which channel's users I'm actually writing copy for
    

    Ad hoc question that doesn't need a saved GA4 report

    How many users came from organic search in the last 30 days compared to the previous 30 days?
    

    Troubleshooting

    "Permission denied" even though credentials look correct
    Confirm both the Analytics Admin API and Analytics Data API are enabled in the Cloud project referenced by GOOGLE_PROJECT_ID — a disabled API produces a permission-style error that's easy to mistake for a credentials or scope problem.

    Server starts but returns no data for a property you know has traffic
    Check that the Google account used in the gcloud auth application-default login step actually has access to that specific GA4 property, not just a Google Analytics account in general — GA4 access is granted per-property, and having access to one property doesn't grant access to others in the same organization.

    Credentials file path works in a terminal but not from Cursor
    GOOGLE_APPLICATION_CREDENTIALS in mcp.json needs an absolute path, not a ~-relative one — Cursor's MCP process doesn't necessarily expand ~ the same way your shell does.

    Trying to change a GA4 setting and nothing happens
    This server is read-only by design — it can query and report on data but can't modify Analytics configuration, events, or properties. If you need to change GA4 settings, that still has to happen in the GA4 admin UI directly.

    Frequently Asked Questions

    Q: Can this MCP server change my GA4 configuration, or only read data?
    A: Read-only. It queries dimensions, metrics, and reports, but cannot modify GA4 properties, events, or settings. Any configuration changes still need to happen through the GA4 admin interface.

    Q: Do I need a Google Cloud project specifically, or does a regular Google account work?
    A: You need a Google Cloud project with the Analytics Admin and Data APIs enabled, since authentication runs through Application Default Credentials tied to that project — a Google account alone, without an associated Cloud project and enabled APIs, isn't enough.

    Q: What GA4 access level do I need for the connected account?
    A: Viewer-level access (or higher) to the specific GA4 property you want to query, granted directly on that property — general familiarity with Google Analytics as a product doesn't substitute for per-property access.

    Q: Can I query multiple GA4 properties with one connection?
    A: Yes, as long as the authenticated account has access to each property — which property a given query targets is specified in the prompt or tool call, not fixed at the config level.

    Q: Is analytics-mcp the same as the third-party hosted GA4 MCP servers I've seen referenced elsewhere?
    A: No — analytics-mcp (installed via pipx run analytics-mcp) is Google's own official package, authenticated with your Google Cloud credentials. Third-party hosted alternatives exist with their own setup and trust model; if you're following a config for one of those, don't mix its instructions with the official package's setup above.

    Related Guides


  • PostHog MCP Server: Cursor IDE Setup (2026)

  • Datadog MCP Server: Cursor IDE Setup (2026)

  • How to Authenticate MCP Servers: OAuth & API Keys

  • Best MCP Servers for Developers (2026)
  • ---


    Related guides