samarth-gtm-mcp 1.18.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/.env.example +100 -0
- package/README.md +923 -0
- package/dist/auth/googleAuth.d.ts +107 -0
- package/dist/auth/googleAuth.d.ts.map +1 -0
- package/dist/auth/googleAuth.js +262 -0
- package/dist/auth/googleAuth.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +145 -0
- package/dist/index.js.map +1 -0
- package/dist/scripts/auth-google.d.ts +24 -0
- package/dist/scripts/auth-google.d.ts.map +1 -0
- package/dist/scripts/auth-google.js +171 -0
- package/dist/scripts/auth-google.js.map +1 -0
- package/dist/scripts/oauth-setup.d.ts +17 -0
- package/dist/scripts/oauth-setup.d.ts.map +1 -0
- package/dist/scripts/oauth-setup.js +60 -0
- package/dist/scripts/oauth-setup.js.map +1 -0
- package/dist/server.d.ts +10 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +95 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/accounts.d.ts +8 -0
- package/dist/tools/accounts.d.ts.map +1 -0
- package/dist/tools/accounts.js +48 -0
- package/dist/tools/accounts.js.map +1 -0
- package/dist/tools/audit.d.ts +29 -0
- package/dist/tools/audit.d.ts.map +1 -0
- package/dist/tools/audit.js +278 -0
- package/dist/tools/audit.js.map +1 -0
- package/dist/tools/builtInVariables.d.ts +8 -0
- package/dist/tools/builtInVariables.d.ts.map +1 -0
- package/dist/tools/builtInVariables.js +125 -0
- package/dist/tools/builtInVariables.js.map +1 -0
- package/dist/tools/containers.d.ts +7 -0
- package/dist/tools/containers.d.ts.map +1 -0
- package/dist/tools/containers.js +259 -0
- package/dist/tools/containers.js.map +1 -0
- package/dist/tools/environments.d.ts +9 -0
- package/dist/tools/environments.d.ts.map +1 -0
- package/dist/tools/environments.js +157 -0
- package/dist/tools/environments.js.map +1 -0
- package/dist/tools/export.d.ts +10 -0
- package/dist/tools/export.d.ts.map +1 -0
- package/dist/tools/export.js +129 -0
- package/dist/tools/export.js.map +1 -0
- package/dist/tools/folders.d.ts +7 -0
- package/dist/tools/folders.d.ts.map +1 -0
- package/dist/tools/folders.js +162 -0
- package/dist/tools/folders.js.map +1 -0
- package/dist/tools/ga4Admin.d.ts +30 -0
- package/dist/tools/ga4Admin.d.ts.map +1 -0
- package/dist/tools/ga4Admin.js +247 -0
- package/dist/tools/ga4Admin.js.map +1 -0
- package/dist/tools/ga4Data.d.ts +23 -0
- package/dist/tools/ga4Data.d.ts.map +1 -0
- package/dist/tools/ga4Data.js +186 -0
- package/dist/tools/ga4Data.js.map +1 -0
- package/dist/tools/index.d.ts +9 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +41 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/publish.d.ts +11 -0
- package/dist/tools/publish.d.ts.map +1 -0
- package/dist/tools/publish.js +123 -0
- package/dist/tools/publish.js.map +1 -0
- package/dist/tools/serverSide.d.ts +18 -0
- package/dist/tools/serverSide.d.ts.map +1 -0
- package/dist/tools/serverSide.js +228 -0
- package/dist/tools/serverSide.js.map +1 -0
- package/dist/tools/tags.d.ts +7 -0
- package/dist/tools/tags.d.ts.map +1 -0
- package/dist/tools/tags.js +152 -0
- package/dist/tools/tags.js.map +1 -0
- package/dist/tools/triggers.d.ts +7 -0
- package/dist/tools/triggers.d.ts.map +1 -0
- package/dist/tools/triggers.js +134 -0
- package/dist/tools/triggers.js.map +1 -0
- package/dist/tools/userPermissions.d.ts +11 -0
- package/dist/tools/userPermissions.d.ts.map +1 -0
- package/dist/tools/userPermissions.js +154 -0
- package/dist/tools/userPermissions.js.map +1 -0
- package/dist/tools/variables.d.ts +7 -0
- package/dist/tools/variables.d.ts.map +1 -0
- package/dist/tools/variables.js +126 -0
- package/dist/tools/variables.js.map +1 -0
- package/dist/tools/versions.d.ts +8 -0
- package/dist/tools/versions.d.ts.map +1 -0
- package/dist/tools/versions.js +160 -0
- package/dist/tools/versions.js.map +1 -0
- package/dist/tools/workspaces.d.ts +7 -0
- package/dist/tools/workspaces.d.ts.map +1 -0
- package/dist/tools/workspaces.js +168 -0
- package/dist/tools/workspaces.js.map +1 -0
- package/dist/types/gtm.d.ts +218 -0
- package/dist/types/gtm.d.ts.map +1 -0
- package/dist/types/gtm.js +6 -0
- package/dist/types/gtm.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/apiRetry.d.ts +62 -0
- package/dist/utils/apiRetry.d.ts.map +1 -0
- package/dist/utils/apiRetry.js +81 -0
- package/dist/utils/apiRetry.js.map +1 -0
- package/dist/utils/ga4Client.d.ts +29 -0
- package/dist/utils/ga4Client.d.ts.map +1 -0
- package/dist/utils/ga4Client.js +60 -0
- package/dist/utils/ga4Client.js.map +1 -0
- package/dist/utils/ga4Errors.d.ts +17 -0
- package/dist/utils/ga4Errors.d.ts.map +1 -0
- package/dist/utils/ga4Errors.js +36 -0
- package/dist/utils/ga4Errors.js.map +1 -0
- package/dist/utils/gtmClient.d.ts +11 -0
- package/dist/utils/gtmClient.d.ts.map +1 -0
- package/dist/utils/gtmClient.js +24 -0
- package/dist/utils/gtmClient.js.map +1 -0
- package/dist/utils/guardrails.d.ts +33 -0
- package/dist/utils/guardrails.d.ts.map +1 -0
- package/dist/utils/guardrails.js +95 -0
- package/dist/utils/guardrails.js.map +1 -0
- package/dist/utils/pagination.d.ts +58 -0
- package/dist/utils/pagination.d.ts.map +1 -0
- package/dist/utils/pagination.js +81 -0
- package/dist/utils/pagination.js.map +1 -0
- package/dist/utils/schemas.d.ts +26 -0
- package/dist/utils/schemas.d.ts.map +1 -0
- package/dist/utils/schemas.js +18 -0
- package/dist/utils/schemas.js.map +1 -0
- package/dist/utils/toolResponse.d.ts +35 -0
- package/dist/utils/toolResponse.d.ts.map +1 -0
- package/dist/utils/toolResponse.js +34 -0
- package/dist/utils/toolResponse.js.map +1 -0
- package/package.json +114 -0
package/.env.example
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# ============================================================
|
|
2
|
+
# Samarth GTM MCP Server — Environment Configuration
|
|
3
|
+
# Copy this file to .env and fill in your values.
|
|
4
|
+
# NEVER commit .env or any *.gtm-mcp-tokens.json file.
|
|
5
|
+
# ============================================================
|
|
6
|
+
|
|
7
|
+
# ── Google OAuth 2.0 Credentials (self-hosted / local dev) ───
|
|
8
|
+
# Create at: https://console.cloud.google.com/apis/credentials
|
|
9
|
+
# Type: "OAuth 2.0 Client ID" → Application type: "Desktop app" or "Web application"
|
|
10
|
+
#
|
|
11
|
+
# Enable the "Tag Manager API", the "Google Analytics Admin API", and the
|
|
12
|
+
# "Google Analytics Data API" in your Google Cloud project. The onboarding flow
|
|
13
|
+
# requests the GTM scopes plus the read-only
|
|
14
|
+
# "https://www.googleapis.com/auth/analytics.readonly" scope, which powers both
|
|
15
|
+
# the read-only GA4 Admin tools (ga4_*) and the read-only GA4 Data API reporting
|
|
16
|
+
# tools (ga4_run_report / ga4_run_realtime_report). No GA4 write access is
|
|
17
|
+
# requested.
|
|
18
|
+
#
|
|
19
|
+
# Preferred new names:
|
|
20
|
+
GOOGLE_OAUTH_CLIENT_ID=your-client-id.apps.googleusercontent.com
|
|
21
|
+
GOOGLE_OAUTH_CLIENT_SECRET=your-client-secret
|
|
22
|
+
GOOGLE_OAUTH_REDIRECT_URI=http://localhost:3001/oauth/callback
|
|
23
|
+
|
|
24
|
+
# Legacy names (still supported — use these OR the new names, not both):
|
|
25
|
+
# GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com
|
|
26
|
+
# GOOGLE_CLIENT_SECRET=your-client-secret
|
|
27
|
+
# GOOGLE_REDIRECT_URI=http://localhost:3001/oauth/callback
|
|
28
|
+
|
|
29
|
+
# ── Samarth-hosted public OAuth app (optional) ───────────────
|
|
30
|
+
# Reserved for the Samarth-owned OAuth client used by the hosted service.
|
|
31
|
+
# If you self-host the MCP, LEAVE THESE BLANK and use the GOOGLE_OAUTH_* vars
|
|
32
|
+
# above. The hosted client secret MUST live on the hosted backend only — it is
|
|
33
|
+
# never committed to this repo and never shipped to client machines.
|
|
34
|
+
# SAMARTH_GOOGLE_OAUTH_CLIENT_ID=
|
|
35
|
+
# SAMARTH_GOOGLE_OAUTH_CLIENT_SECRET=
|
|
36
|
+
|
|
37
|
+
# ── OAuth tokens ─────────────────────────────────────────────
|
|
38
|
+
# Easiest path: run `npm run auth:google` — it opens a browser, completes the
|
|
39
|
+
# OAuth flow, and writes tokens to the path below (default
|
|
40
|
+
# ./.gtm-mcp-tokens.json, in .gitignore). You do NOT need to fill these in
|
|
41
|
+
# manually if you use the script.
|
|
42
|
+
GTM_MCP_TOKEN_FILE=.gtm-mcp-tokens.json
|
|
43
|
+
|
|
44
|
+
# Or paste tokens directly here (env vars take precedence over the token file):
|
|
45
|
+
GOOGLE_ACCESS_TOKEN=
|
|
46
|
+
GOOGLE_REFRESH_TOKEN=
|
|
47
|
+
|
|
48
|
+
# ── Service Account (Optional, see README for limitations) ───
|
|
49
|
+
# Path to your downloaded service account JSON key file.
|
|
50
|
+
# NOTE: GTM API does NOT support service accounts without domain-wide delegation.
|
|
51
|
+
# See README section "Service Account Limitations".
|
|
52
|
+
GOOGLE_SERVICE_ACCOUNT_KEY_FILE=
|
|
53
|
+
|
|
54
|
+
# ── Transport ────────────────────────────────────────────────
|
|
55
|
+
# "stdio" → for Claude Desktop / Cursor / Claude Code (default)
|
|
56
|
+
# "http" → for cloud/team HTTP+SSE server
|
|
57
|
+
GTM_MCP_TRANSPORT=stdio
|
|
58
|
+
|
|
59
|
+
# HTTP server port (only used when GTM_MCP_TRANSPORT=http)
|
|
60
|
+
GTM_MCP_HTTP_PORT=3001
|
|
61
|
+
|
|
62
|
+
# ── Guardrails ───────────────────────────────────────────────
|
|
63
|
+
# Default: read-only mode. Set to "true" to allow write operations.
|
|
64
|
+
GTM_MCP_ENABLE_WRITES=false
|
|
65
|
+
|
|
66
|
+
# Set to "true" to allow publish/version-publish operations.
|
|
67
|
+
GTM_MCP_ENABLE_PUBLISH=false
|
|
68
|
+
|
|
69
|
+
# Set to "true" to allow destructive delete operations.
|
|
70
|
+
GTM_MCP_ENABLE_DELETES=false
|
|
71
|
+
|
|
72
|
+
# Set to "true" to simulate all write/delete/publish without actually calling the API.
|
|
73
|
+
DRY_RUN=false
|
|
74
|
+
|
|
75
|
+
# ── Retry / backoff (heavy-workload resilience) ─────────────
|
|
76
|
+
# Transient Google API failures (HTTP 408/429/5xx and network errors) on READ
|
|
77
|
+
# requests are retried with exponential backoff + jitter. Mutations (anything
|
|
78
|
+
# behind the write/publish/delete guardrails) are NEVER auto-retried.
|
|
79
|
+
# Retry attempts after the first failure. 0 disables retries.
|
|
80
|
+
GTM_MCP_RETRY_MAX=3
|
|
81
|
+
|
|
82
|
+
# Cap on a single backoff sleep, in milliseconds.
|
|
83
|
+
GTM_MCP_RETRY_MAX_DELAY_MS=30000
|
|
84
|
+
|
|
85
|
+
# Cap on total wall time from first request to last retry, in milliseconds.
|
|
86
|
+
GTM_MCP_RETRY_TOTAL_TIMEOUT_MS=60000
|
|
87
|
+
|
|
88
|
+
# ── Optional: GTM defaults ───────────────────────────────────
|
|
89
|
+
# Pre-fill default accountId/containerId to avoid passing them every call.
|
|
90
|
+
GTM_DEFAULT_ACCOUNT_ID=
|
|
91
|
+
GTM_DEFAULT_CONTAINER_ID=
|
|
92
|
+
GTM_DEFAULT_WORKSPACE_ID=
|
|
93
|
+
|
|
94
|
+
# ── Production foundation (portal — forward-looking) ─────────
|
|
95
|
+
# The durable production subsystems (Postgres, token vault, Redis/Upstash cache,
|
|
96
|
+
# async job queue, runtime worker, observability exporter) are scaffolded but NOT
|
|
97
|
+
# wired. They live in the PORTAL env, not this MCP-server env. Their variable
|
|
98
|
+
# names + secret-vs-non-secret classification are documented in
|
|
99
|
+
# apps/portal/.env.example, and the step-by-step rollout/rollback is in
|
|
100
|
+
# docs/PRODUCTION_CUTOVER_RUNBOOK.md. Leave them unset to keep today's behavior.
|