@getmcpads/google-ads-mcp-server 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +16 -0
- package/README.md +357 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +8742 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.js +8725 -0
- package/dist/index.js.map +1 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
google-ads-mcp-server
|
|
2
|
+
Copyright 2026 GetMCPAds
|
|
3
|
+
|
|
4
|
+
This product includes software developed at GetMCPAds (https://www.getmcpads.com).
|
|
5
|
+
|
|
6
|
+
An open-source Model Context Protocol server for the Google Ads API.
|
|
7
|
+
It is self-hosted and unaffiliated with Google.
|
|
8
|
+
|
|
9
|
+
GetMCPAds also runs a managed gateway that covers Google Ads alongside
|
|
10
|
+
Meta Ads, TikTok Ads, Pinterest Ads, GA4 and Search Console, with hosted
|
|
11
|
+
OAuth and cross-platform reporting: https://www.getmcpads.com
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
Google, Google Ads and Google Ads API are trademarks of Google LLC. This
|
|
16
|
+
project is not affiliated with, endorsed by, or sponsored by Google LLC.
|
package/README.md
ADDED
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
# google-ads-mcp-server
|
|
2
|
+
|
|
3
|
+
[](https://github.com/getmcpads-com/google-ads-mcp-server/actions/workflows/ci.yml)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](package.json)
|
|
6
|
+
|
|
7
|
+
An open-source [Model Context Protocol](https://modelcontextprotocol.io) server for the
|
|
8
|
+
**Google Ads API**. It lets Claude, ChatGPT, Cursor or any MCP client read and analyse your
|
|
9
|
+
Google Ads data, plan keywords, and change campaigns if you choose to.
|
|
10
|
+
|
|
11
|
+
You run it. Your credentials stay on your machine. Nothing is proxied through a third party.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx -y @getmcpads/google-ads-mcp-server
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
> **Prefer not to run it yourself?** [getmcpads.com](https://www.getmcpads.com) is the hosted
|
|
18
|
+
> version of this server, with Google Ads alongside Meta Ads, TikTok Ads, Pinterest Ads, GA4 and
|
|
19
|
+
> Search Console behind a single endpoint, hosted OAuth, and cross-platform reporting.
|
|
20
|
+
> Same tools, same safety model, no setup.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## What you get
|
|
25
|
+
|
|
26
|
+
| | |
|
|
27
|
+
|---|---|
|
|
28
|
+
| **31 read tools** | Campaigns, ad groups, budgets, bidding strategies, search terms, landing pages, Performance Max assets and placements, Shopping, recommendations, change history |
|
|
29
|
+
| **7 write tools** | Off by default. Status, budgets, bids, schedules, renames, campaign creation. Each one **previews before it applies** |
|
|
30
|
+
| **Full Keyword Planner** | Keyword ideas, historical metrics, forecasts, ad group themes, geo target suggestions |
|
|
31
|
+
| **130 metrics, 84 dimensions** | With a compatibility matrix that catches invalid combinations before they hit the API |
|
|
32
|
+
| **5 resources** | Live catalogues the model can read: metrics, dimensions, compatibility rules, 11 workflow recipes |
|
|
33
|
+
| **GAQL and beyond** | `google_ads_run_gaql` for raw queries, and `google_ads_run_readonly_rpc` for the services GAQL cannot reach |
|
|
34
|
+
|
|
35
|
+
### You do not need to know GAQL
|
|
36
|
+
|
|
37
|
+
The Google Ads API is queried with GAQL, its own query language, and most of its surface is
|
|
38
|
+
only reachable that way. This server carries the metric and dimension catalogues, so the model
|
|
39
|
+
asks for `cost` and `conversions` by name and the server writes the query.
|
|
40
|
+
|
|
41
|
+
`google_ads_validate_query` lets it check a combination before spending a call on it, and
|
|
42
|
+
`google_ads_run_gaql` is still there when you want to write GAQL yourself.
|
|
43
|
+
|
|
44
|
+
### Keyword Planner is not in GAQL
|
|
45
|
+
|
|
46
|
+
Keyword ideas, historical volumes and forecasts live in a separate RPC service that GAQL
|
|
47
|
+
cannot reach at all. Same for Reach Planner, audience insights and benchmarks. This server
|
|
48
|
+
covers them through `google_ads_run_readonly_rpc` and dedicated tools.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## How this compares to Google's own MCP server
|
|
53
|
+
|
|
54
|
+
Google shipped an official Google Ads MCP server in April 2026. It takes the opposite design
|
|
55
|
+
approach, and the comparison is more nuanced than for other platforms.
|
|
56
|
+
|
|
57
|
+
| | Google's official server | This server | [getmcpads.com](https://www.getmcpads.com) |
|
|
58
|
+
|---|---|---|---|
|
|
59
|
+
| Tools | **3**: list accounts, GAQL search, resource metadata | **38** (31 read + 7 write) | 38, plus 5 other platforms |
|
|
60
|
+
| Hosting | Self-hosted (pipx) or Cloud Run | **Self-hosted.** stdio, local process | Hosted for you |
|
|
61
|
+
| Requires knowing GAQL | **Yes**, for anything beyond listing accounts | No, catalogues drive the query | No |
|
|
62
|
+
| Keyword Planner | ❌ | ✅ ideas, history, forecasts | ✅ |
|
|
63
|
+
| Reach Planner, audience insights | ❌ | ✅ via read-only RPC | ✅ |
|
|
64
|
+
| Performance Max diagnostics | Via hand-written GAQL | ✅ dedicated tools | ✅ |
|
|
65
|
+
| Writes | ❌ read-only by design | ✅ **preview first**, applied only on `confirm: true` | ✅ preview first |
|
|
66
|
+
| Metric compatibility | None | **Query planner splits incompatible requests** | Same planner |
|
|
67
|
+
| Auditable | Yes, it is open too | **Yes.** Apache-2.0 | This server, audited |
|
|
68
|
+
|
|
69
|
+
**Be fair about it.** Google's server is self-hostable too, so "your data stays on your
|
|
70
|
+
machine" is not a difference here. Its 3 tools are a deliberate minimalist design: one GAQL
|
|
71
|
+
tool can express most of the reporting surface, and a model fluent in GAQL will do a lot with
|
|
72
|
+
very little.
|
|
73
|
+
|
|
74
|
+
The difference is where the knowledge lives. There, it lives in the model, which has to write
|
|
75
|
+
correct GAQL against a schema of thousands of fields. Here, it lives in the server, in
|
|
76
|
+
catalogues and a compatibility matrix. Add to that the planning services GAQL cannot reach at
|
|
77
|
+
all, and writes that cannot fire on the first call.
|
|
78
|
+
|
|
79
|
+
**Choose Google's** if your model writes good GAQL and you only need reporting.
|
|
80
|
+
**Choose this one** if you want named metrics instead of query language, Keyword Planner and
|
|
81
|
+
Reach Planner access, or guarded writes.
|
|
82
|
+
**Choose [getmcpads.com](https://www.getmcpads.com)** if you want this server's capabilities
|
|
83
|
+
without running it, or you need more than one ad platform in the same conversation.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Getting credentials
|
|
88
|
+
|
|
89
|
+
This is the heaviest setup of any advertising platform. Four values are needed, and one of
|
|
90
|
+
them requires a review by Google. Budget an hour the first time.
|
|
91
|
+
|
|
92
|
+
### 1. Developer token
|
|
93
|
+
|
|
94
|
+
From a **manager (MCC) account**, open **Tools → API Center** and apply for a token.
|
|
95
|
+
It starts at *Test Account* level, which only reaches test accounts. Apply for
|
|
96
|
+
**Basic Access** to reach live accounts. Google reviews the application, which can take a
|
|
97
|
+
few days.
|
|
98
|
+
|
|
99
|
+
📖 [Developer token documentation](https://developers.google.com/google-ads/api/docs/get-started/dev-token)
|
|
100
|
+
|
|
101
|
+
### 2. OAuth client
|
|
102
|
+
|
|
103
|
+
In a [Google Cloud project](https://console.cloud.google.com/), enable the **Google Ads API**,
|
|
104
|
+
then create an OAuth client under **APIs & Services → Credentials**. Choose **Desktop app**
|
|
105
|
+
for local use. Note the **client ID** and **client secret**.
|
|
106
|
+
|
|
107
|
+
### 3. Refresh token
|
|
108
|
+
|
|
109
|
+
Run the OAuth consent flow once, signed in as the Google account that can see your ad
|
|
110
|
+
accounts, and keep the **refresh token** it returns. Google's own helper script does this in
|
|
111
|
+
one command.
|
|
112
|
+
|
|
113
|
+
📖 [OAuth desktop flow](https://developers.google.com/google-ads/api/docs/oauth/cloud-project)
|
|
114
|
+
|
|
115
|
+
**The refresh token does not expire.** It is the sensitive value here: anyone holding it can
|
|
116
|
+
mint access tokens indefinitely. Treat it like a password, and use an OAuth client dedicated
|
|
117
|
+
to this server so you can revoke it on its own.
|
|
118
|
+
|
|
119
|
+
### 4. Login customer ID, if you use a manager account
|
|
120
|
+
|
|
121
|
+
If the accounts you query sit under an MCC, set `GOOGLE_ADS_LOGIN_CUSTOMER_ID` to the manager
|
|
122
|
+
account ID. Dashes are accepted and stripped. Skip it for a standalone account.
|
|
123
|
+
|
|
124
|
+
Run **`google_ads_health_check`** as your first call. It verifies all four credentials, lists
|
|
125
|
+
the accounts you can actually reach, and reports what is missing, without printing any secret.
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Setup
|
|
130
|
+
|
|
131
|
+
### Claude Desktop
|
|
132
|
+
|
|
133
|
+
`~/Library/Application Support/Claude/claude_desktop_config.json` (macOS)
|
|
134
|
+
or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
135
|
+
|
|
136
|
+
```json
|
|
137
|
+
{
|
|
138
|
+
"mcpServers": {
|
|
139
|
+
"google-ads": {
|
|
140
|
+
"command": "npx",
|
|
141
|
+
"args": ["-y", "@getmcpads/google-ads-mcp-server"],
|
|
142
|
+
"env": {
|
|
143
|
+
"GOOGLE_ADS_DEVELOPER_TOKEN": "your-developer-token",
|
|
144
|
+
"GOOGLE_ADS_CLIENT_ID": "your-client-id",
|
|
145
|
+
"GOOGLE_ADS_CLIENT_SECRET": "your-client-secret",
|
|
146
|
+
"GOOGLE_ADS_REFRESH_TOKEN": "your-refresh-token"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Restart Claude Desktop. Ask it: *"list my Google Ads accounts"*.
|
|
154
|
+
|
|
155
|
+
### Claude Code
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
claude mcp add google-ads --env GOOGLE_ADS_DEVELOPER_TOKEN=... --env GOOGLE_ADS_CLIENT_ID=... --env GOOGLE_ADS_CLIENT_SECRET=... --env GOOGLE_ADS_REFRESH_TOKEN=... -- npx -y @getmcpads/google-ads-mcp-server
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Cursor
|
|
162
|
+
|
|
163
|
+
`.cursor/mcp.json` in your project, same shape as the Claude Desktop config above.
|
|
164
|
+
|
|
165
|
+
### From source
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
git clone https://github.com/getmcpads-com/google-ads-mcp-server.git
|
|
169
|
+
cd google-ads-mcp-server
|
|
170
|
+
npm install && npm run build
|
|
171
|
+
cp .env.example .env # then fill in your credentials
|
|
172
|
+
npm start
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Configuration
|
|
176
|
+
|
|
177
|
+
| Variable | Default | Meaning |
|
|
178
|
+
|---|---|---|
|
|
179
|
+
| `GOOGLE_ADS_DEVELOPER_TOKEN` | none | **Required.** From the API Center, Basic Access or above |
|
|
180
|
+
| `GOOGLE_ADS_CLIENT_ID` | none | **Required.** OAuth client ID |
|
|
181
|
+
| `GOOGLE_ADS_CLIENT_SECRET` | none | **Required.** OAuth client secret |
|
|
182
|
+
| `GOOGLE_ADS_REFRESH_TOKEN` | none | **Required.** From the consent flow |
|
|
183
|
+
| `GOOGLE_ADS_LOGIN_CUSTOMER_ID` | none | Optional. Manager (MCC) account ID |
|
|
184
|
+
| `GOOGLE_ADS_ENABLE_WRITES` | *unset* | Set to `1` to register the 7 write tools |
|
|
185
|
+
| `LOG_LEVEL` | `info` | `debug`, `info`, `warn`, `error` |
|
|
186
|
+
|
|
187
|
+
Check your setup at any time:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
npm run doctor
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Writes, and why they preview first
|
|
196
|
+
|
|
197
|
+
Write tools are **disabled by default**. Enable them with `GOOGLE_ADS_ENABLE_WRITES=1`.
|
|
198
|
+
Google's own server has none at all, so this is the part to read carefully.
|
|
199
|
+
|
|
200
|
+
When enabled, every write tool returns a preview and changes nothing:
|
|
201
|
+
|
|
202
|
+
```jsonc
|
|
203
|
+
// google_ads_update_campaign_budget { customerId: "123-456-7890", budgetId: "555", dailyAmount: 50 }
|
|
204
|
+
{
|
|
205
|
+
"applied": false,
|
|
206
|
+
"action": "google_ads_update_campaign_budget",
|
|
207
|
+
"change": { "customer": "1234567890", "budget": "555",
|
|
208
|
+
"newDailyBudget": 50, "inMicros": 50000000 },
|
|
209
|
+
"message": "Preview only, nothing was changed. Repeat the same call with confirm: true to apply this change to the live account."
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Only a second call carrying `confirm: true` touches the live account.
|
|
214
|
+
|
|
215
|
+
This is deliberate. An assistant composes these calls, and it can pick the wrong customer, the
|
|
216
|
+
wrong campaign, or the wrong order of magnitude on a budget. A mandatory preview makes the
|
|
217
|
+
mistake visible before it costs money, and gives a human the stopping point the protocol does
|
|
218
|
+
not guarantee on its own.
|
|
219
|
+
|
|
220
|
+
Two further guardrails:
|
|
221
|
+
|
|
222
|
+
- **`google_ads_create_campaign` always creates the campaign `PAUSED`.** There is no option to
|
|
223
|
+
create it active. Someone has to look at it before it spends.
|
|
224
|
+
- **Amounts are converted to micros for you.** Google holds money in millionths, so 12.50 in
|
|
225
|
+
the account currency is `12500000`. The preview shows both, so a factor-of-a-thousand
|
|
226
|
+
mistake is visible before it applies.
|
|
227
|
+
|
|
228
|
+
| Tool | What it changes |
|
|
229
|
+
|---|---|
|
|
230
|
+
| `google_ads_update_campaign_status` / `google_ads_update_adgroup_status` | Pause, re-enable or remove |
|
|
231
|
+
| `google_ads_update_campaign_budget` | Daily budget |
|
|
232
|
+
| `google_ads_update_adgroup_bid` | Default CPC bid |
|
|
233
|
+
| `google_ads_update_campaign_schedule` | Start and end dates |
|
|
234
|
+
| `google_ads_rename_campaign` | Name only |
|
|
235
|
+
| `google_ads_create_campaign` | Creates a budget, then a campaign, always `PAUSED` |
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## Tools
|
|
240
|
+
|
|
241
|
+
<details>
|
|
242
|
+
<summary><b>31 read tools</b></summary>
|
|
243
|
+
|
|
244
|
+
### Discovery and health
|
|
245
|
+
| Tool | Purpose |
|
|
246
|
+
|---|---|
|
|
247
|
+
| `google_ads_health_check` | Validates all four credentials and lists reachable accounts |
|
|
248
|
+
| `google_ads_list_accounts` | Every account the credentials can reach |
|
|
249
|
+
| `google_ads_get_account_details` | Currency, timezone, status, account settings |
|
|
250
|
+
| `google_ads_get_account_hierarchy` | The MCC tree above and below an account |
|
|
251
|
+
|
|
252
|
+
### Structure and settings
|
|
253
|
+
| Tool | Purpose |
|
|
254
|
+
|---|---|
|
|
255
|
+
| `google_ads_get_campaigns` / `google_ads_get_adgroups` | List entities and their settings |
|
|
256
|
+
| `google_ads_get_budgets` / `google_ads_get_bidding_strategies` | Budgets and bidding configuration |
|
|
257
|
+
| `google_ads_get_conversion_actions` | Conversion actions and their settings |
|
|
258
|
+
| `google_ads_get_change_events` | Change history: who changed what, and when |
|
|
259
|
+
|
|
260
|
+
### Performance
|
|
261
|
+
| Tool | Purpose |
|
|
262
|
+
|---|---|
|
|
263
|
+
| `google_ads_get_insights` | The main reporting tool. Named metrics, no GAQL required |
|
|
264
|
+
| `google_ads_validate_query` | Check a metric and dimension combination *before* running it |
|
|
265
|
+
| `google_ads_get_keyword_performance` / `google_ads_get_search_terms` | Keyword and query performance |
|
|
266
|
+
| `google_ads_get_landing_pages` | Landing page performance |
|
|
267
|
+
| `google_ads_get_paid_organic_search_terms` | Paid and organic side by side |
|
|
268
|
+
| `google_ads_get_simulations` | Bid and budget simulations |
|
|
269
|
+
| `google_ads_get_recommendations` | Google's own recommendations for the account |
|
|
270
|
+
|
|
271
|
+
### Performance Max and Shopping
|
|
272
|
+
| Tool | Purpose |
|
|
273
|
+
|---|---|
|
|
274
|
+
| `google_ads_get_pmax_assets` / `google_ads_get_pmax_asset_diagnostics` | Asset groups, assets and their issues |
|
|
275
|
+
| `google_ads_get_pmax_placements` | Where Performance Max actually served |
|
|
276
|
+
| `google_ads_get_shopping_performance` / `google_ads_get_shopping_products` | Shopping performance and product data |
|
|
277
|
+
|
|
278
|
+
### Keyword Planner
|
|
279
|
+
| Tool | Purpose |
|
|
280
|
+
|---|---|
|
|
281
|
+
| `google_ads_generate_keyword_ideas` | Keyword ideas from seeds or a URL |
|
|
282
|
+
| `google_ads_generate_keyword_historical_metrics` | Volumes, competition, trends |
|
|
283
|
+
| `google_ads_generate_keyword_forecast_metrics` | Forecast clicks, cost and conversions |
|
|
284
|
+
| `google_ads_generate_ad_group_themes` | Suggested ad group groupings |
|
|
285
|
+
| `google_ads_suggest_geo_targets` | Resolve place names to geo target constants |
|
|
286
|
+
|
|
287
|
+
### Escape hatches
|
|
288
|
+
| Tool | Purpose |
|
|
289
|
+
|---|---|
|
|
290
|
+
| `google_ads_run_gaql` | Run a raw read-only GAQL SELECT |
|
|
291
|
+
| `google_ads_run_readonly_rpc` | Call an allowlisted non-GAQL read service: Reach Planner, audience insights, benchmarks |
|
|
292
|
+
| `google_ads_search_fields` | Search the API field schema |
|
|
293
|
+
|
|
294
|
+
These exist so a new field or service doesn't require a new release. Only read-only
|
|
295
|
+
statements and an allowlist of services are accepted.
|
|
296
|
+
|
|
297
|
+
</details>
|
|
298
|
+
|
|
299
|
+
<details>
|
|
300
|
+
<summary><b>5 resources</b></summary>
|
|
301
|
+
|
|
302
|
+
| URI | Contents |
|
|
303
|
+
|---|---|
|
|
304
|
+
| `google-ads://manifest` | What this server exposes, and which tool to run first |
|
|
305
|
+
| `google-ads://metrics` | All 130 metrics with categories and formats |
|
|
306
|
+
| `google-ads://dimensions` | All 84 dimensions and where they are valid |
|
|
307
|
+
| `google-ads://compatibility` | The compatibility matrix |
|
|
308
|
+
| `google-ads://recipes` | 11 step-by-step workflows |
|
|
309
|
+
|
|
310
|
+
</details>
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
## Security
|
|
315
|
+
|
|
316
|
+
This server holds a refresh token that never expires, a client secret and a developer token.
|
|
317
|
+
Concretely:
|
|
318
|
+
|
|
319
|
+
- **None of the four credentials is ever logged**, at any log level, or written to disk.
|
|
320
|
+
- **The access token is cached in memory** until a minute before expiry, rather than
|
|
321
|
+
re-requested on every call.
|
|
322
|
+
- **Two hosts are contacted, and only two**: `googleads.googleapis.com` and
|
|
323
|
+
`oauth2.googleapis.com`. *A test fails the build if a third host appears in the source.*
|
|
324
|
+
- **No fetch follows a redirect.** Every outbound call sets `redirect: "error"`, so a redirect
|
|
325
|
+
cannot forward a bearer token or client secret to another host. *A test fails the build if
|
|
326
|
+
any fetch omits this.*
|
|
327
|
+
- **No telemetry.** The server makes no network call other than to Google.
|
|
328
|
+
|
|
329
|
+
Full policy and reporting instructions: [SECURITY.md](SECURITY.md).
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
## Looking for a managed, multi-platform version?
|
|
334
|
+
|
|
335
|
+
This server does one platform, on your machine, with your credentials. That is on purpose.
|
|
336
|
+
|
|
337
|
+
If you'd rather not run it yourself, or you need Google Ads **alongside Meta Ads, TikTok Ads,
|
|
338
|
+
Pinterest Ads, GA4 and Search Console** behind one endpoint, with hosted OAuth and
|
|
339
|
+
cross-platform reporting, that's what we build at **[getmcpads.com](https://www.getmcpads.com)**.
|
|
340
|
+
|
|
341
|
+
Same philosophy, less plumbing. This project stays open source and independently useful
|
|
342
|
+
either way.
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
## Contributing
|
|
347
|
+
|
|
348
|
+
Issues and pull requests are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
349
|
+
Please read [SECURITY.md](SECURITY.md) before reporting anything security-related.
|
|
350
|
+
|
|
351
|
+
## Licence
|
|
352
|
+
|
|
353
|
+
[Apache License 2.0](LICENSE). See also [NOTICE](NOTICE).
|
|
354
|
+
|
|
355
|
+
Google, Google Ads and the Google Ads API are trademarks of Google LLC.
|
|
356
|
+
**This project is not affiliated with, endorsed by, or sponsored by Google LLC.**
|
|
357
|
+
It is an independent client of a public API.
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|