Skip to main content
Glama
samarthanalytics-sj

Samarth GTM MCP Server

Official

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
DRY_RUNNoSimulate all writes without calling the API.false
GOOGLE_CLIENT_IDNoLegacy OAuth client ID.
GTM_MCP_HTTP_PORTNoHTTP server port (http transport only; falls back to PORT).3001
GTM_MCP_RETRY_MAXNoRetry attempts for transient read failures (408/429/5xx, network). 0 disables retries. Mutations are never auto-retried.3
GTM_MCP_TRANSPORTNoTransport: stdio or http.stdio
GTM_MCP_TOKEN_FILENoPath to the local OAuth token file written by npm run auth:google (gitignored)../.gtm-mcp-tokens.json
GOOGLE_ACCESS_TOKENNoCurrent OAuth access token. Env vars take precedence over the token file.
GOOGLE_REDIRECT_URINoLegacy OAuth redirect URI.
GOOGLE_CLIENT_SECRETNoLegacy OAuth client secret.
GOOGLE_REFRESH_TOKENNoOAuth refresh token (long-lived). Env vars take precedence over the token file.
GTM_MCP_ENABLE_WRITESNoAllow create/update operations.false
GOOGLE_OAUTH_CLIENT_IDNoOAuth client ID (preferred). Falls back to GOOGLE_CLIENT_ID.
GTM_DEFAULT_ACCOUNT_IDNoOptional default accountId.
GTM_MCP_ENABLE_DELETESNoAllow delete operations.false
GTM_MCP_ENABLE_PUBLISHNoAllow publish operations.false
GTM_MCP_HTTP_AUTH_TOKENNoBearer token gating /mcp (http transport). Required before exposing the server beyond localhost; unset = open + startup warning.
GTM_DEFAULT_CONTAINER_IDNoOptional default containerId.
GTM_DEFAULT_WORKSPACE_IDNoOptional default workspaceId.
GOOGLE_OAUTH_REDIRECT_URINoOAuth redirect URI. Falls back to GOOGLE_REDIRECT_URI.http://localhost:3001/oauth/callback
GOOGLE_OAUTH_CLIENT_SECRETNoOAuth client secret (preferred). Falls back to GOOGLE_CLIENT_SECRET.
GTM_MCP_RETRY_MAX_DELAY_MSNoCap on a single backoff sleep (exponential backoff with jitter).30000
GTM_MCP_RETRY_TOTAL_TIMEOUT_MSNoCap on total wall time from first request to last retry.60000
SAMARTH_GOOGLE_OAUTH_CLIENT_IDNoHosted-only. Samarth-owned public OAuth client. Takes precedence over self-hosted vars when set.
GOOGLE_SERVICE_ACCOUNT_KEY_FILENoPath to service account JSON key (see limitations above).
SAMARTH_GOOGLE_OAUTH_CLIENT_SECRETNoHosted-only. Inject from your platform secret manager. Never commit.

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": true
}
prompts
{
  "listChanged": true
}

Tools

Functions exposed to the LLM to take actions

NameDescription
accounts_listA

List all GTM accounts accessible to the authenticated user. Returns account IDs, names, and share-data flags.

accounts_getA

Get details of a specific GTM account.

containers_listA

List all GTM containers within a GTM account. Automatically follows pagination to return all containers.

containers_getB

Get details of a specific GTM container.

containers_createA

[WRITE] Create a new GTM container. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true.

containers_set_tagging_server_urlsA

[WRITE] Set a SERVER container's taggingServerUrls (the deployed tagging-server URL, e.g. from Cloud Run/Stape). Read-modify-write via containers.update so the other container fields are preserved; rejects a non-server container. Records the URL in config only — it does NOT deploy the host. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true.

containers_snippetA

Get the GTM installation snippet (HTML/JS tagging code) for a container.

containers_lookupA

Look up a GTM container by its linked destination ID (e.g. a GA4 measurement ID or tag ID).

containers_combineA

[WRITE] Combine (merge) another container into this one. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true. ⚠️ This merges the source container identified by containerIdToCombine into the target container.

containers_move_tag_idC

[WRITE] Move a Tag ID out of a container into a new container. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true.

