@cesteral/gads-mcp 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.md +201 -0
- package/README.md +262 -0
- package/dist/auth/gads-auth-adapter.d.ts +31 -0
- package/dist/auth/gads-auth-adapter.d.ts.map +1 -0
- package/dist/auth/gads-auth-adapter.js +70 -0
- package/dist/auth/gads-auth-adapter.js.map +1 -0
- package/dist/auth/gads-auth-strategy.d.ts +9 -0
- package/dist/auth/gads-auth-strategy.d.ts.map +1 -0
- package/dist/auth/gads-auth-strategy.js +27 -0
- package/dist/auth/gads-auth-strategy.js.map +1 -0
- package/dist/config/index.d.ts +100 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +37 -0
- package/dist/config/index.js.map +1 -0
- package/dist/container/index.d.ts +5 -0
- package/dist/container/index.d.ts.map +1 -0
- package/dist/container/index.js +14 -0
- package/dist/container/index.js.map +1 -0
- package/dist/container/registrations/core.d.ts +3 -0
- package/dist/container/registrations/core.d.ts.map +1 -0
- package/dist/container/registrations/core.js +14 -0
- package/dist/container/registrations/core.js.map +1 -0
- package/dist/container/registrations/mcp.d.ts +2 -0
- package/dist/container/registrations/mcp.d.ts.map +1 -0
- package/dist/container/registrations/mcp.js +3 -0
- package/dist/container/registrations/mcp.js.map +1 -0
- package/dist/container/tokens.d.ts +6 -0
- package/dist/container/tokens.d.ts.map +1 -0
- package/dist/container/tokens.js +6 -0
- package/dist/container/tokens.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +50 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server/prompts/definitions/bulk-operations-workflow.prompt.d.ts +4 -0
- package/dist/mcp-server/prompts/definitions/bulk-operations-workflow.prompt.d.ts.map +1 -0
- package/dist/mcp-server/prompts/definitions/bulk-operations-workflow.prompt.js +230 -0
- package/dist/mcp-server/prompts/definitions/bulk-operations-workflow.prompt.js.map +1 -0
- package/dist/mcp-server/prompts/definitions/campaign-setup-workflow.prompt.d.ts +4 -0
- package/dist/mcp-server/prompts/definitions/campaign-setup-workflow.prompt.d.ts.map +1 -0
- package/dist/mcp-server/prompts/definitions/campaign-setup-workflow.prompt.js +237 -0
- package/dist/mcp-server/prompts/definitions/campaign-setup-workflow.prompt.js.map +1 -0
- package/dist/mcp-server/prompts/definitions/creative-setup-workflow.prompt.d.ts +4 -0
- package/dist/mcp-server/prompts/definitions/creative-setup-workflow.prompt.d.ts.map +1 -0
- package/dist/mcp-server/prompts/definitions/creative-setup-workflow.prompt.js +154 -0
- package/dist/mcp-server/prompts/definitions/creative-setup-workflow.prompt.js.map +1 -0
- package/dist/mcp-server/prompts/definitions/cross-platform-campaign-setup.prompt.d.ts +4 -0
- package/dist/mcp-server/prompts/definitions/cross-platform-campaign-setup.prompt.d.ts.map +1 -0
- package/dist/mcp-server/prompts/definitions/cross-platform-campaign-setup.prompt.js +299 -0
- package/dist/mcp-server/prompts/definitions/cross-platform-campaign-setup.prompt.js.map +1 -0
- package/dist/mcp-server/prompts/definitions/cross-platform-performance.prompt.d.ts +4 -0
- package/dist/mcp-server/prompts/definitions/cross-platform-performance.prompt.d.ts.map +1 -0
- package/dist/mcp-server/prompts/definitions/cross-platform-performance.prompt.js +170 -0
- package/dist/mcp-server/prompts/definitions/cross-platform-performance.prompt.js.map +1 -0
- package/dist/mcp-server/prompts/definitions/entity-duplication-workflow.prompt.d.ts +4 -0
- package/dist/mcp-server/prompts/definitions/entity-duplication-workflow.prompt.d.ts.map +1 -0
- package/dist/mcp-server/prompts/definitions/entity-duplication-workflow.prompt.js +221 -0
- package/dist/mcp-server/prompts/definitions/entity-duplication-workflow.prompt.js.map +1 -0
- package/dist/mcp-server/prompts/definitions/entity-update-workflow.prompt.d.ts +4 -0
- package/dist/mcp-server/prompts/definitions/entity-update-workflow.prompt.d.ts.map +1 -0
- package/dist/mcp-server/prompts/definitions/entity-update-workflow.prompt.js +207 -0
- package/dist/mcp-server/prompts/definitions/entity-update-workflow.prompt.js.map +1 -0
- package/dist/mcp-server/prompts/definitions/gaql-reporting-workflow.prompt.d.ts +4 -0
- package/dist/mcp-server/prompts/definitions/gaql-reporting-workflow.prompt.d.ts.map +1 -0
- package/dist/mcp-server/prompts/definitions/gaql-reporting-workflow.prompt.js +182 -0
- package/dist/mcp-server/prompts/definitions/gaql-reporting-workflow.prompt.js.map +1 -0
- package/dist/mcp-server/prompts/definitions/targeting-discovery-workflow.prompt.d.ts +4 -0
- package/dist/mcp-server/prompts/definitions/targeting-discovery-workflow.prompt.d.ts.map +1 -0
- package/dist/mcp-server/prompts/definitions/targeting-discovery-workflow.prompt.js +223 -0
- package/dist/mcp-server/prompts/definitions/targeting-discovery-workflow.prompt.js.map +1 -0
- package/dist/mcp-server/prompts/definitions/tool-schema-exploration.prompt.d.ts +4 -0
- package/dist/mcp-server/prompts/definitions/tool-schema-exploration.prompt.d.ts.map +1 -0
- package/dist/mcp-server/prompts/definitions/tool-schema-exploration.prompt.js +125 -0
- package/dist/mcp-server/prompts/definitions/tool-schema-exploration.prompt.js.map +1 -0
- package/dist/mcp-server/prompts/definitions/troubleshoot-entity.prompt.d.ts +4 -0
- package/dist/mcp-server/prompts/definitions/troubleshoot-entity.prompt.d.ts.map +1 -0
- package/dist/mcp-server/prompts/definitions/troubleshoot-entity.prompt.js +177 -0
- package/dist/mcp-server/prompts/definitions/troubleshoot-entity.prompt.js.map +1 -0
- package/dist/mcp-server/prompts/index.d.ts +9 -0
- package/dist/mcp-server/prompts/index.d.ts.map +1 -0
- package/dist/mcp-server/prompts/index.js +97 -0
- package/dist/mcp-server/prompts/index.js.map +1 -0
- package/dist/mcp-server/resources/definitions/entity-examples.resource.d.ts +4 -0
- package/dist/mcp-server/resources/definitions/entity-examples.resource.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/entity-examples.resource.js +574 -0
- package/dist/mcp-server/resources/definitions/entity-examples.resource.js.map +1 -0
- package/dist/mcp-server/resources/definitions/entity-hierarchy.resource.d.ts +3 -0
- package/dist/mcp-server/resources/definitions/entity-hierarchy.resource.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/entity-hierarchy.resource.js +124 -0
- package/dist/mcp-server/resources/definitions/entity-hierarchy.resource.js.map +1 -0
- package/dist/mcp-server/resources/definitions/entity-schemas.resource.d.ts +4 -0
- package/dist/mcp-server/resources/definitions/entity-schemas.resource.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/entity-schemas.resource.js +264 -0
- package/dist/mcp-server/resources/definitions/entity-schemas.resource.js.map +1 -0
- package/dist/mcp-server/resources/definitions/gaql-reference.resource.d.ts +3 -0
- package/dist/mcp-server/resources/definitions/gaql-reference.resource.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/gaql-reference.resource.js +157 -0
- package/dist/mcp-server/resources/definitions/gaql-reference.resource.js.map +1 -0
- package/dist/mcp-server/resources/definitions/index.d.ts +8 -0
- package/dist/mcp-server/resources/definitions/index.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/index.js +42 -0
- package/dist/mcp-server/resources/definitions/index.js.map +1 -0
- package/dist/mcp-server/resources/definitions/insights-reference.resource.d.ts +3 -0
- package/dist/mcp-server/resources/definitions/insights-reference.resource.d.ts.map +1 -0
- package/dist/mcp-server/resources/definitions/insights-reference.resource.js +78 -0
- package/dist/mcp-server/resources/definitions/insights-reference.resource.js.map +1 -0
- package/dist/mcp-server/resources/index.d.ts +3 -0
- package/dist/mcp-server/resources/index.d.ts.map +1 -0
- package/dist/mcp-server/resources/index.js +2 -0
- package/dist/mcp-server/resources/index.js.map +1 -0
- package/dist/mcp-server/resources/types.d.ts +8 -0
- package/dist/mcp-server/resources/types.d.ts.map +1 -0
- package/dist/mcp-server/resources/types.js +2 -0
- package/dist/mcp-server/resources/types.js.map +1 -0
- package/dist/mcp-server/server.d.ts +5 -0
- package/dist/mcp-server/server.d.ts.map +1 -0
- package/dist/mcp-server/server.js +124 -0
- package/dist/mcp-server/server.js.map +1 -0
- package/dist/mcp-server/tools/definitions/adjust-bids.tool.d.ts +270 -0
- package/dist/mcp-server/tools/definitions/adjust-bids.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/adjust-bids.tool.js +189 -0
- package/dist/mcp-server/tools/definitions/adjust-bids.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/bulk-create-entities.tool.d.ts +148 -0
- package/dist/mcp-server/tools/definitions/bulk-create-entities.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/bulk-create-entities.tool.js +141 -0
- package/dist/mcp-server/tools/definitions/bulk-create-entities.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/bulk-mutate.tool.d.ts +136 -0
- package/dist/mcp-server/tools/definitions/bulk-mutate.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/bulk-mutate.tool.js +127 -0
- package/dist/mcp-server/tools/definitions/bulk-mutate.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/bulk-update-status.tool.d.ts +185 -0
- package/dist/mcp-server/tools/definitions/bulk-update-status.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/bulk-update-status.tool.js +149 -0
- package/dist/mcp-server/tools/definitions/bulk-update-status.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/create-entity.tool.d.ts +123 -0
- package/dist/mcp-server/tools/definitions/create-entity.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/create-entity.tool.js +98 -0
- package/dist/mcp-server/tools/definitions/create-entity.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/gaql-search.tool.d.ts +197 -0
- package/dist/mcp-server/tools/definitions/gaql-search.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/gaql-search.tool.js +110 -0
- package/dist/mcp-server/tools/definitions/gaql-search.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-ad-preview.tool.d.ts +87 -0
- package/dist/mcp-server/tools/definitions/get-ad-preview.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-ad-preview.tool.js +91 -0
- package/dist/mcp-server/tools/definitions/get-ad-preview.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-entity.tool.d.ts +92 -0
- package/dist/mcp-server/tools/definitions/get-entity.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-entity.tool.js +87 -0
- package/dist/mcp-server/tools/definitions/get-entity.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-insights.tool.d.ts +382 -0
- package/dist/mcp-server/tools/definitions/get-insights.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-insights.tool.js +246 -0
- package/dist/mcp-server/tools/definitions/get-insights.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-pacing-status.tool.d.ts +141 -0
- package/dist/mcp-server/tools/definitions/get-pacing-status.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-pacing-status.tool.js +163 -0
- package/dist/mcp-server/tools/definitions/get-pacing-status.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/index.d.ts +18 -0
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/index.js +53 -0
- package/dist/mcp-server/tools/definitions/index.js.map +1 -0
- package/dist/mcp-server/tools/definitions/list-accounts.tool.d.ts +54 -0
- package/dist/mcp-server/tools/definitions/list-accounts.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/list-accounts.tool.js +61 -0
- package/dist/mcp-server/tools/definitions/list-accounts.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/list-entities.tool.d.ts +220 -0
- package/dist/mcp-server/tools/definitions/list-entities.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/list-entities.tool.js +112 -0
- package/dist/mcp-server/tools/definitions/list-entities.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/remove-entity.tool.d.ts +116 -0
- package/dist/mcp-server/tools/definitions/remove-entity.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/remove-entity.tool.js +120 -0
- package/dist/mcp-server/tools/definitions/remove-entity.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/update-entity.tool.d.ts +129 -0
- package/dist/mcp-server/tools/definitions/update-entity.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/update-entity.tool.js +91 -0
- package/dist/mcp-server/tools/definitions/update-entity.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/validate-entity.tool.d.ts +239 -0
- package/dist/mcp-server/tools/definitions/validate-entity.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/validate-entity.tool.js +151 -0
- package/dist/mcp-server/tools/definitions/validate-entity.tool.js.map +1 -0
- package/dist/mcp-server/tools/index.d.ts +2 -0
- package/dist/mcp-server/tools/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/index.js +2 -0
- package/dist/mcp-server/tools/index.js.map +1 -0
- package/dist/mcp-server/tools/utils/computed-metrics.d.ts +8 -0
- package/dist/mcp-server/tools/utils/computed-metrics.d.ts.map +1 -0
- package/dist/mcp-server/tools/utils/computed-metrics.js +19 -0
- package/dist/mcp-server/tools/utils/computed-metrics.js.map +1 -0
- package/dist/mcp-server/tools/utils/entity-mapping.d.ts +22 -0
- package/dist/mcp-server/tools/utils/entity-mapping.d.ts.map +1 -0
- package/dist/mcp-server/tools/utils/entity-mapping.js +99 -0
- package/dist/mcp-server/tools/utils/entity-mapping.js.map +1 -0
- package/dist/mcp-server/tools/utils/gaql-helpers.d.ts +4 -0
- package/dist/mcp-server/tools/utils/gaql-helpers.d.ts.map +1 -0
- package/dist/mcp-server/tools/utils/gaql-helpers.js +82 -0
- package/dist/mcp-server/tools/utils/gaql-helpers.js.map +1 -0
- package/dist/mcp-server/tools/utils/parent-id-validation.d.ts +10 -0
- package/dist/mcp-server/tools/utils/parent-id-validation.d.ts.map +1 -0
- package/dist/mcp-server/tools/utils/parent-id-validation.js +58 -0
- package/dist/mcp-server/tools/utils/parent-id-validation.js.map +1 -0
- package/dist/mcp-server/tools/utils/resolve-session.d.ts +4 -0
- package/dist/mcp-server/tools/utils/resolve-session.d.ts.map +1 -0
- package/dist/mcp-server/tools/utils/resolve-session.js +6 -0
- package/dist/mcp-server/tools/utils/resolve-session.js.map +1 -0
- package/dist/mcp-server/transports/streamable-http-transport.d.ts +49 -0
- package/dist/mcp-server/transports/streamable-http-transport.d.ts.map +1 -0
- package/dist/mcp-server/transports/streamable-http-transport.js +84 -0
- package/dist/mcp-server/transports/streamable-http-transport.js.map +1 -0
- package/dist/services/gads/gads-http-client.d.ts +13 -0
- package/dist/services/gads/gads-http-client.d.ts.map +1 -0
- package/dist/services/gads/gads-http-client.js +113 -0
- package/dist/services/gads/gads-http-client.js.map +1 -0
- package/dist/services/gads/gads-service.d.ts +60 -0
- package/dist/services/gads/gads-service.d.ts.map +1 -0
- package/dist/services/gads/gads-service.js +363 -0
- package/dist/services/gads/gads-service.js.map +1 -0
- package/dist/services/gads/types.d.ts +211 -0
- package/dist/services/gads/types.d.ts.map +1 -0
- package/dist/services/gads/types.js +16 -0
- package/dist/services/gads/types.js.map +1 -0
- package/dist/services/session-services.d.ts +17 -0
- package/dist/services/session-services.d.ts.map +1 -0
- package/dist/services/session-services.js +14 -0
- package/dist/services/session-services.js.map +1 -0
- package/dist/types-global/mcp.d.ts +2 -0
- package/dist/types-global/mcp.d.ts.map +1 -0
- package/dist/types-global/mcp.js +2 -0
- package/dist/types-global/mcp.js.map +1 -0
- package/dist/utils/errors/index.d.ts +2 -0
- package/dist/utils/errors/index.d.ts.map +1 -0
- package/dist/utils/errors/index.js +2 -0
- package/dist/utils/errors/index.js.map +1 -0
- package/dist/utils/platform.d.ts +3 -0
- package/dist/utils/platform.d.ts.map +1 -0
- package/dist/utils/platform.js +5 -0
- package/dist/utils/platform.js.map +1 -0
- package/dist/utils/security/rate-limiter.d.ts +3 -0
- package/dist/utils/security/rate-limiter.d.ts.map +1 -0
- package/dist/utils/security/rate-limiter.js +5 -0
- package/dist/utils/security/rate-limiter.js.map +1 -0
- package/dist/utils/telemetry/index.d.ts +2 -0
- package/dist/utils/telemetry/index.d.ts.map +1 -0
- package/dist/utils/telemetry/index.js +2 -0
- package/dist/utils/telemetry/index.js.map +1 -0
- package/dist/utils/telemetry/tracing.d.ts +3 -0
- package/dist/utils/telemetry/tracing.d.ts.map +1 -0
- package/dist/utils/telemetry/tracing.js +4 -0
- package/dist/utils/telemetry/tracing.js.map +1 -0
- package/package.json +56 -0
package/LICENSE.md
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/README.md
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
# @cesteral/gads-mcp
|
|
2
|
+
|
|
3
|
+
Google Ads MCP Server - Campaign entity management and reporting via Google Ads REST API v23.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
Management and reporting server for Google Ads. Provides full CRUD operations on Google Ads campaign entities (campaigns, ad groups, ads, keywords, assets, budgets) and arbitrary GAQL query execution. Designed for AI agents to manage Google Ads campaigns programmatically through the Model Context Protocol.
|
|
8
|
+
|
|
9
|
+
## Choose Your Path
|
|
10
|
+
|
|
11
|
+
- **Self-host this connector** when you want direct control of credentials,
|
|
12
|
+
infrastructure, and Google Ads API access.
|
|
13
|
+
- **Use Cesteral Intelligence** when the workflow needs approvals before spend
|
|
14
|
+
commits, credential brokering, auditability, and cross-platform execution.
|
|
15
|
+
|
|
16
|
+
[Self-host quickstart](../../docs/guides/quickstart.md) | [Compare OSS vs Cesteral Intelligence](https://cesteral.com/compare?utm_source=github&utm_medium=package-readme&utm_campaign=gads-mcp) | [Book a workflow demo](mailto:sales@cesteral.com?subject=Workflow%20demo%20-%20Google%20Ads%20MCP)
|
|
17
|
+
|
|
18
|
+
## Features
|
|
19
|
+
|
|
20
|
+
- **Per-session authentication** via `SessionServiceStore` pattern
|
|
21
|
+
- **OAuth2 refresh token auth** using `X-GAds-*` headers (developer token, client ID, client secret, refresh token)
|
|
22
|
+
- **OpenTelemetry** instrumentation for traces and metrics
|
|
23
|
+
- **Rate limiting** via shared `RateLimiter` class
|
|
24
|
+
- **MCP protocol** with Streamable HTTP transport (Hono)
|
|
25
|
+
- **Structured output** with `outputSchema` on all tools
|
|
26
|
+
- **GAQL query support** for flexible read operations
|
|
27
|
+
|
|
28
|
+
## MCP Tools
|
|
29
|
+
|
|
30
|
+
### Read Tools
|
|
31
|
+
|
|
32
|
+
#### 1. `gads_gaql_search`
|
|
33
|
+
|
|
34
|
+
Execute arbitrary GAQL queries against the Google Ads API.
|
|
35
|
+
|
|
36
|
+
**Parameters:**
|
|
37
|
+
|
|
38
|
+
- `customerId` (string): Google Ads customer ID (no dashes)
|
|
39
|
+
- `query` (string): GAQL query string
|
|
40
|
+
- `pageSize` (number, optional): _Deprecated._ Use `maxRows` instead.
|
|
41
|
+
- `pageToken` (string, optional): Cursor for the next upstream page (different from `offset` which slices the in-memory buffer)
|
|
42
|
+
- `mode`, `columns`, `maxRows` (optional): Bounded report-view params — `mode` is `"summary"` (default — headers + counts + 10-row preview) or `"rows"` (paginated rows page); `columns` projects to selected columns; `maxRows` caps page size (default 10/50; hard cap 200). `offset` is not supported here — paginate via `pageToken`.
|
|
43
|
+
|
|
44
|
+
#### 2. `gads_list_accounts`
|
|
45
|
+
|
|
46
|
+
List all Google Ads customer accounts accessible to the authenticated user.
|
|
47
|
+
|
|
48
|
+
**Parameters:** None
|
|
49
|
+
|
|
50
|
+
#### 3. `gads_get_entity`
|
|
51
|
+
|
|
52
|
+
Get a single Google Ads entity by type and ID.
|
|
53
|
+
|
|
54
|
+
**Parameters:**
|
|
55
|
+
|
|
56
|
+
- `entityType` (string): Type of entity to retrieve
|
|
57
|
+
- `customerId` (string): Google Ads customer ID
|
|
58
|
+
- `entityId` (string): The entity ID
|
|
59
|
+
|
|
60
|
+
#### 4. `gads_list_entities`
|
|
61
|
+
|
|
62
|
+
List entities with optional GAQL filters and pagination.
|
|
63
|
+
|
|
64
|
+
**Parameters:**
|
|
65
|
+
|
|
66
|
+
- `entityType` (string): Type of entities to list
|
|
67
|
+
- `customerId` (string): Google Ads customer ID
|
|
68
|
+
- `filters` (object, optional): GAQL filter conditions
|
|
69
|
+
- `pageSize` (number, optional): Results per page (default 100, max 10000)
|
|
70
|
+
- `pageToken` (string, optional): Pagination token
|
|
71
|
+
- `orderBy` (string, optional): GAQL ORDER BY clause
|
|
72
|
+
|
|
73
|
+
#### 5. `gads_get_insights`
|
|
74
|
+
|
|
75
|
+
Get performance insights for Google Ads entities using preset parameters. Convenience wrapper around GAQL.
|
|
76
|
+
|
|
77
|
+
**Parameters:**
|
|
78
|
+
|
|
79
|
+
- `customerId` (string): Google Ads customer ID
|
|
80
|
+
- `entityType` (string): Entity type (`campaign`, `adGroup`, `ad`, `keyword`)
|
|
81
|
+
- `entityId` (string, optional): Filter to a specific entity
|
|
82
|
+
- `dateRange` (string): Date range preset (`TODAY`, `YESTERDAY`, `LAST_7_DAYS`, `LAST_30_DAYS`, `THIS_MONTH`, `LAST_MONTH`, `LAST_90_DAYS`)
|
|
83
|
+
- `metrics` (string[], optional): Custom metrics (defaults to impressions, clicks, cost_micros, conversions, ctr, average_cpc)
|
|
84
|
+
- `limit` (number, optional): _Deprecated._ Use `maxRows` instead.
|
|
85
|
+
- `mode`, `columns`, `offset`, `maxRows` (optional): Bounded report-view params — `mode` is `"summary"` (default) or `"rows"`; `columns` projects to selected columns; `offset` paginates; `maxRows` caps page size (default 10/50; hard cap 200).
|
|
86
|
+
|
|
87
|
+
### Write Tools
|
|
88
|
+
|
|
89
|
+
#### 6. `gads_create_entity`
|
|
90
|
+
|
|
91
|
+
Create a new Google Ads entity via the :mutate API.
|
|
92
|
+
|
|
93
|
+
**Parameters:**
|
|
94
|
+
|
|
95
|
+
- `entityType` (string): Type of entity to create
|
|
96
|
+
- `customerId` (string): Google Ads customer ID
|
|
97
|
+
- `data` (object): Entity data fields
|
|
98
|
+
|
|
99
|
+
#### 7. `gads_update_entity`
|
|
100
|
+
|
|
101
|
+
Update an existing entity with updateMask discipline.
|
|
102
|
+
|
|
103
|
+
**Parameters:**
|
|
104
|
+
|
|
105
|
+
- `entityType` (string): Type of entity to update
|
|
106
|
+
- `customerId` (string): Google Ads customer ID
|
|
107
|
+
- `entityId` (string): The entity ID
|
|
108
|
+
- `data` (object): Fields to update
|
|
109
|
+
- `updateMask` (string): Comma-separated list of fields to update
|
|
110
|
+
|
|
111
|
+
#### 8. `gads_remove_entity`
|
|
112
|
+
|
|
113
|
+
Remove an entity via the :mutate API (sets status to REMOVED).
|
|
114
|
+
|
|
115
|
+
**Parameters:**
|
|
116
|
+
|
|
117
|
+
- `entityType` (string): Type of entity to remove
|
|
118
|
+
- `customerId` (string): Google Ads customer ID
|
|
119
|
+
- `entityId` (string): The entity ID
|
|
120
|
+
|
|
121
|
+
#### 9. `gads_bulk_mutate`
|
|
122
|
+
|
|
123
|
+
Execute multiple create/update/remove operations in a single API call.
|
|
124
|
+
|
|
125
|
+
**Parameters:**
|
|
126
|
+
|
|
127
|
+
- `entityType` (string): Type of entities to mutate
|
|
128
|
+
- `customerId` (string): Google Ads customer ID
|
|
129
|
+
- `operations` (array): Array of mutate operation objects
|
|
130
|
+
- `partialFailure` (boolean, optional): Allow partial success (default: false)
|
|
131
|
+
|
|
132
|
+
#### 10. `gads_bulk_update_status`
|
|
133
|
+
|
|
134
|
+
Batch update statuses for multiple entities.
|
|
135
|
+
|
|
136
|
+
**Parameters:**
|
|
137
|
+
|
|
138
|
+
- `entityType` (string): Type of entities to update
|
|
139
|
+
- `customerId` (string): Google Ads customer ID
|
|
140
|
+
- `entityIds` (string[]): Entity IDs to update (max 100)
|
|
141
|
+
- `status` (string): `ENABLED`, `PAUSED`, or `REMOVED`
|
|
142
|
+
|
|
143
|
+
#### 11. `gads_adjust_bids`
|
|
144
|
+
|
|
145
|
+
Batch adjust ad group bids with safe read-modify-write pattern.
|
|
146
|
+
|
|
147
|
+
**Parameters:**
|
|
148
|
+
|
|
149
|
+
- `customerId` (string): Google Ads customer ID
|
|
150
|
+
- `adjustments` (array): Array of bid adjustments (max 50), each with `adGroupId` and optional `cpcBidMicros`/`cpmBidMicros`
|
|
151
|
+
- `reason` (string, optional): Reason for the bid adjustment (for audit trail)
|
|
152
|
+
|
|
153
|
+
### Validate Tools
|
|
154
|
+
|
|
155
|
+
#### 12. `gads_validate_entity`
|
|
156
|
+
|
|
157
|
+
Dry-run validate an entity payload via the Google Ads API with `validateOnly: true`.
|
|
158
|
+
|
|
159
|
+
**Parameters:**
|
|
160
|
+
|
|
161
|
+
- `entityType` (string): Type of entity to validate
|
|
162
|
+
- `customerId` (string): Google Ads customer ID
|
|
163
|
+
- `mode` (string): `create` or `update`
|
|
164
|
+
- `data` (object): Entity data to validate
|
|
165
|
+
- `entityId` (string, optional): Required for update mode
|
|
166
|
+
- `updateMask` (string, optional): Required for update mode
|
|
167
|
+
|
|
168
|
+
## Supported Entity Types
|
|
169
|
+
|
|
170
|
+
| Entity Type | GAQL Resource | Mutate Endpoint | Notes |
|
|
171
|
+
| ---------------- | -------------------- | ------------------------ | ----------------------------------------- |
|
|
172
|
+
| `campaign` | `campaign` | `campaigns:mutate` | Requires campaignBudget reference |
|
|
173
|
+
| `adGroup` | `ad_group` | `adGroups:mutate` | Requires campaign reference |
|
|
174
|
+
| `ad` | `ad_group_ad` | `adGroupAds:mutate` | Composite ID: `{adGroupId}~{adId}` |
|
|
175
|
+
| `keyword` | `ad_group_criterion` | `adGroupCriteria:mutate` | Composite ID: `{adGroupId}~{criterionId}` |
|
|
176
|
+
| `campaignBudget` | `campaign_budget` | `campaignBudgets:mutate` | Create before campaign |
|
|
177
|
+
| `asset` | `asset` | `assets:mutate` | Reusable text/image/sitelink/callout |
|
|
178
|
+
|
|
179
|
+
**Entity Hierarchy:** Customer > Campaign Budget > Campaign > Ad Group > Ad / Keyword
|
|
180
|
+
|
|
181
|
+
## Current Status
|
|
182
|
+
|
|
183
|
+
**Phase: Production-Ready**
|
|
184
|
+
|
|
185
|
+
All tools are fully implemented using Google Ads REST API v23. Entity CRUD, GAQL queries, and bulk operations are operational via OAuth2 refresh token authentication.
|
|
186
|
+
|
|
187
|
+
## Development
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
# Install dependencies
|
|
191
|
+
pnpm install
|
|
192
|
+
|
|
193
|
+
# Run in development mode
|
|
194
|
+
pnpm run dev:http
|
|
195
|
+
|
|
196
|
+
# Build
|
|
197
|
+
pnpm run build
|
|
198
|
+
|
|
199
|
+
# Start production server
|
|
200
|
+
pnpm run start
|
|
201
|
+
|
|
202
|
+
# Type check
|
|
203
|
+
pnpm run typecheck
|
|
204
|
+
|
|
205
|
+
# Run tests
|
|
206
|
+
pnpm run test
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Environment Variables
|
|
210
|
+
|
|
211
|
+
- `GADS_MCP_PORT`: Server port (default: 3004)
|
|
212
|
+
- `GADS_DEVELOPER_TOKEN`: Google Ads developer token (required for stdio mode)
|
|
213
|
+
- `GADS_CLIENT_ID`: OAuth2 client ID (required for stdio mode)
|
|
214
|
+
- `GADS_CLIENT_SECRET`: OAuth2 client secret (required for stdio mode)
|
|
215
|
+
- `GADS_REFRESH_TOKEN`: OAuth2 refresh token (required for stdio mode)
|
|
216
|
+
- `GADS_LOGIN_CUSTOMER_ID`: Manager account ID (optional, for stdio mode)
|
|
217
|
+
- `MCP_AUTH_MODE`: Authentication mode - `gads-headers` (default), `jwt`, or `none`
|
|
218
|
+
- `MCP_AUTH_SECRET_KEY`: Required when `MCP_AUTH_MODE=jwt`
|
|
219
|
+
|
|
220
|
+
## Architecture
|
|
221
|
+
|
|
222
|
+
### Key Components
|
|
223
|
+
|
|
224
|
+
- **`GAdsHttpClient`** - HTTP client for Google Ads API v23 with retry logic and error parsing
|
|
225
|
+
- **`GAdsService`** - GAQL queries, account listing, and generic CRUD via :mutate API
|
|
226
|
+
- **`GAdsRefreshTokenAuthAdapter`** - OAuth2 token caching with mutex for concurrent requests
|
|
227
|
+
- **`GAdsHeadersAuthStrategy`** - Reads credentials from request headers
|
|
228
|
+
- **`SessionServiceStore`** - Per-session service instances keyed by session ID
|
|
229
|
+
|
|
230
|
+
### Key Gotchas
|
|
231
|
+
|
|
232
|
+
- `customerId` must be numeric with no dashes (e.g., `1234567890` not `123-456-7890`)
|
|
233
|
+
- Budget amounts are in **micros** (e.g., `1000000` = $1.00)
|
|
234
|
+
- `campaignBudget` must be created before the campaign that references it
|
|
235
|
+
- `REMOVED` status is permanent — equivalent to delete
|
|
236
|
+
- `gads_validate_entity` calls the real API with `validateOnly: true` (not client-side only)
|
|
237
|
+
- Composite IDs for ads: `{adGroupId}~{adId}`, for keywords: `{adGroupId}~{criterionId}`
|
|
238
|
+
|
|
239
|
+
### Transport
|
|
240
|
+
|
|
241
|
+
- **Streamable HTTP**: MCP protocol via Hono + `@hono/mcp`
|
|
242
|
+
- **Health check**: `/health` endpoint
|
|
243
|
+
|
|
244
|
+
## Contributing
|
|
245
|
+
|
|
246
|
+
See root [CLAUDE.md](../../CLAUDE.md) for development guidelines, build system details, and monorepo conventions. See the [root README](../../README.md) for full architecture context.
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## Get Started
|
|
251
|
+
|
|
252
|
+
**Self-host**: Follow the [deployment guide](../../docs/guides/deployment-instructions.md) to run this server on your own infrastructure.
|
|
253
|
+
|
|
254
|
+
**Cesteral Intelligence**: [Request access](https://cesteral.com/integrations/google-ads?utm_source=github&utm_medium=package-readme&utm_campaign=gads-mcp) -- governed execution with credential brokering, approvals, audit, and multi-tenant access.
|
|
255
|
+
|
|
256
|
+
**Book a workflow demo**: [See it in action](mailto:sales@cesteral.com?subject=Workflow%20demo%20-%20Google%20Ads%20MCP) with your own ad accounts.
|
|
257
|
+
|
|
258
|
+
**Compare options**: [OSS connectors vs Cesteral Intelligence](https://cesteral.com/compare?utm_source=github&utm_medium=package-readme&utm_campaign=gads-mcp)
|
|
259
|
+
|
|
260
|
+
## License
|
|
261
|
+
|
|
262
|
+
Apache License 2.0 — see [LICENSE](../../LICENSE.md) for details. This package is part of Cesteral's open-source connector layer; managed hosting and higher-level governance features live outside this repository.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { OAuth2RefreshAdapterBase } from "@cesteral/shared";
|
|
2
|
+
export interface GAdsCredentials {
|
|
3
|
+
clientId: string;
|
|
4
|
+
clientSecret: string;
|
|
5
|
+
refreshToken: string;
|
|
6
|
+
developerToken: string;
|
|
7
|
+
loginCustomerId?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface GAdsAuthAdapter {
|
|
10
|
+
getAccessToken(): Promise<string>;
|
|
11
|
+
validate(): Promise<void>;
|
|
12
|
+
readonly developerToken: string;
|
|
13
|
+
readonly loginCustomerId: string | undefined;
|
|
14
|
+
}
|
|
15
|
+
export declare class GAdsRefreshTokenAuthAdapter extends OAuth2RefreshAdapterBase<{
|
|
16
|
+
appId: string;
|
|
17
|
+
appSecret: string;
|
|
18
|
+
refreshToken: string;
|
|
19
|
+
}> implements GAdsAuthAdapter {
|
|
20
|
+
private static readonly TOKEN_URL;
|
|
21
|
+
private static readonly TOKEN_TIMEOUT_MS;
|
|
22
|
+
private readonly _developerToken;
|
|
23
|
+
private readonly _loginCustomerId;
|
|
24
|
+
constructor(credentials: GAdsCredentials);
|
|
25
|
+
get developerToken(): string;
|
|
26
|
+
get loginCustomerId(): string | undefined;
|
|
27
|
+
validate(): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
export declare function parseGAdsCredentialsFromHeaders(headers: Record<string, string | string[] | undefined>): GAdsCredentials;
|
|
30
|
+
export declare function getGAdsCredentialFingerprint(credentials: GAdsCredentials): string;
|
|
31
|
+
//# sourceMappingURL=gads-auth-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gads-auth-adapter.d.ts","sourceRoot":"","sources":["../../src/auth/gads-auth-adapter.ts"],"names":[],"mappings":"AAoBA,OAAO,EAML,wBAAwB,EACzB,MAAM,kBAAkB,CAAC;AAK1B,MAAM,WAAW,eAAe;IAE9B,QAAQ,EAAE,MAAM,CAAC;IAEjB,YAAY,EAAE,MAAM,CAAC;IAErB,YAAY,EAAE,MAAM,CAAC;IAErB,cAAc,EAAE,MAAM,CAAC;IAEvB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAKD,MAAM,WAAW,eAAe;IAC9B,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAClC,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9C;AAMD,qBAAa,2BACX,SAAQ,wBAAwB,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAC3F,YAAW,eAAe;IAE1B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAyC;IAC1E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAU;IAElD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IACzC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAqB;gBAE1C,WAAW,EAAE,eAAe;IA8CxC,IAAI,cAAc,IAAI,MAAM,CAE3B;IAED,IAAI,eAAe,IAAI,MAAM,GAAG,SAAS,CAExC;IAEK,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;CAGhC;AAWD,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,GACrD,eAAe,CAwBjB;AAKD,wBAAgB,4BAA4B,CAAC,WAAW,EAAE,eAAe,GAAG,MAAM,CAEjF"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { extractHeader, fetchWithTimeout, fingerprintCredentials, JsonRpcErrorCode, McpError, OAuth2RefreshAdapterBase, } from "@cesteral/shared";
|
|
2
|
+
export class GAdsRefreshTokenAuthAdapter extends OAuth2RefreshAdapterBase {
|
|
3
|
+
static TOKEN_URL = "https://oauth2.googleapis.com/token";
|
|
4
|
+
static TOKEN_TIMEOUT_MS = 10_000;
|
|
5
|
+
_developerToken;
|
|
6
|
+
_loginCustomerId;
|
|
7
|
+
constructor(credentials) {
|
|
8
|
+
super({
|
|
9
|
+
platformName: "Google Ads",
|
|
10
|
+
credentials: {
|
|
11
|
+
appId: credentials.clientId,
|
|
12
|
+
appSecret: credentials.clientSecret,
|
|
13
|
+
refreshToken: credentials.refreshToken,
|
|
14
|
+
},
|
|
15
|
+
requestToken: async (refreshToken) => {
|
|
16
|
+
const body = new URLSearchParams({
|
|
17
|
+
client_id: credentials.clientId,
|
|
18
|
+
client_secret: credentials.clientSecret,
|
|
19
|
+
refresh_token: refreshToken,
|
|
20
|
+
grant_type: "refresh_token",
|
|
21
|
+
});
|
|
22
|
+
const response = await fetchWithTimeout(GAdsRefreshTokenAuthAdapter.TOKEN_URL, GAdsRefreshTokenAuthAdapter.TOKEN_TIMEOUT_MS, undefined, {
|
|
23
|
+
method: "POST",
|
|
24
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
25
|
+
body: body.toString(),
|
|
26
|
+
});
|
|
27
|
+
if (!response.ok) {
|
|
28
|
+
const errorBody = await response.text().catch(() => "");
|
|
29
|
+
throw new McpError(JsonRpcErrorCode.InternalError, `Google OAuth2 token exchange failed: ${response.status} ${response.statusText}. ${errorBody.substring(0, 200)}`);
|
|
30
|
+
}
|
|
31
|
+
return (await response.json());
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
this._developerToken = credentials.developerToken;
|
|
35
|
+
this._loginCustomerId = credentials.loginCustomerId;
|
|
36
|
+
}
|
|
37
|
+
get developerToken() {
|
|
38
|
+
return this._developerToken;
|
|
39
|
+
}
|
|
40
|
+
get loginCustomerId() {
|
|
41
|
+
return this._loginCustomerId;
|
|
42
|
+
}
|
|
43
|
+
async validate() {
|
|
44
|
+
await this.getAccessToken();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export function parseGAdsCredentialsFromHeaders(headers) {
|
|
48
|
+
const developerToken = extractHeader(headers, "x-gads-developer-token");
|
|
49
|
+
const clientId = extractHeader(headers, "x-gads-client-id");
|
|
50
|
+
const clientSecret = extractHeader(headers, "x-gads-client-secret");
|
|
51
|
+
const refreshToken = extractHeader(headers, "x-gads-refresh-token");
|
|
52
|
+
const loginCustomerId = extractHeader(headers, "x-gads-login-customer-id");
|
|
53
|
+
if (!developerToken) {
|
|
54
|
+
throw new Error("Missing required header: X-GAds-Developer-Token");
|
|
55
|
+
}
|
|
56
|
+
if (!clientId) {
|
|
57
|
+
throw new Error("Missing required header: X-GAds-Client-Id");
|
|
58
|
+
}
|
|
59
|
+
if (!clientSecret) {
|
|
60
|
+
throw new Error("Missing required header: X-GAds-Client-Secret");
|
|
61
|
+
}
|
|
62
|
+
if (!refreshToken) {
|
|
63
|
+
throw new Error("Missing required header: X-GAds-Refresh-Token");
|
|
64
|
+
}
|
|
65
|
+
return { developerToken, clientId, clientSecret, refreshToken, loginCustomerId };
|
|
66
|
+
}
|
|
67
|
+
export function getGAdsCredentialFingerprint(credentials) {
|
|
68
|
+
return fingerprintCredentials(credentials.clientId);
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=gads-auth-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gads-auth-adapter.js","sourceRoot":"","sources":["../../src/auth/gads-auth-adapter.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AuthStrategy, AuthResult } from "@cesteral/shared";
|
|
2
|
+
import type { Logger } from "pino";
|
|
3
|
+
export declare class GAdsHeadersAuthStrategy implements AuthStrategy {
|
|
4
|
+
private readonly logger?;
|
|
5
|
+
constructor(logger?: Logger | undefined);
|
|
6
|
+
verify(headers: Record<string, string | string[] | undefined>): Promise<AuthResult>;
|
|
7
|
+
getCredentialFingerprint(headers: Record<string, string | string[] | undefined>): Promise<string | undefined>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=gads-auth-strategy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gads-auth-strategy.d.ts","sourceRoot":"","sources":["../../src/auth/gads-auth-strategy.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAOnC,qBAAa,uBAAwB,YAAW,YAAY;IAC9C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;gBAAP,MAAM,CAAC,EAAE,MAAM,YAAA;IAEtC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC;IAqBnF,wBAAwB,CAC5B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,GACrD,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;CAI/B"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { GAdsRefreshTokenAuthAdapter, parseGAdsCredentialsFromHeaders, getGAdsCredentialFingerprint, } from "./gads-auth-adapter.js";
|
|
2
|
+
export class GAdsHeadersAuthStrategy {
|
|
3
|
+
logger;
|
|
4
|
+
constructor(logger) {
|
|
5
|
+
this.logger = logger;
|
|
6
|
+
}
|
|
7
|
+
async verify(headers) {
|
|
8
|
+
const credentials = parseGAdsCredentialsFromHeaders(headers);
|
|
9
|
+
const adapter = new GAdsRefreshTokenAuthAdapter(credentials);
|
|
10
|
+
await adapter.getAccessToken();
|
|
11
|
+
this.logger?.debug({ clientId: credentials.clientId }, "Google Ads credentials validated");
|
|
12
|
+
const fingerprint = getGAdsCredentialFingerprint(credentials);
|
|
13
|
+
return {
|
|
14
|
+
authInfo: {
|
|
15
|
+
clientId: credentials.clientId,
|
|
16
|
+
authType: "gads-headers",
|
|
17
|
+
},
|
|
18
|
+
platformAuthAdapter: adapter,
|
|
19
|
+
credentialFingerprint: fingerprint,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
async getCredentialFingerprint(headers) {
|
|
23
|
+
const credentials = parseGAdsCredentialsFromHeaders(headers);
|
|
24
|
+
return getGAdsCredentialFingerprint(credentials);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=gads-auth-strategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gads-auth-strategy.js","sourceRoot":"","sources":["../../src/auth/gads-auth-strategy.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,EAC/B,4BAA4B,GAC7B,MAAM,wBAAwB,CAAC;AAEhC,MAAM,OAAO,uBAAuB;IACL;IAA7B,YAA6B,MAAe;QAAf,WAAM,GAAN,MAAM,CAAS;IAAG,CAAC;IAEhD,KAAK,CAAC,MAAM,CAAC,OAAsD;QACjE,MAAM,WAAW,GAAG,+BAA+B,CAAC,OAAO,CAAC,CAAC;QAC7D,MAAM,OAAO,GAAG,IAAI,2BAA2B,CAAC,WAAW,CAAC,CAAC;QAG7D,MAAM,OAAO,CAAC,cAAc,EAAE,CAAC;QAE/B,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,QAAQ,EAAE,WAAW,CAAC,QAAQ,EAAE,EAAE,kCAAkC,CAAC,CAAC;QAE3F,MAAM,WAAW,GAAG,4BAA4B,CAAC,WAAW,CAAC,CAAC;QAE9D,OAAO;YACL,QAAQ,EAAE;gBACR,QAAQ,EAAE,WAAW,CAAC,QAAQ;gBAC9B,QAAQ,EAAE,cAAc;aACzB;YACD,mBAAmB,EAAE,OAAO;YAC5B,qBAAqB,EAAE,WAAW;SACnC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,wBAAwB,CAC5B,OAAsD;QAEtD,MAAM,WAAW,GAAG,+BAA+B,CAAC,OAAO,CAAC,CAAC;QAC7D,OAAO,4BAA4B,CAAC,WAAW,CAAC,CAAC;IACnD,CAAC;CACF"}
|