MCP Ecommerce
Google Analytics logo

Installation guide

How to install Google Analytics MCP Server

In Claude, ChatGPT, Gemini, Microsoft Copilot, Perplexity, Cursor and Claude Code, with what to check before you start and the first prompts to run.

This is a local install. You run Google's open-source `analytics-mcp` server on your own machine with `pipx`, and it reads GA4 through the Google Analytics Admin API and Data API. Authentication uses Google Application Default Credentials (ADC), not a hosted sign-in. The tools cover account and property details, standard, funnel, conversions and realtime reports, and custom dimensions and metrics.

Have a analytics or marketing-ops owner do this, using a Google account (or a service account to impersonate) that already has read access to the GA4 properties in scope. A developer with access to a Google Cloud project will need to enable the two APIs. Keep it read-only: the write tools only appear if you pass `--allow-write`, so leave that flag off until a supervised task needs it.

Google Analytics MCP Server setup guide: Google's MCP documentation page on github.com, shown in a browser frame (analytics MCP server for e-commerce)
Google Analytics MCP Server setup guide preview: Google’s documentation on github.com, captured Nov 27, 2026. The page may have changed since; the link opens the live version.

Before you start

  • A Google Cloud project where you can enable the Google Analytics Admin API and the Google Analytics Data API
  • A Google user (or service account for impersonation) with access to the GA4 accounts or properties you want to query
  • pipx installed, and the gcloud CLI for creating Application Default Credentials
  • An OAuth desktop or web client JSON file if you log in with user credentials (see the vendor's Manage OAuth Clients link)
  • Your Google Cloud project ID, for the GOOGLE_CLOUD_PROJECT setting the README recommends
How it runs
Local, runs on your machine
Access
Read-only
Server address
Copy it from the vendor documentation

Google Analytics MCP Server in Claude

  1. The README does not cover Claude Desktop, so this uses the standard local-server config. Complete the credentials setup first: enable both APIs, then run 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.
  2. Copy the path printed after Credentials saved to file:. You will use it as PATH_TO_CREDENTIALS_JSON.
  3. In Claude Desktop, open Settings > Developer > Edit Config to open claude_desktop_config.json.
  4. Add the analytics-mcp entry from the snippet under mcpServers, replacing PATH_TO_CREDENTIALS_JSON and YOUR_PROJECT_ID.
  5. Do not add --allow-write for now. Fully quit and reopen Claude Desktop.
  6. Start a new chat and run the verify prompts below. The Claude.ai web connector UI takes remote URLs only, so it cannot use this local setup.
claude_desktop_config.json
{
  "mcpServers": {
    "analytics-mcp": {
      "command": "pipx",
      "args": [
        "run",
        "analytics-mcp"
      ],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "PATH_TO_CREDENTIALS_JSON",
        "GOOGLE_CLOUD_PROJECT": "YOUR_PROJECT_ID"
      }
    }
  }
}

Google Analytics MCP Server in ChatGPT

  1. The README does not cover ChatGPT. ChatGPT custom MCP connectors (Developer mode) connect to a remote URL, so the default local pipx setup cannot be added directly.
  2. The README does describe self-hosting over HTTP: pipx run analytics-mcp --transport http --stateless-http --oauth --host 0.0.0.0 --port 8080, with GOOGLE_OAUTH_CLIENT_ID, GOOGLE_OAUTH_CLIENT_SECRET and ANALYTICS_MCP_ISSUER_URL set. It also has a Dockerfile and Cloud Run instructions.
  3. Deploy that service on HTTPS infrastructure you control. Have a developer review the README's multi-tenant section first, including the note that OAuth state is held in process memory.
  4. In ChatGPT, enable Developer mode in the settings and add a custom connector, entering the public URL of your own deployment. Take the exact path from the vendor documentation, because this listing does not state it.
  5. Compatibility of this server with ChatGPT is not confirmed in the docs, so test with a read-only Google account first.
  6. Run the verify prompts below.

Google Analytics MCP Server in Gemini

  1. Gemini is the client the README documents. Install Gemini CLI or Gemini Code Assist, and install pipx.
  2. Enable the Google Analytics Admin API and Google Analytics Data API in your Google Cloud project.
  3. Run gcloud auth application-default login with the https://www.googleapis.com/auth/analytics.readonly scope (and cloud-platform), using either --client-id-file=YOUR_CLIENT_JSON_FILE or --impersonate-service-account=SERVICE_ACCOUNT_EMAIL. Copy the path shown after Credentials saved to file:.
  4. Create or edit ~/.gemini/settings.json and add the analytics-mcp entry from the snippet, replacing PATH_TO_CREDENTIALS_JSON and YOUR_PROJECT_ID.
  5. Leave --allow-write out of args for read-only use.
  6. Launch Gemini CLI or Code Assist and type /mcp. analytics-mcp should be listed.
~/.gemini/settings.json
{
  "mcpServers": {
    "analytics-mcp": {
      "command": "pipx",
      "args": [
        "run",
        "analytics-mcp"
      ],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "PATH_TO_CREDENTIALS_JSON",
        "GOOGLE_CLOUD_PROJECT": "YOUR_PROJECT_ID"
      }
    }
  }
}