destinations_listA

List all destinations (linked Google tags / GA4 destinations) for a GTM container.

destinations_getC

Get details of a specific GTM destination.

destinations_linkA

[WRITE] Link a destination (Google tag / GA4 destination) to a GTM container. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true.

workspaces_listA

List all workspaces within a GTM container. Automatically follows pagination to return all workspaces.

workspaces_getB

Get details of a specific GTM workspace.

workspaces_createA

[WRITE] Create a new workspace. Requires GTM_MCP_ENABLE_WRITES=true.

workspace_get_statusA

Get the status of a GTM workspace: the list of changed entities (workspaceChange) relative to the latest container version, plus any merge conflicts. Use this to review a change diff before creating a version or publishing.

workspace_syncA

Syncs a workspace to the latest container version by updating all unmodified workspace entities. Returns a list of merge conflicts if any.

workspace_resolve_conflictA

Resolve a merge conflict for a workspace entity. You must supply the full entity body to write into the workspace (overwriting the conflict). NOTE: This is a complex operation — review the GTM UI conflict resolution first.

tags_listA

List all GTM tags in a workspace. Automatically follows pagination to return all tags.

tags_getB

Get details of a specific GTM tag.

tags_createA

[WRITE] Create a new GTM tag. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true. Pass the full tag configuration as parameters.

tags_updateA

[WRITE] Update an existing GTM tag (read-modify-write). Requires GTM_MCP_ENABLE_WRITES=true and confirm=true. GTM's API replaces the WHOLE tag on update, so this tool first fetches the tag and only overlays the fields you pass — omitted fields are preserved. parameter is MERGED with the existing parameters BY KEY (a same-key param replaces, new keys are added, untouched keys are kept), so you will NOT wipe a GA4 tag's eventName/measurementId. To add GA4 EVENT parameters to a gaawe tag, prefer tags_add_ga4_event_parameters (event params live in the nested eventSettingsTable, which this generic parameter list cannot express).

tags_add_ga4_event_parametersA

[WRITE] Add GA4 event parameters to a GA4 Event tag (type "gaawe"). Requires GTM_MCP_ENABLE_WRITES=true and confirm=true. Fetches the tag, APPENDS the parameters to its eventSettingsTable (the correct place for GA4 event parameters — top-level params are ignored by GA4 event tags), and saves the FULL tag so eventName/measurementId stay intact. A parameter whose name already exists has its value updated (not duplicated). Values may be GTM variables, e.g. {{Click Text}}.

tags_deleteA

[DELETE] Delete a GTM tag. Requires GTM_MCP_ENABLE_DELETES=true and confirm=true. This is irreversible in the workspace (the tag is removed from the workspace).

triggers_listC

List all GTM triggers in a workspace. Automatically follows pagination to return all triggers.

triggers_getC

Get a specific GTM trigger.

triggers_createC

[WRITE] Create a GTM trigger. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true.

triggers_updateA

[WRITE] Update a GTM trigger (read-modify-write — omitted fields are preserved; parameter is merged by key). Requires GTM_MCP_ENABLE_WRITES=true and confirm=true.

triggers_deleteA

[DELETE] Delete a GTM trigger. Requires GTM_MCP_ENABLE_DELETES=true and confirm=true.

variables_listB

List all user-defined GTM variables in a workspace. Automatically follows pagination to return all variables.

variables_getC

Get a specific GTM variable.

variables_createB

[WRITE] Create a GTM variable. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true.

variables_updateA

[WRITE] Update a GTM variable (read-modify-write — omitted fields are preserved; parameter is merged by key). Requires GTM_MCP_ENABLE_WRITES=true and confirm=true.

variables_deleteC

[DELETE] Delete a GTM variable. Requires GTM_MCP_ENABLE_DELETES=true and confirm=true.

folders_listA

List all GTM folders in a workspace. Automatically follows pagination to return all folders.

folders_getC

Get a specific GTM folder.

folders_entitiesB

List all entities (tags, triggers, variables) within a specific GTM folder.

folders_createB

[WRITE] Create a GTM folder. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true.

folders_updateB

[WRITE] Update a GTM folder. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true.

