home / mcp / google analytics mcp server

Google Analytics MCP Server

This read-only MCP Server allows you to connect to Google Analytics data from Claude Desktop through CData JDBC Drivers. For full CRUD support, check out the first managed MCP platform: CData Connect AI (https://www.cdata.com/ai/).

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "cdatasoftware-google-analytics-mcp-server-by-cdata": {
      "command": "java",
      "args": [
        "-jar",
        "CDataMCP-jar-with-dependencies.jar",
        "/PATH/TO/google-analytics.prp"
      ]
    }
  }
}

You can run a local, read-only MCP Server that exposes Google Analytics data via live queries. This setup lets you ask natural language questions and receive up-to-date insights without writing SQL, while keeping the data access self-contained on your machine.

How to use

You connect to the Google Analytics MCP Server through a client that supports MCP, such as Claude Desktop. Once configured, you can ask questions like “What is the latest user engagement trend for the last 30 days?” or “Show me open events in the calendar for today.” The server presents Google Analytics data as familiar relational models, so you can query tables and columns as if they were local databases. Use the built-in tools to list available tables, inspect columns, and run read-only queries. You do not need to write SQL; your client translates your natural language requests into the appropriate MCP tool calls.

Practical usage patterns include: - Discover available data by listing tables and columns - Retrieve live analytics facts such as sessions, page views, or event counts - Ask questions that combine dimensions like date, country, and device to understand user behavior over time.

How to install

Prerequisites you need before starting: - Java Runtime Environment (JRE) or a JDK compatible with running the MCP server JAR - Maven for building the MCP server (optional if you use a prebuilt JAR) - A licensed or trial CData JDBC Driver for Google Analytics to connect to GA data locally (driver installation and license steps shown in the setup flow)

1) Build the MCP server (if you are starting from source): `` mvn clean install `` This produces the runtime JAR named CDataMCP-jar-with-dependencies.jar

2) Obtain and license the CData JDBC Driver for Google Analytics. This enables the local data connection. Install the driver per the driver package you download, then license it by running: `` java -jar cdata.jdbc.googleanalytics.jar --license `` Provide your name, email, and a license key (or trial key) when prompted.

3) Configure the GA connection and generate a connection string. Run the driver once to open the Connection String utility, test the connection, then copy the resulting JDBC URL for use in a .prp file. If OAuth is required, complete the browser authentication as part of the test.

4) Create a .prp file for the MCP connection (for example google-analytics.prp) and populate it with the required fields to connect the MCP Server to Google Analytics via the JDBC driver. The file should resemble the following structure (fill in real paths and values): `` Prefix=googleanalytics ServerName=CDataGoogleAnalytics ServerVersion=1.0 DriverPath=PATH\TO\cdata.jdbc.googleanalytics.jar DriverClass=cdata.jdbc.googleanalytics.GoogleAnalyticsDriver JdbcUrl=jdbc:googleanalytics:InitiateOAuth=GETANDREFRESH; Tables= `` Save this file as google-analytics.prp in a known location.

5) Start the MCP Server locally using the standard Java command with the JAR and the .prp file. The following is the exact form shown for running the server with a PRP configuration: `` java -jar /PATH/TO/CDataMCP-jar-with-dependencies.jar /PATH/TO/google-analytics.prp `` Note that this server runs over stdio, so it is meant to be used with a client on the same machine.

Additional content

Configuration notes: - The MCP Server you run is read-only by design, allowing safe querying of live Google Analytics data. - If you use OAuth for authentication, you will need to complete browser-based authentication during the JDBC connection test. - The MCP server is intended for local hosting with a straightforward setup that translates natural language questions into data queries without requiring you to write SQL.

Security and access: - Run the MCP server on a trusted machine and limit access to the local network to prevent unauthorized access to the JDBC driver and credentials. - Keep the google-analytics.prp and any credentials in a secure location and implement proper file permissions.

Tools and endpoints

The server exposes three read-only tools to interact with the Google Analytics data. Each tool returns results in CSV format where applicable. You can use these tools to inspect tables, examine columns, and run read-only queries against the GA data.

Available tools

ga_analytics_get_tables

Retrieves a list of tables available in the data source. The output is CSV with the first line containing column headers.

ga_analytics_get_columns

Retrieves a list of columns for a given table. The output is CSV with the first line containing column headers.

ga_analytics_run_query

Executes a SQL SELECT query against the exposed GA data.