Back to Browse

Read AdSense Management MCP Server

Developer ToolsModerate7.2MCP RegistryLocal
Free

Server data from the Official MCP Registry

Read AdSense Management API v2 accounts and reports through MCP.

About

Read AdSense Management API v2 accounts and reports through MCP.

Security Report

7.2
Moderate7.2Low Risk

This is a well-designed AdSense MCP server with appropriate authentication, proper credential handling, and well-scoped permissions. The implementation uses OAuth 2.0 with PKCE, stores credentials securely in environment variables, and implements read-only access to the AdSense API. Minor code quality observations around error handling do not materially impact security. Supply chain analysis found 1 known vulnerability in dependencies (0 critical, 1 high severity). Package verification found 1 issue.

7 files analyzed · 6 issues found

Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.

Permissions Required

This plugin requests these system permissions. Most are normal for its category.

HTTP Network Access

Connects to external APIs or services over the internet.

env_vars

Check that this permission is expected for this type of plugin.

What You'll Need

Set these up before or after installing:

Optional short-lived OAuth access token.Required

Environment variable: ADSENSE_ACCESS_TOKEN

OAuth desktop client ID. Required when not using an access token.Optional

Environment variable: ADSENSE_CLIENT_ID

OAuth desktop client secret. Required when not using an access token.Required

Environment variable: ADSENSE_CLIENT_SECRET

OAuth refresh token. Required when not using an access token.Required

Environment variable: ADSENSE_REFRESH_TOKEN

Optional AdSense account resource name. The first accessible account is used when omitted.Optional

Environment variable: ADSENSE_ACCOUNT

How to Install

Add this to your MCP configuration file:

{
  "mcpServers": {
    "io-github-sirmacke-adsense-mcp": {
      "env": {
        "ADSENSE_ACCOUNT": "your-adsense-account-here",
        "ADSENSE_CLIENT_ID": "your-adsense-client-id-here",
        "ADSENSE_ACCESS_TOKEN": "your-adsense-access-token-here",
        "ADSENSE_CLIENT_SECRET": "your-adsense-client-secret-here",
        "ADSENSE_REFRESH_TOKEN": "your-adsense-refresh-token-here"
      },
      "args": [
        "-y",
        "@sirmacke/adsense-mcp"
      ],
      "command": "npx"
    }
  }
}

Documentation

View on GitHub

From the project's GitHub README.

AdSense MCP

An MCP server that extracts ad-hoc data from the AdSense Management API v2. It exposes an unrestricted report interface: any supported AdSense dimensions, metrics, filters, time period, sort order, timezone, language, currency, and limit can be passed through to accounts.reports.generate.

The server uses the read-only https://www.googleapis.com/auth/adsense.readonly OAuth scope. It does not write to an AdSense account.

Install

Once published, run it from an MCP client with npx -y @sirmacke/adsense-mcp. Configure either ADSENSE_ACCESS_TOKEN, or all three of ADSENSE_CLIENT_ID, ADSENSE_CLIENT_SECRET, and ADSENSE_REFRESH_TOKEN.

Security

OAuth access tokens, refresh tokens, and client secrets are credentials. Keep them out of this repository, issue trackers, shell history, and MCP configuration that is shared with others. If one is exposed, revoke it in Google Cloud immediately; see SECURITY.md.

Setup

  1. In Google Cloud, enable AdSense Management API and create an OAuth Desktop client.
  2. Obtain a refresh token granted the https://www.googleapis.com/auth/adsense.readonly scope. Keep it secret.
  3. Copy .env.example to your secure environment configuration and populate either ADSENSE_ACCESS_TOKEN or the OAuth client ID, secret, and refresh token.
  4. Install and build:
npm install
npm run build

One-time OAuth authorization (without gcloud)

Download the OAuth Desktop client JSON from Google Cloud, then run:

$env:ADSENSE_OAUTH_CLIENT_FILE = "C:\secure\adsense-client.json"
$env:ADSENSE_TOKEN_FILE = "C:\secure\adsense-oauth.json"
npm run authorize

The command opens the Google consent screen on a localhost callback and saves the client ID, client secret, and refresh token only in the private token file. Copy those values to the ADSENSE_CLIENT_ID, ADSENSE_CLIENT_SECRET, and ADSENSE_REFRESH_TOKEN fields of the MCP configuration. Do not leave an External consent screen in Testing: its refresh tokens expire after seven days.

Claude Desktop

Current Claude Desktop builds use extensions. Run npm run package, then install build/adsense-mcp.mcpb from Settings → Extensions → Advanced settings → Install extension. It securely prompts for the OAuth values. On installations that support classic configuration, add this instead:

{
  "mcpServers": {
    "adsense": {
      "command": "node",
      "args": ["/absolute/path/to/adsense-mcp/dist/index.js"],
      "env": {
        "ADSENSE_CLIENT_ID": "...",
        "ADSENSE_CLIENT_SECRET": "...",
        "ADSENSE_REFRESH_TOKEN": "..."
      }
    }
  }
}

Codex

Add the equivalent server definition to your Codex MCP configuration, using the same command, arguments, and environment variables. The server uses the standard MCP stdio transport and works in both clients.

Tools

  • adsense_list_accounts
  • adsense_get_account
  • adsense_generate_report

Example report request: metrics: ["ESTIMATED_EARNINGS", "PAGE_VIEWS", "CLICKS"], dimensions: ["DATE", "COUNTRY_NAME"], dateRange: "LAST_7_DAYS", orderBy: ["-ESTIMATED_EARNINGS"].

Verify

npm test
npm run build

Live verification also requires the OAuth values above and an AdSense account. The API’s report endpoint is GET /v2/{account}/reports:generate; it requires the AdSense or AdSense read-only OAuth scope.

License

MIT

Reviews

No reviews yet

Be the first to review this server!

Read AdSense Management MCP Server - Read AdSense Management API v2 accounts and reports through | MCP Marketplace