folders_deleteB

[DELETE] Delete a GTM folder. Requires GTM_MCP_ENABLE_DELETES=true and confirm=true. Contents of the folder will be unfoldered, not deleted.

folders_move_entitiesA

[WRITE] Move tags/triggers/variables into a folder. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true.

built_in_variables_listB

List all currently enabled built-in variables in a GTM workspace.

built_in_variables_enableB

[WRITE] Enable one or more built-in variables in a GTM workspace. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true.

built_in_variables_disableA

[DELETE] Disable one or more built-in variables in a GTM workspace. Requires GTM_MCP_ENABLE_DELETES=true and confirm=true.

built_in_variables_revertA

[WRITE] Revert changes to a built-in variable in the workspace to the original container version. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true.

versions_listC

List all container version headers (summary) for a GTM container.

versions_getA

Get the full contents of a specific GTM container version. Pass "live" as containerVersionId to get the currently live version.

versions_createA

[WRITE] Create a new GTM container version from a workspace (checkpoint). Requires GTM_MCP_ENABLE_WRITES=true and confirm=true. This takes a snapshot of the workspace into a versioned checkpoint without publishing.

versions_set_latestA

[WRITE] Set a specific container version as the "latest" (synchronizes the default workspace with this version). Note: This does NOT publish. Use versions_publish to go live. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true.

versions_undeleteB

[WRITE] Undelete a previously deleted GTM container version. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true.

versions_deleteA

[DELETE] Delete a GTM container version. Requires GTM_MCP_ENABLE_DELETES=true and confirm=true. Cannot delete a currently published (live) version.

workspace_quick_previewA

Generate a quick-preview (debug) link for a GTM workspace. This does NOT publish — it just enables preview mode. Returns a preview container version with any compilation errors.

versions_publishA

[PUBLISH] Publish a specific GTM container version to live. Requires GTM_MCP_ENABLE_PUBLISH=true and confirm=true. ⚠️ This immediately makes the version live in production.

workspace_create_version_and_publishA

[PUBLISH] Create a new container version from a workspace and immediately publish it. Requires GTM_MCP_ENABLE_PUBLISH=true and confirm=true. ⚠️ This is the most powerful write operation — it goes live in production immediately.

environments_listA

List all environments in a GTM container. Automatically follows pagination.

environments_getA

Get details of a specific GTM environment.

environments_createA

[WRITE] Create a new GTM environment. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true.

environments_updateA

[WRITE] Update an existing GTM environment. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true.

environments_reauthorizeA

[PUBLISH] Re-generate the authorization code for a GTM environment. Requires GTM_MCP_ENABLE_PUBLISH=true and confirm=true. ⚠️ This rotates the environment auth token; any embedded snippet using the old token stops working until updated.

environments_deleteA

[DELETE] Delete a GTM environment. Requires GTM_MCP_ENABLE_DELETES=true and confirm=true.

user_permissions_listA

List all user permissions for a GTM account. Automatically follows pagination. Each record shows a user email plus their account and per-container access levels.

user_permissions_getB

Get a specific user permission record for a GTM account.

user_permissions_createA

[WRITE] Grant a user access to a GTM account (and optionally containers). Requires GTM_MCP_ENABLE_WRITES=true and confirm=true.

user_permissions_updateA

[WRITE] Update a user's account and/or container access levels. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true. Provide the full intended access (account + container) as the API replaces the record.

user_permissions_deleteA

[DELETE] Revoke a user's access to a GTM account. Requires GTM_MCP_ENABLE_DELETES=true and confirm=true.

clients_listA

List all GTM clients in a workspace. Automatically follows pagination.

clients_getA

Get a specific GTM client.

clients_createA

[WRITE] Create a new GTM client. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true. Pass the full resource as a JSON string in bodyJson.

clients_updateA

[WRITE] Update an existing GTM client. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true. Pass the full resource as a JSON string in bodyJson.

clients_deleteA

[DELETE] Delete a GTM client. Requires GTM_MCP_ENABLE_DELETES=true and confirm=true.

clients_revertA

[WRITE] Revert workspace changes to a GTM client back to its last container-version state. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true.

