flin-google-keyword-planner-mcp
MCP server for Google Ads Keyword Planner ideas.
This server exposes focused read-only tools so an LLM can clearly choose the right seed strategy.
Exposed MCP tools
keyword_ideas_from_keywordskeyword_ideas_from_urlkeyword_ideas_from_keyword_and_urlkeyword_ideas_from_sitekeyword_ideas_historicalkeyword_historical_metrics
Tool overview
1) keyword_ideas_from_keywords
Generate ideas from a keyword list (KeywordSeed).
Required:
keywords
2) keyword_ideas_from_url
Generate ideas from a page URL (UrlSeed).
Required:
url
3) keyword_ideas_from_keyword_and_url
Generate ideas from keyword list + URL (KeywordAndUrlSeed).
Required:
keywordsurl
4) keyword_ideas_from_site
Generate ideas from a full site/domain (SiteSeed).
Required:
site_url
5) keyword_ideas_historical
Generate ideas from keywords and constrain historical metrics to a year-month range.
Required:
keywordsstart_yearstart_monthend_yearend_month
Historical option:
include_average_cpc(defaultfalse)
Common optional parameters (keyword idea tools)
customer_idlanguage_id(default1000)location_ids(default2840= US;[]= all locations; max 10 unique IDs)network(GOOGLE_SEARCHorGOOGLE_SEARCH_AND_PARTNERS; default includes partners)include_adult_keywords(defaultfalse)limit(page size: default50, max1000; Google may return fewer rows)include_average_cpc(defaultfalse; also available on all four seed tools)page_tokenkeyword_annotation(currently:KEYWORD_CONCEPT)aggregate_metric_types(currently:DEVICE)login_customer_id
6) keyword_historical_metrics
Fetch historical search volumes and bids for an existing list of up to 10,000
keywords using Google's GenerateKeywordHistoricalMetrics endpoint. It does not
expand the list into new ideas. keyword_ideas_historical keeps its original
behavior: discovering ideas with a historical date range.
Required: keywords. Optional: customer, language, locations, network, adult
keywords, manager ID, and include_average_cpc. Omit dates for Google's default
past 12 months, or supply all four year/month fields. Google controls historical
data availability and may omit unavailable months.
Results include close variants and unmatched_keywords. Google can combine similar
keywords, so the result count need not match the input count; an unmatched term is
not evidence of zero search volume. Pagination and idea annotations do not apply.
Data interpretation and targeting
- Defaults remain English / US / Search and Partners for compatibility. For
German Switzerland, explicitly pass
language_id="1001",location_ids=["2756"]. Usenetwork="GOOGLE_SEARCH"for Google Search alone. - Responses echo their targeting. Bid amounts and CPC use the Google Ads customer account's currency; do not assume USD or CHF from the target location.
- Missing optional metrics are
null; genuine reported zeroes remain0. - Competition and competition index measure advertiser competition, not SEO difficulty.
- Search volumes are approximate and may group close variants.
- Idea seeds accept at most 20 unique keywords. URL seeds require absolute HTTP(S) URLs.
- Each ideas call returns one API page. Continue with
next_page_tokenand identical request parameters. A short or empty page does not imply the end if a token exists. - Requests use a 30-second RPC timeout and a 45-second retry window for transient transport errors. The last in-flight RPC may extend beyond that window. Quota and authentication errors are not automatically retried.
Requirements
- Python 3.10+
- Google Ads API credentials:
GOOGLE_ADS_DEVELOPER_TOKENGOOGLE_ADS_CLIENT_IDGOOGLE_ADS_CLIENT_SECRET
Optional:
GOOGLE_ADS_REFRESH_TOKEN(only needed if you want a persistent token instead of generating one in Claude)GOOGLE_ADS_LOGIN_CUSTOMER_IDGOOGLE_ADS_CUSTOMER_ID(default customer if nocustomer_idargument is passed)GOOGLE_ADS_USE_PROTO_PLUS(trueby default)
Quickstart (local)
uv sync --locked --extra dev
cp .env.example .env
# Fill .env with real credentials
uv run --env-file .env flin-google-keyword-planner-mcp
Claude integration
Option A: Published package (uvx)
{
"mcpServers": {
"flin-google-keyword-planner-mcp": {
"command": "uvx",
"args": ["flin-google-keyword-planner-mcp@latest"],
"env": {
"GOOGLE_ADS_DEVELOPER_TOKEN": "REPLACE_ME",
"GOOGLE_ADS_CLIENT_ID": "REPLACE_ME",
"GOOGLE_ADS_CLIENT_SECRET": "REPLACE_ME",
"GOOGLE_ADS_CUSTOMER_ID": "1234567890",
"GOOGLE_ADS_LOGIN_CUSTOMER_ID": "1234567890",
"GOOGLE_ADS_USE_PROTO_PLUS": "true"
}
}
}
}
Option B: Local development checkout
{
"mcpServers": {
"flin-google-keyword-planner-mcp-local": {
"command": "uv",
"args": [
"run",
"--directory",
"/ABSOLUTE/PATH/TO/flin-google-keyword-planner-mcp",
"flin-google-keyword-planner-mcp"
],
"env": {
"GOOGLE_ADS_DEVELOPER_TOKEN": "REPLACE_ME",
"GOOGLE_ADS_CLIENT_ID": "REPLACE_ME",
"GOOGLE_ADS_CLIENT_SECRET": "REPLACE_ME",
"GOOGLE_ADS_CUSTOMER_ID": "1234567890",
"GOOGLE_ADS_LOGIN_CUSTOMER_ID": "1234567890",
"GOOGLE_ADS_USE_PROTO_PLUS": "true"
}
}
}
}
Restart Claude Desktop after config changes.
Generate the refresh token in Claude
After Claude has loaded the MCP, ask it to run:
google_ads_start_local_oauth_flow- Open the returned
authorization_urlin your browser and approve Google Ads access. - After the browser shows the local completion page, run
google_ads_oauth_status. - Run the keyword tools once
token_availableistrue.
The default redirect URI is http://localhost:8080/. If your Google OAuth client uses a different loopback redirect URI, pass it to google_ads_start_local_oauth_flow.
If you cannot use the local callback flow, use the manual fallback:
- Run
google_ads_authorization_url. - Open the returned URL and approve access.
- Copy either the full redirected URL or the
codequery parameter. - Run
google_ads_exchange_authorization_codewith that value.
The exchanged refresh token is stored outside Claude config in ~/.config/flin-google-keyword-planner-mcp/oauth-token.json and reused after MCP restarts. Override the storage path with FLIN_GOOGLE_ADS_TOKEN_FILE if needed.
Security
- Never commit real credentials to git.
.envand.env.*are gitignored; only.env.exampleis tracked.- Keep secrets in environment variables or secret managers.
- Rotate credentials immediately if accidentally exposed.
- CI and release workflows run secret scanning with OSS
gitleaks(noGITLEAKS_LICENSEsecret required).
Testing
uv sync --locked --extra dev
uv run --locked python -m pytest
uv run --locked python -m compileall src
uv build
Release automation (GitHub + PyPI)
- CI workflow:
.github/workflows/ci.yml - Release workflow:
.github/workflows/release.yml - Tag push (
v*) triggers:
- tests + compile + build +
twine check - publish to PyPI via Trusted Publishing (OIDC)
- GitHub Release creation with built artifacts
PyPI Trusted Publishing (one-time)
In the PyPI project flin-google-keyword-planner-mcp, add a Trusted Publisher:
- Owner:
flin-agency - Repository:
flin-google-keyword-planner-mcp - Workflow:
release.yml - Environment:
pypi
Release steps
# 1) bump version in pyproject.toml + src/flin_google_ads_mcp/__init__.py
# 2) run checks
uv run --locked python -m pytest
uv run --locked python -m compileall src
uv build
# 3) release
git add -A
git commit -m "release: vX.Y.Z"
git tag vX.Y.Z
git push origin main --tags
Version 0.3.0 upgrade notes
Validated with Google Ads Python SDK 35.0.0 (API v26) and MCP SDK 1.30.0.
The MCP SDK remains on the compatible 1.x line; this is not a migration to MCP 2.x.
uv.lock is now tracked so local installs and CI use the same dependency versions.
OAuth exchange returns success and persistence status, never the refresh token. Local OAuth uses PKCE, state validation, a ten-minute expiry, and releases its callback port after completion. Token files are written atomically with private permissions. The manual code-copy fallback remains available.
Clients upgrading from 0.2.x must accept nullable metrics, the additional response
metadata, and the removal of refresh_token from the OAuth exchange response.
Existing five idea tool names and targeting defaults are retained.
Reference: Google historical metrics, Google keyword ideas, API releases.
Metadata
Release files for flin-google-keyword-planner-mcp 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flin_google_keyword_planner_mcp-0.3.0.tar.gz | 136.9 kB | With provenance | Details for flin_google_keyword_planner_mcp-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flin_google_keyword_planner_mcp-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for flin_google_keyword_planner_mcp-0.3.0-py3-none-any.whl |
Total release size: 156.9 kB
Release files / flin_google_keyword_planner_mcp-0.3.0.tar.gz
| Download URL | flin_google_keyword_planner_mcp-0.3.0.tar.gz |
|---|---|
| Size | 136.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a381a09d7e90feb28a70868c43522b1751f5d23091b50139be36482024464bf0
|
|
BLAKE2b-256 checksum How to use checksums |
f46e41a404e8d27c1d51fc383272e215e425a19b83508c85f542f2622f8e911e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logRelease files / flin_google_keyword_planner_mcp-0.3.0-py3-none-any.whl
| Download URL | flin_google_keyword_planner_mcp-0.3.0-py3-none-any.whl |
|---|---|
| Size | 20.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d84113e981ced06d74144679302b114a127d4f6f69587de4fb169a3508bb4bc3
|
|
BLAKE2b-256 checksum How to use checksums |
1619f06597cf427e6c704fe1e8436121927e1b10efcde9ae08ac93f77a5ad6b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logSecurity for flin-google-keyword-planner-mcp 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for flin_google_keyword_planner_mcp-0.3.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.