Skip to main content
Glama
tijevlam

unboundai-gtm-mcp-server

by tijevlam
README.md
# MCP Server for Google Tag Manager

This is an MCP server that provides an interface to the Google Tag Manager API using Google Application Default Credentials (ADC).

## Setup instructions

Setup involves the following steps:

1. Install Node.js (v20 or later recommended)
2. Enable Google Tag Manager API in your Google Cloud project
3. Configure Google Application Default Credentials (ADC)
4. Configure your MCP client (Claude Desktop, Gemini CLI, etc.)

### Enable Google Tag Manager API

[Follow the instructions](https://support.google.com/googleapi/answer/6158841) to enable the Google Tag Manager API in your Google Cloud project:

* [Google Tag Manager API](https://console.cloud.google.com/apis/library/tagmanager.googleapis.com)

### Configure Google Application Default Credentials

Configure your [Application Default Credentials (ADC)](https://cloud.google.com/docs/authentication/provide-credentials-adc). Make sure the credentials are for a user with access to your Google Tag Manager accounts.

Credentials must include the Google Tag Manager edit scope:

```
https://www.googleapis.com/auth/tagmanager.edit.containers
```

Check out [Manage OAuth Clients](https://support.google.com/cloud/answer/15549257) for how to create an OAuth client.

Here are some sample `gcloud` commands you might find useful:

- Set up ADC using user credentials and an OAuth desktop or web client after downloading the client JSON to `YOUR_CLIENT_JSON_FILE`.

  ```shell
  gcloud auth application-default login \
    --scopes https://www.googleapis.com/auth/tagmanager.edit.containers,https://www.googleapis.com/auth/cloud-platform \
    --client-id-file=YOUR_CLIENT_JSON_FILE
  ```

- Set up ADC using service account impersonation.

  ```shell
  gcloud auth application-default login \
    --impersonate-service-account=SERVICE_ACCOUNT_EMAIL \
    --scopes=https://www.googleapis.com/auth/tagmanager.edit.containers,https://www.googleapis.com/auth/cloud-platform
  ```

When the `gcloud auth application-default` command completes, copy the `PATH_TO_CREDENTIALS_JSON` file location printed to the console in the following message. You'll need this for the next step!

```
Credentials saved to file: [PATH_TO_CREDENTIALS_JSON]
```

### Configure Claude Desktop

1. Open Claude Desktop and navigate to Settings -> Developer -> Edit Config. This opens the configuration file that controls which MCP servers Claude can access.

2. Add the following configuration. Replace `PATH_TO_CREDENTIALS_JSON` with the path you copied in the previous step:

```json
{
  "mcpServers": {
    "unboundai-gtm-mcp-server": {
      "command": "npx",
      "args": ["-y","@unboundai/gtm-mcp-server"],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "PATH_TO_CREDENTIALS_JSON"
      }
    }
  }
}
```

3. Restart Claude Desktop. The tools will become available for you to use.

## Troubleshooting

**MCP Server Name Length Limit**

Some MCP clients (like Cursor AI) have a 60-character limit for the combined MCP server name + tool name length. If you use a longer server name in your configuration (e.g., `unboundai-gtm-mcp-server-your-additional-long-name`), some tools may be filtered out.

To avoid this issue:
- Use shorter server names in your MCP configuration (e.g., `unboundai-gtm-mcp-server`)

**Debugging Server Issues**

If the MCP server crashes or encounters issues, you can enable comprehensive debug logging to diagnose the problem:

1. **Enable Debug Mode**: Set the `DEBUG` environment variable to `true` or `1`:
   ```json
   {
     "mcpServers": {
       "unboundai-gtm-mcp-server": {
         "command": "npx",
         "args": ["-y", "@unboundai/gtm-mcp-server"],
         "env": {
           "GOOGLE_APPLICATION_CREDENTIALS": "PATH_TO_CREDENTIALS_JSON",
           "DEBUG": "true"
         }
       }
     }
   }
   ```

2. **Control Log Level**: Alternatively, set the `LOG_LEVEL` environment variable to control logging verbosity:
   - `DEBUG`: Shows all debug messages (most verbose)
   - `INFO`: Shows informational messages and above (default)
   - `WARN`: Shows only warnings and errors
   - `ERROR`: Shows only error messages

   Example:
   ```json
   {
     "mcpServers": {
       "unboundai-gtm-mcp-server": {
         "command": "npx",
         "args": ["-y", "@unboundai/gtm-mcp-server"],
         "env": {
           "GOOGLE_APPLICATION_CREDENTIALS": "PATH_TO_CREDENTIALS_JSON",
           "LOG_LEVEL": "DEBUG"
         }
       }
     }
   }
   ```

3. **Check MCP Client Logs**: The debug output is written to stderr and will appear in your MCP client's logs. In Claude Desktop:
   - macOS: `~/Library/Logs/Claude/mcp*.log`
   - Windows: `%APPDATA%\Claude\logs\mcp*.log`

Debug logging provides detailed information about:
- Server initialization and startup
- Environment configuration
- Authentication with Google APIs
- Tool registration
- API calls and responses
- Error details with stack traces

**Note**: Debug logging may produce verbose output. It's recommended to enable it only when troubleshooting issues.

TDQS

A3.7/5.0

Scored across 18 tools

Disambiguation5/5

Each tool is named after a distinct GTM resource, and there is no overlap in the resource types they operate on. Examples include gtm_container, gtm_tag, and gtm_account, which clearly separate concerns.

Naming Consistency5/5

All tools follow a consistent pattern of 'gtm_' followed by the resource name (e.g., gtm_workspace, gtm_trigger). No mixing of naming conventions or verb styles.

Tool Count5/5

With 18 tools covering the main GTM entities (containers, tags, triggers, workspaces, etc.), the count is well-scoped for a comprehensive management server. Each tool earns its place.

Completeness5/5

The toolset covers all major GTM resource types, including containers, accounts, workspaces, tags, triggers, variables, environments, folders, and more. Only niche or rarely used entities are absent, making the surface complete for typical GTM management.

Maintenance

ActivityInactive
ResponsivenessNo issues