cdata-google-analytics-mcp-gateway
A read-only Model Context Protocol (MCP) service enabling large language models (LLMs) to semantically interrogate live Google Analytics information, translating natural language requests into structured data access via the CData JDBC Connector.
Author

CDataSoftware
Quick Info
Actions
Tags
CData Google Analytics Model Context Protocol (MCP) Endpoint
This repository details the deployment of a read-only MCP server designed to interface CData's robust data access technology with generative AI platforms.
:warning: Alternative Access: For comprehensive Data Manipulation Language (DML) operations (Read, Write, Update, Delete) and a streamlined setup experience, explore the free CData MCP Server for Google Analytics (beta).
Core Functionality
This specialized MCP server acts as a proxy layer. It leverages the CData JDBC Driver for Google Analytics to expose live analytics data as a relational schema. This allows AI agents (such as those integrated with Claude Desktop) to query complex datasets using plain English, circumventing the need for explicit SQL composition.
Implementation Workflow
Follow these steps to compile and configure the server component:
-
Source Code Retrieval: bash git clone https://github.com/cdatasoftware/google-analytics-mcp-server-by-cdata.git cd google-analytics-mcp-server-by-cdata
-
Compilation: Build the executable JAR using Maven. bash mvn clean install
The resulting artifact,
CDataMCP-jar-with-dependencies.jar, will be generated. 3. Driver Acquisition: Secure and install the necessary CData JDBC Driver for Google Analytics from: https://www.cdata.com/drivers/ganalytics/download/jdbc 4. Driver Licensing: Activate the driver: * Navigate to the driver's installation directory (e.g.,C:\Program Files\CData\CData JDBC Driver for Google Analytics\on Windows). * Execute the licensing utility:java -jar cdata.jdbc.googleanalytics.jar --license* Provide user details and use "TRIAL" or your valid license key. 5. Data Source Configuration: Establish the connection parameters. * Launch the connection utility:java -jar cdata.jdbc.googleanalytics.jar* Define and test the connection string (OAuth workflows require browser authentication). * Once validated, export the connection string. 6. Protocol Definition File Creation (.prp): Construct a configuration file (e.g.,google-analytics.prp) specifying the server's operational metadata: *Prefix: Identifier used for tool namespace (e.g.,googleanalytics). *ServerName: Logical name for the endpoint. *ServerVersion: Version identifier. *DriverPath: Absolute location of the CData driver JAR. *DriverClass: Fully qualified Java class name of the driver. *JdbcUrl: The connection string obtained in step 5. *Tables: Optional; list specific tables for exposure, or leave empty for full schema access. env 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=
Integrating with AI Clients (e.g., Claude Desktop)
To enable the LLM client to discover and utilize this data gateway, update its configuration file (claude_desktop_config.json):
Configuration Snippet for mcpServers Block:
Windows Pathing:
{ "mcpServers": { "googleanalytics": { "command": "PATH\TO\java.exe", "args": [ "-jar", "PATH\TO\CDataMCP-jar-with-dependencies.jar", "PATH\TO\google-analytics.prp" ] }, ... } }
Linux/Mac Pathing:
{ "mcpServers": { "googleanalytics": { "command": "/PATH/TO/java", "args": [ "-jar", "/PATH/TO/CDataMCP-jar-with-dependencies.jar", "/PATH/TO/google-analytics.prp" ] }, ... } }
After modifying the client configuration, restart the application entirely for the new server definition to load.
Standalone Execution
The server can be initiated directly without an external client application, communicating via standard input/output (stdio):
bash
java -jar /PATH/TO/CDataMCP-jar-with-dependencies.jar /PATH/TO/google-analytics.prp
Interaction Model
Once connected, the AI system automatically accesses the underlying schema. Users interact conversationally rather than writing queries. Examples of supported natural language interactions include: * "Determine the conversion rate trend over the last quarter." * "Aggregate session counts segmented by device category."
Available MCP Tools (Prefix based on .prp file)
{prefix}_get_tables: Fetches a CSV list of accessible data entities.{prefix}_get_columns: Returns a CSV list of fields for a specified table.{prefix}_run_query: Executes raw SQL SELECT statements against the underlying data source.
Troubleshooting Tips
- Visibility Issue: If the server does not appear in the client UI, ensure the client application was fully terminated (check Task Manager/Activity Monitor) and relaunched.
- Connection Failure: Verify the JDBC connection string copied into the
.prpfile is functional using the CData Connection String utility. - Support: For driver or connection issues, contact CData Support Team. For MCP server feedback, utilize the CData Community.
Licensing
This MCP gateway software is distributed under the permissive MIT License. Refer to the included LICENSE file for full terms.
