- Explore MCP Servers
- mcp-ga4
Mcp Ga4
What is Mcp Ga4
mcp-ga4 is a Model Context Protocol (MCP) server designed to retrieve information from Google Analytics 4 (GA4) cloud server. It integrates seamlessly with Claude desktop, providing valuable business intelligence insights based on user data.
Use cases
Use cases for mcp-ga4 include generating detailed reports for marketing campaigns, analyzing user engagement in e-commerce platforms, comparing performance metrics over different periods, and providing real-time insights for decision-making.
How to use
To use mcp-ga4, first initialize the project by cloning the repository and navigating to the project folder. Then, create a virtual environment and activate it. Install the necessary dependencies and set up your Google account credentials by downloading the JSON file and configuring the environment variables accordingly.
Key features
Key features of mcp-ga4 include tools to retrieve GA4 reports based on specific metrics and dimensions, real-time reporting, comparative reporting for different time periods, ranking reports based on specified metrics, and listing all available GA4 properties and accounts.
Where to use
mcp-ga4 can be used in various fields where data analytics and business intelligence are crucial, including marketing, e-commerce, web development, and any organization that utilizes Google Analytics for tracking user behavior and performance metrics.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Mcp Ga4
mcp-ga4 is a Model Context Protocol (MCP) server designed to retrieve information from Google Analytics 4 (GA4) cloud server. It integrates seamlessly with Claude desktop, providing valuable business intelligence insights based on user data.
Use cases
Use cases for mcp-ga4 include generating detailed reports for marketing campaigns, analyzing user engagement in e-commerce platforms, comparing performance metrics over different periods, and providing real-time insights for decision-making.
How to use
To use mcp-ga4, first initialize the project by cloning the repository and navigating to the project folder. Then, create a virtual environment and activate it. Install the necessary dependencies and set up your Google account credentials by downloading the JSON file and configuring the environment variables accordingly.
Key features
Key features of mcp-ga4 include tools to retrieve GA4 reports based on specific metrics and dimensions, real-time reporting, comparative reporting for different time periods, ranking reports based on specified metrics, and listing all available GA4 properties and accounts.
Where to use
mcp-ga4 can be used in various fields where data analytics and business intelligence are crucial, including marketing, e-commerce, web development, and any organization that utilizes Google Analytics for tracking user behavior and performance metrics.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
MCP Server For Google Analytics 4
This is a Model Context Protocol (MCP) server with tools to retrieve information from Google analytics 4 cloud server. It integrates easily with claude desktop and gives helpful business intelligence feedback based on your data
Setup Steps
-
Initialize the project
launch CMD where you want to keep your project, and clone the repo, enter project folder
git clone https://github.com/smacient/mcp-ga4.git
cd mcp-ga4
-
Create virtual environment and activate it
uv venv .venv\Scripts\activate
-
Install dependencies:
uv sync
-
Setup environment
-
set up your goggle account credentials and download the json file. rename it credentials.json
-
create a
.env
file inside thelocalserver
folder -
add the correct path to your google credentials in the env file
GOOGLE_APPLICATION_CREDENTIALS="C:\\Users\\path to\\credentials.json"
Features
The server implements the following features:
Tools
get_report
: retrieve your GA4 report based on required metrics, dimension and timeframe and give a detailed summary and insight based on the dataget_realtime_report
: retrieve your GA4 report realtime report based on required metrics, dimension and timeframe and give a detailed summary and insight based on the datacompare_report_metrics
: retrieve your GA4 report for two periods based on required metrics, dimension and give a comparative report and insight based on the dataget_report_with_order
: retrieve your GA4 report report based on required metrics, dimension and timeframe, rank it based on specified metrics and give a detailed summary and insight based on the datalist_all_properties
: retrieve your GA4 properties available in the current userlist_all_accounts
: retrieve your GA4 account information, which it uses to get other information
Running the Server
To run on terminal
To run the server with the MCP Inspector for development:
uv run mcp dev localserver/ga4_server.py
To run the with openai client:
update the .env
GOOGLE_APPLICATION_CREDENTIALS="C:\\Users\\`path to`\\credentials.json" OPENAI_API_KEY="add your openai api key"
run command
uv run localserver/openai_client.py
To run the with gemini client:
update the .env
GOOGLE_APPLICATION_CREDENTIALS="C:\\Users\\`path to`\\credentials.json" GEMINI_API_KEY="add your gemini api key"
run command
uv run localserver/gemini_client.py
To run on Claude desktop
To install the server in Claude desktop app:
uv run mcp install localserver/ga4_server.py
Set up the configuration properly
- go to claude desktop.
- click settings, go to developer and click on edit config
- open the config file with sublime text
- add the env section as the one shown below.
- edit the claude configuration file to look like the one below. add the paths needed. remove
path to
and add the correct path
{
"mcpServers": {
"Google Analytics 4": {
"command": "uv",
"args": [
"run",
"--with",
"mcp[cli]",
"mcp",
"run",
"C:\\Users\\`path to`\\Gemini-Agent-MCP\\src\\gemini_server_sample.py"
],
"env": {
"VIRTUAL_ENV": "C:\\Users\\`path to`\\Gemini-Agent-MCPmcp_ga4\\.venv",
"PATH": "C:\\Users\\`path to`\\Gemini-Agent-MCP\\.venv\\Scripts;${PATH}",
"GOOGLE_APPLICATION_CREDENTIALS": "C:\\Users\\`path to`\\credentials.json"
}
}
}
}
End claude in task manager and restart it. Your tools will be visible on the chat interface.
Ask Claude to get your GA4 information and accept the popup permit to use the tools required.
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.