Claude Code Setup
Use Metrifyr with Claude Code CLI for local development
Connect Metrifyr to Claude Code
Use Metrifyr with Claude Code CLI to access your Google Marketing data directly from your terminal.
Prerequisites
- Claude Code installed
- Node.js 18 or later
- A Google account with Analytics, Search Console, or AdSense access
Quick Setup
1. Authenticate with Metrifyr
Run this command to sign in:
npx mcp-google-marketing loginThis opens your browser to:
- Sign in to Metrifyr
- Connect your Google account
- Save credentials locally
2. Add to Claude Code
claude mcp add google-marketing npx mcp-google-marketingDone! No environment variables or Google Cloud Console setup needed.
Alternative: Claude Desktop
If you use Claude Desktop, add this to your config file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"google-marketing": {
"command": "npx",
"args": ["-y", "mcp-google-marketing"]
}
}
}Remember to run npx mcp-google-marketing login first.
Alternative: Global Installation
For frequent use, install globally:
npm install -g mcp-google-marketing
mcp-google-marketing login
mcp-google-marketing # Start serverUsage
Once connected, ask Claude Code questions about your data:
> What's my website traffic this week?
> Show me the top search queries for my-domain.com
> List my GA4 propertiesAvailable Commands
The CLI supports several commands:
| Command | Description |
|---|---|
login | Authenticate with Metrifyr and Google |
logout | Clear saved credentials |
status | Check authentication status |
serve | Start the MCP server (default) |
Troubleshooting
"Authentication required"
Run npx mcp-google-marketing login to authenticate.
"MCP server not found"
Make sure you added the server with:
claude mcp add google-marketing npx mcp-google-marketing"Permission denied"
Your Google account may not have access to the requested Analytics property or Search Console site.
Next Steps
- SEO Diagnostics Guide - Real-world example
- Available Tools - Full tool reference
- Examples - More query examples