Google Analytics MCP Server in Microsoft Copilot

  1. The README does not cover GitHub Copilot or Copilot Studio. For GitHub Copilot in VS Code, use the standard local-server format in .vscode/mcp.json.
  2. Complete the credentials setup first: enable both APIs and run gcloud auth application-default login with the analytics.readonly scope. Note the credentials file path it prints.
  3. Create or open .vscode/mcp.json in your workspace and add the analytics-mcp entry from the snippet, replacing PATH_TO_CREDENTIALS_JSON and YOUR_PROJECT_ID.
  4. Save the file and start the server from the inline control VS Code shows in mcp.json, then open Copilot Chat in agent mode and confirm the tools appear.
  5. Copilot Studio needs a remote endpoint. You would have to self-host the HTTP mode described in the README and follow Microsoft's steps for adding an MCP tool by URL. The docs do not cover that path.
.vscode/mcp.json
{
  "servers": {
    "analytics-mcp": {
      "command": "pipx",
      "args": [
        "run",
        "analytics-mcp"
      ],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "PATH_TO_CREDENTIALS_JSON",
        "GOOGLE_CLOUD_PROJECT": "YOUR_PROJECT_ID"
      }
    }
  }
}

Google Analytics MCP Server in Perplexity

  1. The README does not cover Perplexity, so no tested configuration exists for it.
  2. Complete the credentials setup first: enable both APIs, run gcloud auth application-default login with the analytics.readonly scope, and note the credentials file path.
  3. In the Perplexity desktop app, open the connectors or MCP settings and check whether it can add a local command server. Check Perplexity's own documentation for the current requirements.
  4. If it accepts a local command, use pipx with the arguments run analytics-mcp, and set GOOGLE_APPLICATION_CREDENTIALS and GOOGLE_CLOUD_PROJECT as environment variables.
  5. If it only accepts remote URLs, you would need to self-host the HTTP mode described in the README and enter your own deployment URL.
  6. Run the verify prompts below.

Google Analytics MCP Server in Cursor

  1. The README does not cover Cursor, so this uses Cursor's standard local MCP config.
  2. Enable both Google APIs, then run gcloud auth application-default login with the analytics.readonly scope. Copy the path printed after Credentials saved to file:.
  3. Open Cursor Settings > MCP and add a new server. This opens mcp.json. You can also edit .cursor/mcp.json in a project.
  4. Paste the analytics-mcp entry from the snippet, replacing PATH_TO_CREDENTIALS_JSON and YOUR_PROJECT_ID.
  5. Leave --allow-write out of args for read-only use.
  6. Return to Cursor Settings > MCP, confirm analytics-mcp shows as enabled, then run the verify prompts.
mcp.json
{
  "mcpServers": {
    "analytics-mcp": {
      "command": "pipx",
      "args": [
        "run",
        "analytics-mcp"
      ],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "PATH_TO_CREDENTIALS_JSON",
        "GOOGLE_CLOUD_PROJECT": "YOUR_PROJECT_ID"
      }
    }
  }
}

Google Analytics MCP Server in Claude Code

  1. Install pipx and enable the Google Analytics Admin API and Google Analytics Data API in your Google Cloud project.
  2. Run gcloud auth application-default login with the https://www.googleapis.com/auth/analytics.readonly scope (plus cloud-platform), using --client-id-file=YOUR_CLIENT_JSON_FILE or --impersonate-service-account=SERVICE_ACCOUNT_EMAIL.
  3. Copy the path printed after Credentials saved to file:.
  4. Run the claude mcp add command from the snippet, replacing PATH_TO_CREDENTIALS_JSON and YOUR_PROJECT_ID. The README uses --scope user.
  5. Do not append --allow-write to the command unless you need a supervised write task.
  6. Start claude, run /mcp, and confirm analytics-mcp is connected.
Terminal
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

Check that it works

Start with questions that only read data. If these answer from your real account, the connection is good.

  • Which Google Analytics properties can you see? Use get_account_summaries and list them by account.
  • What are the most popular events in my Google Analytics property in the last 180 days?
  • What are the custom dimensions and custom metrics in my property?

Troubleshooting

+

The server is listed but returns permission or API errors. What should I check?

Confirm the Google Analytics Admin API and Google Analytics Data API are both enabled in the project named in `GOOGLE_CLOUD_PROJECT`. Then check that the credentials belong to a user or service account with access to the GA4 property, and that they include the `analytics.readonly` scope. Re-run the `gcloud auth application-default login` command if you changed scopes.

+

My client does not list analytics-mcp or shows no tools. What now?

Check that `pipx` is on the PATH the client uses, since GUI apps often see a different PATH than your terminal. Confirm the JSON is valid and that `GOOGLE_APPLICATION_CREDENTIALS` points to the file `gcloud` printed. Restart the client fully. In Gemini CLI or Claude Code, run `/mcp` to check status.

+

Why can't I create custom dimensions or key events?

Write tools are off by default. They need the `--allow-write` flag, credentials that include the `https://www.googleapis.com/auth/analytics.edit` scope, and a suitable role on the property (Editor for custom dimensions, Marketer or Editor for key events). Enable them only for supervised tasks. For other problems, see the project's `TROUBLESHOOTING.md`.

Written Nov 27, 2026 from the vendor documentation. Exact menus, addresses and commands change; the official documentation is the source of truth.

Questions and answers

Questions readers and searchers ask about installing Google Analytics MCP Server, answered by the site editor from the vendor documentation, plus reader experience. Every comment is reviewed before it appears.

Ask a question or share what worked

Reviewed before publishing. One link max, no HTML.