Metrifyr
Guides

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 login

This opens your browser to:

  1. Sign in to Metrifyr
  2. Connect your Google account
  3. Save credentials locally

2. Add to Claude Code

claude mcp add google-marketing npx mcp-google-marketing

Done! 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 server

Usage

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 properties

Available Commands

The CLI supports several commands:

CommandDescription
loginAuthenticate with Metrifyr and Google
logoutClear saved credentials
statusCheck authentication status
serveStart 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

On this page

Claude Code Setup | Metrifyr Docs | Metrifyr