The installation and configuration process can be divided into the following key steps:
1. Environmental preparation
- Verify Python version 3.10+: run the
python --versionvalidate (a theory) - Check pip package manager: execute
pip --versionConfirmation of availability
2. Project deployment
- Cloning Warehouse:
git clone https://github.com/googleanalytics/google-analytics-mcp.git - Create a virtual environment:
python3 -m venv venv(Windows/Linux commands are different)
3. Dependency installation
- Run it after activating the environment:
pip install -r requirements.txt
4. Credential configuration
- Create a service account in Google Cloud Console and download the JSON key
- Setting environment variables:
export GOOGLE_APPLICATION_CREDENTIALS="路径/密钥.json"
5. Service activation
- pass (a bill or inspection etc)
pipx runor just runpython -m ga4_mcp_serverStarting services
The connection status can be verified through the test script, and a successful prompt indicates that the configuration is complete.
This answer comes from the articleGoogle Analytics MCP: A Local Server Tool for Connecting GA4 Data to Big ModelsThe
































