The official Google Analytics MCP server (googleanalytics/google-analytics-mcp, 2K+ stars, maintained by Google) is installed in this project. Once credentials are wired, Claude can query QuantOracle's GA4 property directly — top pages, funnels, realtime sessions, custom dimensions.
analytics-mcpv0.5.0 installed atD:\Quantcalc\venv\Scripts\analytics-mcp.exe.mcp.jsonat project root, registering the server with Claude Code under the namega4
Download from https://cloud.google.com/sdk/docs/install-sdk. On Windows the easiest is the bundled installer (GoogleCloudSDKInstaller.exe). After install, restart your terminal.
Verify: gcloud --version
You need a GCP project. If you don't have one, create one at https://console.cloud.google.com/projectcreate — name it anything (e.g. quantoracle-analytics). The project ID (auto-generated, looks like quantoracle-analytics-12345) is what you'll put in .mcp.json later.
Enable these two APIs on the project:
Just click "Enable" on each page after selecting the right project from the dropdown.
Run this command in any terminal:
gcloud auth application-default login --scopes https://www.googleapis.com/auth/analytics.readonly,https://www.googleapis.com/auth/cloud-platform
A browser will open. Sign in with the Google account that has access to the QuantOracle GA4 property (G-FPTTKC4T1N). After consent, the credentials are saved to a standard location (%APPDATA%\gcloud\application_default_credentials.json) — the MCP server finds them automatically.
Edit D:\Quantcalc\.mcp.json and replace <YOUR_GCP_PROJECT_ID> with the actual project ID from step 2 (e.g. quantoracle-analytics-12345).
The .mcp.json is loaded when a session starts in this directory. After restart, you should see mcp__ga4__* tools available — run_report, run_realtime_report, etc.
Once Claude has the tools loaded, try asking:
"Use the ga4 MCP to list my Google Analytics properties and confirm you can see G-FPTTKC4T1N."
If Claude calls get_account_summaries and returns your property, setup is complete.
Then try:
"What were the top 5 landing pages on quantoracle.dev in the last 7 days, sorted by sessions?"
Claude will call run_report with the right dimensions and metrics, and you'll get a real answer in 1-2 seconds.
- "Compare /writing/vercel-ai-sdk-quant-tools traffic against /writing/agentkit-reliable-quant-finance-math over the last 24 hours. Which is performing better and why?"
- "How many users hit /pricing yesterday? What % bounced vs clicked through to a calculator?"
- "Show me real-time active users right now, broken down by country."
- "Which calculator page has the highest engagement rate? That's the template to copy."
- "Plot the daily trend of
_meta.pagecalculator-attributed API calls over the last 14 days."
"Could not load the default credentials" — you skipped step 3. Re-run the gcloud auth application-default login command.
"403 caller does not have permission" — the Google account you used in step 3 doesn't have access to the GA4 property. Either use a different account or grant access via GA4 admin → Property access management → add your service account email.
MCP server doesn't appear in tool list after restart — verify .mcp.json is at the project root (D:/Quantcalc/.mcp.json, not in a subdirectory). Run D:\Quantcalc\venv\Scripts\analytics-mcp.exe --help in a terminal to confirm the binary works.
"GOOGLE_PROJECT_ID is required" — you forgot step 4. Fill in the actual project ID in .mcp.json and restart Claude.
To revoke: gcloud auth application-default revoke.
The credentials file at %APPDATA%\gcloud\application_default_credentials.json contains a refresh token — treat it like a password. It's gitignored (the whole %APPDATA% path is outside the repo anyway), but worth knowing.
The Google Analytics Admin API and Data API are free for normal usage (well under any per-day quota you'd hit with a single agent). No GCP charges for using this MCP.