Google Analytics MCP Server logo

Google Analytics MCP Server

by Kirill812

A Model Context Protocol (MCP) server that provides access to Google Analytics data through tools and resources. It allows fetching analytics data with flexible filtering options and provides formatted data with insights and recommendations.

View on GitHub

Last updated: N/A

What is Google Analytics MCP Server?

This is a Model Context Protocol (MCP) server designed to provide access to Google Analytics data. It acts as an intermediary, allowing users to retrieve and analyze Google Analytics metrics and dimensions through MCP resources.

How to use Google Analytics MCP Server?

First, clone the repository and install the dependencies using npm install. Then, set up your Google Analytics credentials by creating a service account in Google Cloud Console and adding the credentials to a .env file. Build the project with npm run build and run the server using node build/index.js. Finally, configure your MCP settings to include the server.

Key features of Google Analytics MCP Server

  • Access Google Analytics metrics and dimensions through MCP resources

  • Fetch analytics data with flexible filtering options

  • Get formatted data with insights and recommendations

  • TypeScript implementation with strong typing

Use cases of Google Analytics MCP Server

  • Analyzing website traffic and user behavior

  • Creating custom analytics reports

  • Integrating Google Analytics data with other systems

  • Automating data retrieval and analysis tasks

FAQ from Google Analytics MCP Server

What is MCP?

MCP stands for Model Context Protocol. It is a protocol for accessing data and functionality from different sources.

How do I get my Google Analytics credentials?

You need to create a service account in Google Cloud Console and enable the Google Analytics Data API. Download the service account key (JSON format) and extract the client email and private key.

What is the purpose of the .env file?

The .env file stores your Google Analytics credentials, such as the property ID, client email, and private key. This prevents you from hardcoding sensitive information in your code.

What are the available tools?

The main tool is get_analytics_data, which allows you to retrieve Google Analytics data with various filtering and sorting options.

What are the available resources?

The available resources include analytics://metrics (list of metrics), analytics://dimensions (list of dimensions), and analytics://reports/{reportId} (access specific report data).