mcp-server-google-analytics
Google 애널리틱스 MCP 서버
Google Analytics 4(GA4) 데이터에 액세스하기 위한 MCP 서버 구현으로, Model Context Protocol TypeScript SDK를 사용하여 구축되었습니다.
특징
사용자 정의 가능한 차원으로 페이지 뷰 측정 항목을 가져옵니다.
시간 경과에 따른 활성 및 신규 사용자 추적
특정 이벤트와 해당 메트릭을 분석합니다.
사용자 행동 지표(세션 기간, 이탈률) 모니터링
모든 쿼리에 대해 유연한 날짜 범위 선택 가능
Related MCP server: MCP Search Analytics Server
필수 조건
Node.js 20 이상
Google 애널리틱스 4 속성
Analytics Data API가 활성화된 Google Cloud 프로젝트
적절한 권한이 있는 서비스 계정 자격 증명
설정
Google Cloud 프로젝트를 만들고 Analytics Data API를 활성화하세요.
서비스 계정을 생성하고 자격 증명 JSON 파일을 다운로드합니다.
서비스 계정에 GA4 속성에 대한 적절한 액세스 권한을 부여하세요.
환경 변수 설정:
지엑스피1
설치
Smithery를 통해 설치
Smithery를 통해 Claude Desktop용 Google Analytics Server를 자동으로 설치하는 방법:
npx -y @smithery/cli install mcp-server-google-analytics --client claude수동 설치
pnpm install mcp-server-google-analytics용법
서버 시작
pnpm startClaude Desktop의 구성
Claude Desktop 구성에 다음을 추가하세요.
{
"mcpServers": {
"google-analytics": {
"command": "npx",
"args": ["-y", "mcp-server-google-analytics"],
"env": {
"GOOGLE_CLIENT_EMAIL": "your-service-account@project.iam.gserviceaccount.com",
"GOOGLE_PRIVATE_KEY": "your-private-key",
"GA_PROPERTY_ID": "your-ga4-property-id"
}
}
}
}사용 가능한 기능
getPageViews
특정 날짜 범위에 대한 페이지 뷰 측정 항목을 가져옵니다.
{
"startDate": "2024-01-01",
"endDate": "2024-01-31",
"dimensions": ["page", "country"] // Optional
}getActiveUsers
활성 사용자 지표 가져오기:
{
"startDate": "2024-01-01",
"endDate": "2024-01-31"
}이벤트 가져오기
이벤트 메트릭 가져오기:
{
"startDate": "2024-01-01",
"endDate": "2024-01-31",
"eventName": "purchase" // Optional
}getUserBehavior
사용자 행동 지표 가져오기:
{
"startDate": "2024-01-01",
"endDate": "2024-01-31"
}보안 고려 사항
항상 중요한 자격 증명에 환경 변수를 사용하세요
적절한 CORS 설정 구현
서비스 계정 권한을 설정할 때 최소 권한 원칙을 따르세요.
정기적으로 서비스 계정 자격 증명을 순환합니다.
API 사용을 모니터링하고 필요한 경우 속도 제한을 구현합니다.
기여하다
기여를 환영합니다! 행동 강령과 풀 리퀘스트 제출 절차에 대한 자세한 내용은 기여 가이드를 참조하세요.
특허
이 프로젝트는 MIT 라이선스에 따라 라이선스가 부여되었습니다. 자세한 내용은 라이선스 파일을 참조하세요.
Available Tools
5 toolsgetActiveUsersC
Get active users metrics for a specific date range
| Name | Required | Description | Default |
|---|---|---|---|
| startDate | Yes | Start date in YYYY-MM-DD format | |
| endDate | Yes | End date in YYYY-MM-DD format |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves metrics but doesn't describe what 'active users' entails (e.g., definition of 'active', data format, potential rate limits, or authentication needs). For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior and constraints.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded with the core action and resource, making it easy to parse. Every part of the sentence earns its place by specifying the metrics and date range context.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the lack of annotations and output schema, the description is incomplete for a tool that likely returns complex metrics data. It doesn't explain what 'active users metrics' includes (e.g., counts, trends, or breakdowns), how results are structured, or any limitations. For a metrics retrieval tool with no structured output information, this leaves the agent guessing about return values and usage context.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema description coverage is 100%, with clear descriptions for both parameters ('startDate' and 'endDate') in the input schema. The description adds no additional meaning beyond implying a date range is required, which is already covered by the schema. This meets the baseline of 3 since the schema does the heavy lifting, but the description doesn't enhance parameter understanding further.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb ('Get') and resource ('active users metrics'), specifying the action and target. It distinguishes itself from siblings like 'getEvents' or 'getPageViews' by focusing on user metrics rather than events or views. However, it doesn't explicitly differentiate from 'getUserBehavior' or 'runReport', which might also involve user-related data, leaving some ambiguity.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'getUserBehavior' or 'runReport'. It mentions a date range but doesn't clarify if this is the only way to retrieve user metrics or if there are specific use cases (e.g., monitoring daily activity vs. detailed analysis). Without explicit when/when-not instructions, the agent must infer usage from context.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
getEventsC
Get event metrics for a specific date range
| Name | Required | Description | Default |
|---|---|---|---|
| startDate | Yes | Start date in YYYY-MM-DD format | |
| endDate | Yes | End date in YYYY-MM-DD format | |
| eventName | No | Specific event name to filter by (optional) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It states 'Get event metrics' but doesn't disclose behavioral traits such as whether this is a read-only operation, if it requires authentication, rate limits, pagination, or what the output format looks like (e.g., aggregated metrics vs. raw events). This leaves significant gaps for an agent to understand how to use it effectively.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that front-loads the core action ('Get event metrics') and specifies the key constraint ('for a specific date range'). There is no wasted wording, making it highly concise and well-structured.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of a metrics tool with no annotations and no output schema, the description is incomplete. It doesn't explain what 'event metrics' entail (e.g., counts, averages, trends), how results are returned, or any behavioral context. This leaves the agent with insufficient information to handle the tool robustly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema fully documents the parameters (startDate, endDate, eventName) with their types, formats, and optionality. The description adds no additional meaning beyond implying date-range filtering, which is already covered in the schema. This meets the baseline for high schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb ('Get') and resource ('event metrics') with scope ('for a specific date range'), making the purpose understandable. It doesn't explicitly distinguish from siblings like 'getActiveUsers' or 'getPageViews', but the focus on 'event metrics' provides some implicit differentiation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'getActiveUsers', 'getPageViews', 'getUserBehavior', or 'runReport'. It mentions a date range but doesn't specify if this is the primary tool for event metrics or if other tools might overlap in functionality.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
getPageViewsB
Get page view metrics for a specific date range
| Name | Required | Description | Default |
|---|---|---|---|
| startDate | Yes | Start date in YYYY-MM-DD format | |
| endDate | Yes | End date in YYYY-MM-DD format | |
| dimensions | No | Dimensions to group by (e.g., page, country) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'Get[s] page view metrics,' implying a read-only operation, but doesn't cover aspects like authentication needs, rate limits, error handling, or what the metrics include (e.g., counts, trends). This is a significant gap for a tool with no annotation coverage.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that front-loads the core purpose without unnecessary details. It avoids redundancy and wastes no words, making it highly concise and well-structured for quick understanding.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (3 parameters, no output schema, no annotations), the description is minimally adequate. It covers the basic purpose but lacks details on behavioral traits, usage context, and output format, which are needed for full completeness. Without annotations or output schema, more guidance would be beneficial.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, with clear descriptions for all parameters (e.g., date formats, dimensions grouping). The description adds no additional parameter semantics beyond implying date-range filtering, which is already covered in the schema. This meets the baseline score of 3 when the schema handles most documentation.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose as retrieving 'page view metrics for a specific date range,' which includes a specific verb ('Get') and resource ('page view metrics'). However, it doesn't distinguish this from sibling tools like 'getActiveUsers' or 'getEvents,' which likely retrieve different types of metrics, so it doesn't achieve full differentiation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'getActiveUsers' or 'runReport.' It mentions a 'specific date range' but doesn't specify prerequisites, exclusions, or comparative contexts, leaving the agent to infer usage based on tool names alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
getUserBehaviorB
Get user behavior metrics like session duration and bounce rate
| Name | Required | Description | Default |
|---|---|---|---|
| startDate | Yes | Start date in YYYY-MM-DD format | |
| endDate | Yes | End date in YYYY-MM-DD format |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It implies a read-only operation ('Get') but doesn't specify permissions, rate limits, data freshness, or what happens if date ranges are invalid. For a tool with zero annotation coverage, this is a significant gap in behavioral context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that directly states the tool's purpose with no wasted words. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (2 required parameters) and lack of annotations or output schema, the description is minimally adequate. It covers the basic purpose but lacks details on behavioral traits, usage guidelines, and return values, which are important for an agent to use it correctly without structured metadata.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema description coverage is 100%, with both parameters ('startDate' and 'endDate') documented in the schema. The description doesn't add any parameter-specific details beyond what the schema provides, such as format constraints or usage examples, so it meets the baseline for high schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with a specific verb ('Get') and resource ('user behavior metrics'), and provides examples of metrics like 'session duration and bounce rate'. However, it doesn't explicitly differentiate from sibling tools like 'getActiveUsers' or 'getEvents', which might also retrieve user-related data.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'getActiveUsers', 'getEvents', or 'runReport'. It doesn't mention prerequisites, exclusions, or specific contexts for usage, leaving the agent to infer based on tool names alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
runReportC
Run a report to get analytics data
| Name | Required | Description | Default |
|---|---|---|---|
| startDate | Yes | Start date in YYYY-MM-DD format | |
| endDate | Yes | End date in YYYY-MM-DD format | |
| dimensions | Yes | Dimensions to group by (e.g., page, country) | |
| metrics | Yes | Metrics to include in the report | |
| dimensionFilter | No | Filter for dimensions |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'run a report' which implies a read operation, but fails to disclose critical traits like whether it's safe (non-destructive), requires authentication, has rate limits, or what the output format looks like. This is a significant gap for a tool with multiple parameters.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence with zero waste: 'Run a report to get analytics data'. It's appropriately sized and front-loaded, making it easy to parse quickly.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (5 parameters, nested objects, no output schema) and lack of annotations, the description is incomplete. It doesn't explain what the report returns, how results are structured, or behavioral aspects like safety and performance, leaving the agent with insufficient context for effective use.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema description coverage is 100%, so the input schema already documents all 5 parameters (e.g., startDate, endDate, dimensions, metrics, dimensionFilter) with descriptions. The tool description adds no additional meaning beyond what the schema provides, resulting in a baseline score of 3.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description 'Run a report to get analytics data' states a vague purpose with the verb 'run' and resource 'report', but it lacks specificity about what kind of analytics or how it differs from sibling tools like getActiveUsers or getEvents. It doesn't clearly distinguish itself from alternatives, making it only adequate.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus the sibling tools (getActiveUsers, getEvents, etc.). There's no mention of context, prerequisites, or alternatives, leaving the agent without clear usage instructions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
5 tool updates
- First observed
getActiveUsers - First observed
getEvents - First observed
getPageViews - First observed
getUserBehavior - First observed
runReport
TDQS
Scored across 5 tools
The first four tools have clear distinctions by metric type (active users, events, page views, user behavior), but 'runReport' overlaps significantly with the others as a generic alternative, creating potential confusion for an agent about when to use it versus the specific tools.
Four tools follow a consistent 'getNoun' pattern (e.g., getActiveUsers, getEvents), which is clear and predictable. However, 'runReport' deviates from this pattern with a different verb ('run'), slightly breaking the consistency.
With 5 tools, the count is well-scoped for an analytics server, providing focused coverage without being overwhelming or too sparse. Each tool appears to serve a distinct purpose within the domain.
The tools cover key analytics metrics like users, events, page views, and behavior, which are core to the domain. However, there might be minor gaps, such as missing tools for configuration (e.g., listing properties) or more advanced analytics (e.g., cohort analysis), but agents can likely work around these with the existing tools.
Maintenance
Related MCP Connectors
Read-only Google Analytics 4 MCP server for AI assistants.
Hosted MCP server for GA4, Google Ads and Search Console. Google OAuth, nothing to install.
Read-only Google Search Console MCP server for AI assistants.
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceProvides an interface to access Google Analytics Data API through Model Context Protocol (MCP), allowing users to retrieve reports and realtime data from Google Analytics 4 properties.763 npm7MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that provides unified access to Google Analytics 4 and Google Search Console data through real-time analytics queries.2MIT
- AlicenseNot gradedqualityDmaintenanceA powerful Model Context Protocol (MCP) server that provides comprehensive Google Analytics 4 (GA4), Google Search Console (GSC), and Google Merchant Center (GMC) integration for Claude Desktop and other MCP clients.Apache 2.0
- FlicenseNot gradedqualityDmaintenanceExposes a semantic layer on GA4 event data in BigQuery via an MCP server for consistent querying.3-