adsense-mcp
AdSense MCP
AdSense Management API v2에서 임시 데이터를 추출하는 MCP 서버입니다. 제한 없는 보고서 인터페이스를 제공하므로, 지원되는 모든 AdSense 측정기준, 측정항목, 필터, 기간, 정렬 순서, 시간대, 언어, 통화, 한도를 accounts.reports.generate에 전달할 수 있습니다.
서버는 읽기 전용 https://www.googleapis.com/auth/adsense.readonly OAuth 범위를 사용합니다. AdSense 계정에 쓰기 작업을 수행하지 않습니다.
Install
게시된 후에는 npx -y @sirmacke/adsense-mcp로 MCP 클라이언트에서 실행하세요. ADSENSE_ACCESS_TOKEN을 구성하거나, ADSENSE_CLIENT_ID, ADSENSE_CLIENT_SECRET, ADSENSE_REFRESH_TOKEN 세 가지를 모두 구성하세요.
Related MCP server: google-ads-mcp
Security
OAuth 액세스 토큰, 리프레시 토큰, 클라이언트 시크릿은 자격 증명입니다. 이 저장소, 이슈 트래커, 셸 기록, 다른 사람과 공유되는 MCP 구성에 포함하지 마세요. 하나라도 노출된 경우 Google Cloud에서 즉시 취소하세요. SECURITY.md를 참조하세요.
Setup
Google Cloud에서 AdSense Management API를 사용 설정하고 OAuth 데스크톱 클라이언트를 만드세요.
https://www.googleapis.com/auth/adsense.readonly범위가 부여된 리프레시 토큰을 획득하세요. 비밀로 유지하세요..env.example을 안전한 환경 구성으로 복사하고ADSENSE_ACCESS_TOKEN또는 OAuth 클라이언트 ID, 시크릿, 리프레시 토큰을 입력하세요.설치 및 빌드:
npm install
npm run build일회성 OAuth 인증(gcloud 없이)
Google Cloud에서 OAuth 데스크톱 클라이언트 JSON을 다운로드한 후 실행하세요:
$env:ADSENSE_OAUTH_CLIENT_FILE = "C:\secure\adsense-client.json"
$env:ADSENSE_TOKEN_FILE = "C:\secure\adsense-oauth.json"
npm run authorize이 명령은 localhost 콜백에서 Google 동의 화면을 열고 클라이언트 ID, 클라이언트 시크릿, 리프레시 토큰을 개인 토큰 파일에만 저장합니다. 해당 값을 MCP 구성의 ADSENSE_CLIENT_ID, ADSENSE_CLIENT_SECRET, ADSENSE_REFRESH_TOKEN 필드에 복사하세요. 외부 사용자 동의 화면을 테스트 중 상태로 두지 마세요. 해당 리프레시 토큰은 7일 후 만료됩니다.
Claude Desktop
현재 Claude Desktop 빌드는 확장 프로그램을 사용합니다. npm run package를 실행한 다음 설정 → 확장 프로그램 → 고급 설정 → 확장 프로그램 설치에서 build/adsense-mcp.mcpb를 설치하세요. OAuth 값을 안전하게 입력하라는 메시지가 표시됩니다. 클래식 구성을 지원하는 설치에서는 대신 다음을 추가하세요:
{
"mcpServers": {
"adsense": {
"command": "node",
"args": ["/absolute/path/to/adsense-mcp/dist/index.js"],
"env": {
"ADSENSE_CLIENT_ID": "...",
"ADSENSE_CLIENT_SECRET": "...",
"ADSENSE_REFRESH_TOKEN": "..."
}
}
}
}Codex
Codex MCP 구성에 동일한 명령, 인수, 환경 변수를 사용하여 해당 서버 정의를 추가하세요. 이 서버는 표준 MCP stdio 전송을 사용하며 두 클라이언트 모두에서 작동합니다.
Tools
adsense_list_accountsadsense_get_accountadsense_generate_report
보고서 요청 예시: metrics: ["ESTIMATED_EARNINGS", "PAGE_VIEWS", "CLICKS"], dimensions: ["DATE", "COUNTRY_NAME"], dateRange: "LAST_7_DAYS", orderBy: ["-ESTIMATED_EARNINGS"].
Verify
npm test
npm run build실제 검증에는 위의 OAuth 값과 AdSense 계정도 필요합니다. API의 보고서 엔드포인트는 GET /v2/{account}/reports:generate이며, AdSense 또는 AdSense 읽기 전용 OAuth 범위가 필요합니다.
License
Available Tools
3 toolsadsense_generate_reportA
Extract any ad-hoc AdSense report. Supply API v2 dimensions, metrics, filters, dates, sorting, and other report parameters. Account is discovered automatically when omitted.
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| account | No | Account resource name; optional when one account is accessible. | |
| endDate | No | Custom end date in YYYY-MM-DD. | |
| filters | No | AdSense filters, e.g. AD_CLIENT_ID==ca-pub-... | |
| metrics | Yes | Required metrics, e.g. ESTIMATED_EARNINGS, PAGE_VIEWS, CLICKS. | |
| orderBy | No | Columns to sort, e.g. -ESTIMATED_EARNINGS. | |
| dateRange | No | Preset date range such as TODAY, YESTERDAY, LAST_7_DAYS, MONTH_TO_DATE, CUSTOM. | |
| startDate | No | Custom start date in YYYY-MM-DD. | |
| dimensions | No | Report dimensions, e.g. DATE, AD_UNIT_NAME, COUNTRY_NAME. | |
| currencyCode | No | ||
| languageCode | No | ||
| reportingTimeZone | No | ACCOUNT_TIME_ZONE or GOOGLE_TIME_ZONE. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the behavioral burden. "Extract" implies a read-only data fetch, and "Account is discovered automatically when omitted" is a useful behavioral detail. However, it does not disclose response format, pagination behavior, permissions, or any side effects, leaving a meaningful transparency gap.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two front-loaded sentences say exactly what is needed without fluff. The first sentence gives the purpose, the second tells the caller what to supply and clarifies account optionality.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given 12 parameters, no output schema, and no annotations, this description is too thin. It does not say what the report response looks like, whether results are paginated, or how ad-hoc complexity is handled. The auto-discovery note is helpful, but the tool still lacks guidance for an agent to fully anticipate the invocation outcome.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 75%, and the description adds a high-level parameter map: dimensions, metrics, filters, dates, sorting, and other report parameters. It also notes the API version, which helps normalize parameter syntax. It does not detail every uncovered parameter such as limit, currencyCode, or languageCode, but the schema still provides most semantics.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb and resource: "Extract any ad-hoc AdSense report." It clearly distinguishes this reporting tool from the sibling account tools by framing it as report extraction with flexible parameters.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It gives clear context: use this tool for ad-hoc AdSense reporting where the caller supplies dimensions, metrics, filters, dates, and sorting. It also removes a common prerequisite by noting that the account is discovered automatically when omitted. It does not explicitly compare to sibling alternatives, but the usage context is clear.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
adsense_get_accountA
Get one AdSense account by resource name, e.g. accounts/pub-123.
| Name | Required | Description | Default |
|---|---|---|---|
| account | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of disclosing side effects. It only says 'get', implying a read-only operation, but does not explicitly confirm it is non-destructive, nor does it mention permission requirements, error behavior, or return value characteristics. The minimal disclosure is insufficient for safe invocation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single concise sentence with an example, containing no filler. Every word adds value and it is front-loaded with the core action.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's low complexity (one parameter, no output schema), the description covers the basics but omits details like return value structure, error handling (e.g., what happens if account doesn't exist), and any authentication or permission notes. Since there is no output schema, explaining what is returned would improve completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It indirectly explains the 'account' parameter by saying 'by resource name' and gives an example format ('accounts/pub-123'), which clarifies the required pattern. However, it does not explicitly name the parameter or explain its full semantics (e.g., must start with 'accounts/'), leaving some ambiguity.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action: 'Get one AdSense account by resource name' with a specific example. It distinguishes from siblings (adsense_list_accounts for multiple, adsense_generate_report for reporting) by focusing on retrieving a single account by its resource identifier.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Usage is implied through the phrase 'by resource name' and the example, but there is no explicit guidance on when to use this tool versus alternatives like list_accounts. It does not state when not to use it or mention prerequisites (e.g., need a known account resource name).
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
adsense_list_accountsA
List AdSense accounts available to the authenticated user.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the burden. It states the tool lists accounts, which is a read operation, but does not disclose any behavioral traits such as authentication requirements, rate limits, or whether it returns all accounts or only those with certain statuses. The description is minimal but not misleading.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, concise sentence that fully conveys the tool's purpose. There is no wasted text, and it is front-loaded with the action and resource.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity (no parameters, no output schema, no annotations), the description is mostly complete. However, it could benefit from mentioning what the response contains (e.g., account IDs, names) or any prerequisites like authentication, but the lack of complexity makes this a minor gap.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The tool has zero parameters, and schema description coverage is 100% (vacuously). The description adds no parameter details because there are none, but it correctly implies no inputs are needed. Baseline for 0 params is 4, and the description is adequate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool lists AdSense accounts for the authenticated user, using a specific verb and resource. It distinguishes from siblings like adsense_get_account (which likely retrieves a single account) and adsense_generate_report (which generates reports), though it doesn't explicitly name them.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage context (listing accounts for the authenticated user) but does not explicitly state when to use this tool versus alternatives. It doesn't mention exclusions or alternatives, but the purpose is clear enough that an agent can infer when to use it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
3 tool updates
v0.1.1- First observed
adsense_generate_report - First observed
adsense_get_account - First observed
adsense_list_accounts
TDQS
Scored across 3 tools
Each tool targets a distinct operation: listing accounts, retrieving a specific account, and generating reports. There is no overlap between these actions, and the report tool even auto-discovers the account, reducing ambiguity.
All tool names follow a consistent verb_noun pattern with the 'adsense_' prefix (list_accounts, get_account, generate_report). This makes the naming predictable and easy to navigate.
With 3 tools, the server is on the lower end of the ideal range, but it covers the core AdSense operations: account listing, account retrieval, and report generation. The count feels minimal yet sufficient for a focused server, though slightly thin.
The surface covers essential account and reporting operations, but lacks other common AdSense resources like ad units, sites, or alerts. This might be a notable gap for agents needing broader management capabilities, though it may be acceptable for a report-focused server.
Maintenance
Related MCP Connectors
MCP server for querying and analyzing data from ad platforms, analytics tools, and spreadsheets
Hosted MCP server for GA4, Google Ads and Search Console. Google OAuth, nothing to install.
Google Ads MCP server — manage campaigns, keywords, and metrics.
Hosted MCP server for Google Ads and LinkedIn Ads analysis.
Related MCP Servers
- AlicenseAqualityDmaintenanceMCP server for Google AdSense management. Create ad units, generate framework-specific ad code, manage earnings reports, and automate ads.txt — all from your AI assistant.1213 npmMIT
- AlicenseNot gradedqualityDmaintenanceMCP server for Google Ads campaign reporting and management via Claude, enabling GAQL queries, performance metrics, and campaign modifications.27 npmMIT
- AlicenseNot gradedqualityDmaintenanceMCP server for querying Google Analytics accounts, properties, reports, and realtime data using the Data API and Admin API.Apache 2.0
- AlicenseNot gradedqualityFmaintenanceMCP server that provides tools to interact with Google Analytics APIs, enabling account and property retrieval, report running, and custom dimension/metrics access.Apache 2.0