npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dongsik/google-marketing-mcp

v0.4.3

Published

MCP server for Google Analytics 4, Google Search Console, Google Ads, and YouTube (Data + Analytics). Each module is independently activated by environment variables.

Readme

google-marketing-mcp

npm

한국어

An MCP server for querying Google Analytics 4, Google Search Console, Google Ads, and YouTube (Data + Analytics) data directly from Claude Desktop.

Each module is independently activated by environment variables — pick any subset.

npx -y @dongsik/google-marketing-mcp

v0.4.0 note — YouTube now uses a separate OAuth token (token.youtube.json) so it can authorize against a Brand Account without conflicting with the personal Google account used by GA4/GSC. GA4/GSC/Ads users are unaffected. v0.3.0 YouTube users re-authorize once on the next YouTube call. See CHANGELOG.

v0.4.2 note — Adds non-breaking helper tools: status, yt_resolve_channel, and check_youtube_ga4_traffic.

v0.4.3 note — Fixes OAuth token auto-refresh: the saved refresh_token is no longer overwritten on rotation, and access tokens are refreshed transparently mid-session. No action needed; re-auth only if your saved token never had a refresh_token.

Modules

| Module | Activates with | Tools | Docs | |---|---|---|---| | Common | always | 1 | this README | | Google Analytics 4 | GA4_PROPERTY_ID | 21 | docs | | Google Search Console | GSC_SITE_URL | 7 | docs | | Google Ads | GOOGLE_ADS_DEVELOPER_TOKEN | 12 | docs | | YouTube (Data + Analytics) | YT_CHANNEL_ID | 17 | docs | | GA4 × Ads combined | both above | 7 | docs |

Common helper:

  • status: checks which modules are enabled and which env values are configured without printing secrets.

Common Setup

1. Google Cloud Console

  1. Go to Google Cloud Console and create or select a project
  2. APIs & Services → Library → enable the APIs for the modules you'll use (see each module's docs)
  3. APIs & Services → OAuth consent screen
    • User Type: External
    • Add your Google account as a test user
  4. APIs & Services → Credentials → create OAuth 2.0 Client ID
    • Application type: Desktop app
  5. Download the JSON file → save it as client_secret.json

2. Claude Desktop Configuration

Add to your claude_desktop_config.json:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "google-marketing-mcp": {
      "command": "npx",
      "args": ["--package=@dongsik/google-marketing-mcp", "google-marketing-mcp"],
      "env": {
        "GA_CLIENT_SECRET_PATH": "/path/to/client_secret.json",
        "GA4_PROPERTY_ID": "123456789",
        "GSC_SITE_URL": "https://example.com/",
        "GOOGLE_ADS_CUSTOMER_ID": "1234567890",
        "GOOGLE_ADS_DEVELOPER_TOKEN": "your_developer_token",
        "YT_CHANNEL_ID": "UCxxxxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}

Set only the env variables for modules you actually use. The OAuth scope request asks only for what's needed. Windows path example: "C:\\Users\\username\\client_secret.json"

3. Common Environment Variables

| Variable | Description | |---|---| | GA_CLIENT_SECRET_PATH | Absolute path to your OAuth client_secret.json (required) |

Module-specific env variables are documented in each module's page (linked above).

4. First Run

On first launch, a browser window opens for Google OAuth login. After authentication, the token is saved at ~/.google-marketing-mcp/token.json — subsequent requests authenticate automatically.

Access tokens are refreshed transparently as long as the saved refresh_token is valid; the updated token is persisted back to disk. Re-authentication is only required if the refresh_token itself is revoked (e.g. 7-day inactivity on Testing-mode OAuth clients, password change, or manual revoke).

If you add a new module after the first run, the OAuth flow runs again to request the new scope.

License

MIT