[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-72603":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":8,"htmlUrl":8,"language":9,"languages":8,"totalLinesOfCode":8,"stars":10,"forks":11,"watchers":12,"openIssues":13,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":15,"stars7d":16,"stars30d":17,"stars90d":14,"forks30d":14,"starsTrendScore":18,"compositeScore":19,"rankGlobal":8,"rankLanguage":8,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":21,"hasPages":21,"topics":23,"createdAt":8,"pushedAt":8,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":14,"starSnapshotCount":14,"syncStatus":27,"lastSyncTime":28,"discoverSource":29},72603,"google-analytics-mcp","googleanalytics\u002Fgoogle-analytics-mcp","googleanalytics",null,"Python",2355,524,64,7,0,35,103,305,105,107.16,"Apache License 2.0",false,"main",[],"2026-06-12 04:01:06","# Google Analytics MCP Server (Experimental)\n\n[![PyPI version](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fanalytics-mcp.svg)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fanalytics-mcp\u002F)\n[![Python 3.10+](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fpython-3.10+-blue.svg)](https:\u002F\u002Fwww.python.org\u002Fdownloads\u002F)\n[![GitHub branch check runs](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fcheck-runs\u002Fgoogleanalytics\u002Fgoogle-analytics-mcp\u002Fmain)](https:\u002F\u002Fgithub.com\u002Fgoogleanalytics\u002Fgoogle-analytics-mcp\u002Factions?query=branch%3Amain++)\n[![PyPI - Downloads](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fdm\u002Fanalytics-mcp)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fanalytics-mcp\u002F)\n[![GitHub stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fgoogleanalytics\u002Fgoogle-analytics-mcp?style=social)](https:\u002F\u002Fgithub.com\u002Fgoogleanalytics\u002Fgoogle-analytics-mcp\u002Fstargazers)\n[![GitHub forks](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fforks\u002Fgoogleanalytics\u002Fgoogle-analytics-mcp?style=social)](https:\u002F\u002Fgithub.com\u002Fgoogleanalytics\u002Fgoogle-analytics-mcp\u002Fnetwork\u002Fmembers)\n[![YouTube Video Views](https:\u002F\u002Fimg.shields.io\u002Fyoutube\u002Fviews\u002FPT4wGPxWiRQ)](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=PT4wGPxWiRQ)\n\nThis repo contains the source code for running a local\n[MCP](https:\u002F\u002Fmodelcontextprotocol.io) server that interacts with APIs for\n[Google Analytics](https:\u002F\u002Fsupport.google.com\u002Fanalytics).\n\nJoin the discussion and ask questions in the\n[🤖-analytics-mcp channel](https:\u002F\u002Fdiscord.com\u002Fchannels\u002F971845904002871346\u002F1398002598665257060)\non Discord.\n\n## Tools 🛠️\n\nThe server uses the\n[Google Analytics Admin API](https:\u002F\u002Fdevelopers.google.com\u002Fanalytics\u002Fdevguides\u002Fconfig\u002Fadmin\u002Fv1)\nand\n[Google Analytics Data API](https:\u002F\u002Fdevelopers.google.com\u002Fanalytics\u002Fdevguides\u002Freporting\u002Fdata\u002Fv1)\nto provide several\n[Tools](https:\u002F\u002Fmodelcontextprotocol.io\u002Fdocs\u002Fconcepts\u002Ftools) for use with LLMs.\n\n### Retrieve account and property information 🟠\n\n- `get_account_summaries`: Retrieves information about the user's Google\n  Analytics accounts and properties.\n- `get_property_details`: Returns details about a property.\n- `list_google_ads_links`: Returns a list of links to Google Ads accounts for\n  a property.\n\n### Run core reports 📙\n\n- `run_report`: Runs a Google Analytics report using the Data API.\n- `run_funnel_report`: Runs a Google Analytics funnel report using the Data API.\n- `get_custom_dimensions_and_metrics`: Retrieves the custom dimensions and\n  metrics for a specific property.\n\n### Run realtime reports ⏳\n\n- `run_realtime_report`: Runs a Google Analytics realtime report using the\n  Data API.\n\n## Setup instructions 🔧\n\n✨ Watch the [Google Analytics MCP Setup\nTutorial](https:\u002F\u002Fyoutu.be\u002FnS8HLdwmVlY) on YouTube for a step-by-step\nwalkthrough of these instructions.\n\n[![Watch the video](https:\u002F\u002Fimg.youtube.com\u002Fvi\u002FnS8HLdwmVlY\u002Fmqdefault.jpg)](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=nS8HLdwmVlY)\n\nSetup involves the following steps:\n\n1.  Configure Python.\n1.  Configure credentials for Google Analytics.\n1.  Configure Gemini.\n\n### Configure Python 🐍\n\n[Install pipx](https:\u002F\u002Fpipx.pypa.io\u002Fstable\u002F#install-pipx).\n\n### Enable APIs in your project ✅\n\n[Follow the instructions](https:\u002F\u002Fsupport.google.com\u002Fgoogleapi\u002Fanswer\u002F6158841)\nto enable the following APIs in your Google Cloud project:\n\n- [Google Analytics Admin API](https:\u002F\u002Fconsole.cloud.google.com\u002Fapis\u002Flibrary\u002Fanalyticsadmin.googleapis.com)\n- [Google Analytics Data API](https:\u002F\u002Fconsole.cloud.google.com\u002Fapis\u002Flibrary\u002Fanalyticsdata.googleapis.com)\n\n### Configure credentials 🔑\n\nConfigure your [Application Default Credentials\n(ADC)](https:\u002F\u002Fcloud.google.com\u002Fdocs\u002Fauthentication\u002Fprovide-credentials-adc).\nMake sure the credentials are for a user with access to your Google Analytics\naccounts or properties.\n\nCredentials must include the Google Analytics read-only scope:\n\n```\nhttps:\u002F\u002Fwww.googleapis.com\u002Fauth\u002Fanalytics.readonly\n```\n\nCheck out\n[Manage OAuth Clients](https:\u002F\u002Fsupport.google.com\u002Fcloud\u002Fanswer\u002F15549257)\nfor how to create an OAuth client.\n\nHere are some sample `gcloud` commands you might find useful:\n\n- Set up ADC using user credentials and an OAuth desktop or web client after\n  downloading the client JSON to `YOUR_CLIENT_JSON_FILE`.\n\n  ```shell\n  gcloud auth application-default login \\\n    --scopes https:\u002F\u002Fwww.googleapis.com\u002Fauth\u002Fanalytics.readonly,https:\u002F\u002Fwww.googleapis.com\u002Fauth\u002Fcloud-platform \\\n    --client-id-file=YOUR_CLIENT_JSON_FILE\n  ```\n\n- Set up ADC using service account impersonation.\n\n  ```shell\n  gcloud auth application-default login \\\n    --impersonate-service-account=SERVICE_ACCOUNT_EMAIL \\\n    --scopes=https:\u002F\u002Fwww.googleapis.com\u002Fauth\u002Fanalytics.readonly,https:\u002F\u002Fwww.googleapis.com\u002Fauth\u002Fcloud-platform\n  ```\n\nWhen the `gcloud auth application-default` command completes, copy the\n`PATH_TO_CREDENTIALS_JSON` file location printed to the console in the\nfollowing message. You'll need this for the next step!\n\n```\nCredentials saved to file: [PATH_TO_CREDENTIALS_JSON]\n```\n\n### Configure Gemini\n\n1.  Install [Gemini\n    CLI](https:\u002F\u002Fgithub.com\u002Fgoogle-gemini\u002Fgemini-cli\u002Fblob\u002Fmain\u002Fdocs\u002Fget-started\u002Finstallation.md)\n    or [Gemini Code\n    Assist](https:\u002F\u002Fmarketplace.visualstudio.com\u002Fitems?itemName=Google.geminicodeassist).\n\n1.  Create or edit the file at `~\u002F.gemini\u002Fsettings.json`, adding your server\n    to the `mcpServers` list.\n\n    Replace `PATH_TO_CREDENTIALS_JSON` with the path you copied in the previous\n    step.\n\n    We also recommend that you add a `GOOGLE_CLOUD_PROJECT` attribute to the\n    `env` object. Replace `YOUR_PROJECT_ID` in the following example with the\n    [project ID](https:\u002F\u002Fsupport.google.com\u002Fgoogleapi\u002Fanswer\u002F7014113) of your\n    Google Cloud project.\n\n    ```json\n    {\n      \"mcpServers\": {\n        \"analytics-mcp\": {\n          \"command\": \"pipx\",\n          \"args\": [\"run\", \"analytics-mcp\"],\n          \"env\": {\n            \"GOOGLE_APPLICATION_CREDENTIALS\": \"PATH_TO_CREDENTIALS_JSON\",\n            \"GOOGLE_PROJECT_ID\": \"YOUR_PROJECT_ID\"\n          }\n        }\n      }\n    }\n    ```\n\n## Try it out 🥼\n\nLaunch Gemini Code Assist or Gemini CLI and type `\u002Fmcp`. You should see\n`analytics-mcp` listed in the results.\n\nHere are some sample prompts to get you started:\n\n- Ask what the server can do:\n\n  ```\n  what can the analytics-mcp server do?\n  ```\n\n- Ask about a Google Analytics property\n\n  ```\n  Give me details about my Google Analytics property with 'xyz' in the name\n  ```\n\n- Prompt for analysis:\n\n  ```\n  what are the most popular events in my Google Analytics property in the last 180 days?\n  ```\n\n- Ask about signed-in users:\n\n  ```\n  were most of my users in the last 6 months logged in?\n  ```\n\n- Ask about property configuration:\n\n  ```\n  what are the custom dimensions and custom metrics in my property?\n  ```\n\n## Contributing ✨\n\nContributions welcome! See the [Contributing Guide](CONTRIBUTING.md).\n","该项目提供了一个本地MCP服务器的源代码，用于与Google Analytics的API进行交互。它基于Python语言开发，支持Python 3.10及以上版本，并通过使用Google Analytics Admin API和Data API实现了多种工具功能，包括获取账户和属性信息、运行核心报告及实时报告等。特别地，用户可以利用这些工具轻松检索自定义维度和指标，生成漏斗分析报告等。适用于需要对网站或应用的数据进行深入分析和监控的场景，如营销策略评估、用户体验优化等领域。项目采用Apache License 2.0许可协议发布，社区活跃度高。",2,"2026-06-11 03:42:44","high_star"]