Google Analytics MCP Server
OfficialGoogle Analytics MCP サーバー (実験的)
このリポジトリには、Google Analytics の API と対話するローカルの MCP サーバーを実行するためのソースコードが含まれています。
Discord の 🤖-analytics-mcp チャンネル で議論に参加したり、質問したりできます。
ツール 🛠️
このサーバーは Google Analytics Admin API および Google Analytics Data API を使用して、LLM で使用するためのいくつかの ツール を提供します。
アカウントとプロパティ情報の取得 🟠
get_account_summaries: ユーザーの Google Analytics アカウントとプロパティに関する情報を取得します。get_property_details: プロパティの詳細を返します。list_google_ads_links: プロパティの Google 広告アカウントへのリンクのリストを返します。
コアレポートの実行 📙
run_report: Data API を使用して Google Analytics レポートを実行します。run_funnel_report: Data API を使用して Google Analytics ファネルレポートを実行します。get_custom_dimensions_and_metrics: 特定のプロパティのカスタムディメンションと指標を取得します。
リアルタイムレポートの実行 ⏳
run_realtime_report: Data API を使用して Google Analytics リアルタイムレポートを実行します。
Related MCP server: Google Analytics MCP Server
セットアップ手順 🔧
✨ YouTube の Google Analytics MCP セットアップチュートリアル で、これらの手順のステップバイステップの解説をご覧ください。

セットアップには以下の手順が含まれます。
Python の設定。
Google Analytics の認証情報の設定。
Gemini の設定。
Python の設定 🐍
pipx をインストール してください。
プロジェクトで API を有効にする ✅
手順に従って、Google Cloud プロジェクトで以下の API を有効にします。
認証情報の設定 🔑
アプリケーションのデフォルト認証情報 (ADC) を設定します。認証情報が、Google Analytics アカウントまたはプロパティへのアクセス権を持つユーザーのものであることを確認してください。
認証情報には、Google Analytics の読み取り専用スコープが含まれている必要があります。
https://www.googleapis.com/auth/analytics.readonlyOAuth クライアントの作成方法については、OAuth クライアントの管理 を確認してください。
役立つ可能性のある gcloud コマンドの例をいくつか紹介します。
クライアント JSON を
YOUR_CLIENT_JSON_FILEにダウンロードした後、ユーザー認証情報と OAuth デスクトップまたは Web クライアントを使用して ADC を設定します。gcloud auth application-default login \ --scopes https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/cloud-platform \ --client-id-file=YOUR_CLIENT_JSON_FILEサービスアカウントのなりすましを使用して ADC を設定します。
gcloud auth application-default login \ --impersonate-service-account=SERVICE_ACCOUNT_EMAIL \ --scopes=https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/cloud-platform
gcloud auth application-default コマンドが完了したら、コンソールに表示された PATH_TO_CREDENTIALS_JSON ファイルの場所をコピーします。次のステップでこれが必要になります!
Credentials saved to file: [PATH_TO_CREDENTIALS_JSON]Gemini の設定
Gemini CLI または Gemini Code Assist をインストールします。
~/.gemini/settings.jsonファイルを作成または編集し、mcpServersリストにサーバーを追加します。PATH_TO_CREDENTIALS_JSONを、前のステップでコピーしたパスに置き換えてください。また、
envオブジェクトにGOOGLE_CLOUD_PROJECT属性を追加することをお勧めします。以下の例のYOUR_PROJECT_IDを、Google Cloud プロジェクトの プロジェクト ID に置き換えてください。{ "mcpServers": { "analytics-mcp": { "command": "pipx", "args": ["run", "analytics-mcp"], "env": { "GOOGLE_APPLICATION_CREDENTIALS": "PATH_TO_CREDENTIALS_JSON", "GOOGLE_PROJECT_ID": "YOUR_PROJECT_ID" } } } }
試してみる 🥼
Gemini Code Assist または Gemini CLI を起動し、/mcp と入力します。結果に analytics-mcp が表示されるはずです。
開始するためのサンプルプロンプトをいくつか紹介します。
サーバーで何ができるか尋ねる:
what can the analytics-mcp server do?Google Analytics プロパティについて尋ねる
Give me details about my Google Analytics property with 'xyz' in the name分析を依頼する:
what are the most popular events in my Google Analytics property in the last 180 days?サインインしているユーザーについて尋ねる:
were most of my users in the last 6 months logged in?プロパティ設定について尋ねる:
what are the custom dimensions and custom metrics in my property?
貢献 ✨
貢献を歓迎します!貢献ガイド を参照してください。
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceMCP server to interact with Google produts.489MIT
- -licenseNot gradedqualityNot gradedmaintenanceAn experimental MCP server that enables interaction with Google Analytics APIs, allowing users to retrieve account information, run core reports, and access realtime analytics data through natural language queries.
- AlicenseAqualityBmaintenanceUnofficial MCP server for Vexo analytics. Enables querying event names, counts, timelines, sessions, and recent events from Vexo Export API through natural language.614MIT
- AlicenseNot gradedqualityBmaintenanceMCP server for querying Google Analytics accounts, properties, reports, and realtime data using the Data API and Admin API.Apache 2.0
Related MCP Connectors
Official MCP server for Lovable, the AI-powered full-stack app builder.
Official MCP server for Qase — manage test cases, runs, suites, defects via AI tools.
Official MCP server for OmniDimension. Drive voice agents, dispatch calls, and run bulk campaigns.
Appeared in Searches
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/googleanalytics/google-analytics-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server