transformations_listA

List all GTM transformations in a workspace. Automatically follows pagination.

transformations_getB

Get a specific GTM transformation.

transformations_createA

[WRITE] Create a new GTM transformation. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true. Pass the full resource as a JSON string in bodyJson.

transformations_updateA

[WRITE] Update an existing GTM transformation. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true. Pass the full resource as a JSON string in bodyJson.

transformations_deleteA

[DELETE] Delete a GTM transformation. Requires GTM_MCP_ENABLE_DELETES=true and confirm=true.

transformations_revertA

[WRITE] Revert workspace changes to a GTM transformation back to its last container-version state. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true.

zones_listA

List all GTM zones in a workspace. Automatically follows pagination.

zones_getB

Get a specific GTM zone.

zones_createA

[WRITE] Create a new GTM zone. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true. Pass the full resource as a JSON string in bodyJson.

zones_updateA

[WRITE] Update an existing GTM zone. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true. Pass the full resource as a JSON string in bodyJson.

zones_deleteA

[DELETE] Delete a GTM zone. Requires GTM_MCP_ENABLE_DELETES=true and confirm=true.

zones_revertA

[WRITE] Revert workspace changes to a GTM zone back to its last container-version state. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true.

templates_listB

List all GTM templates in a workspace. Automatically follows pagination.

templates_getB

Get a specific GTM template.

templates_createA

[WRITE] Create a new GTM template. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true. Pass the full resource as a JSON string in bodyJson.

templates_updateA

[WRITE] Update an existing GTM template. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true. Pass the full resource as a JSON string in bodyJson.

templates_deleteA

[DELETE] Delete a GTM template. Requires GTM_MCP_ENABLE_DELETES=true and confirm=true.

templates_revertA

[WRITE] Revert workspace changes to a GTM template back to its last container-version state. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true.

gtag_config_listA

List all GTM gtag configs in a workspace. Automatically follows pagination.

gtag_config_getB

Get a specific GTM gtag config.

gtag_config_createA

[WRITE] Create a new GTM gtag config. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true. Pass the full resource as a JSON string in bodyJson.

gtag_config_updateA

[WRITE] Update an existing GTM gtag config. Requires GTM_MCP_ENABLE_WRITES=true and confirm=true. Pass the full resource as a JSON string in bodyJson.

gtag_config_deleteA

[DELETE] Delete a GTM gtag config. Requires GTM_MCP_ENABLE_DELETES=true and confirm=true.

audit_containerA

Inspect a GTM workspace for common analytics implementation issues. Returns structured findings with severity levels (error/warning/info). This is a read-only operation — it never modifies anything.

export_containerA

Export a full GTM workspace summary as structured JSON. Returns all tags, triggers, variables, folders, and built-in variables. This is a read-only operation. Use this for documentation, auditing, or feeding container data to other tools.

ga4_account_summaries_listA

List GA4 account summaries accessible to the authenticated user. Each summary includes the account plus a lightweight list of its property summaries (property ID + display name). Best starting point to discover available GA4 accounts and properties. Read-only.

ga4_properties_listA

List GA4 properties under a given parent account. Returns full property records (display name, time zone, currency, industry, service level). Read-only.

ga4_property_getA

Get a single GA4 property by ID, including display name, time zone, currency, industry category, and service level. Read-only.

Prompts

Interactive templates invoked by user choice

NameDescription
setup_server_side_containerOne guided flow to create a server-side (sGTM) container: the SERVER container + GA4 client + built-ins + Event-Data/Constant/Request-Header variables + per-event triggers + GA4 (and optional Google Ads) server tags, in the correct order with the exact resource shapes. Optional args: accountId, containerName, measurementId, adsConversionId.
setup_ecommerce_funnelOne guided flow to install the full GA4 ecommerce funnel in a WEB container: per-event Custom Event triggers + GA4 event tags with native ecommerce forwarding (sendEcommerceData), the dlv - ecommerce.* variables, and a Consent Mode v2 defaults tag on Consent Initialization — then a verification checklist. Optional args: accountId, containerId, measurementId, events (comma-separated).

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/samarthanalytics-sj/samarth-analytics-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server