Skip to main content
Glama

GA4 MCP Server

agent.py1.11 kB
""" GA4 Agent using MCP toolset. """ import os from google.genai import types from google.adk.models import Gemini from google.adk.agents import LlmAgent from google.adk.tools.mcp_tool.mcp_toolset import (MCPToolset, StdioConnectionParams, StdioServerParameters) PROJECT_ID = os.environ["GOOGLE_CLOUD_PROJECT"] MODEL = os.environ["MODEL"] root_agent = LlmAgent( model=Gemini(model=MODEL, retry_options=types.HttpRetryOptions( exp_base=2, max_delay=10, attempts=10, )), name='ga4_agent', instruction='与えられた GA4 の MCP ツールを使って日本語で答えなさい。', tools=[ MCPToolset(connection_params=StdioConnectionParams( timeout=10, server_params=StdioServerParameters( command='analytics-mcp', env={ "GOOGLE_PROJECT_ID": PROJECT_ID, }, ), )) ], )

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/paulhindemith/ga4-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server