googleapis/mcp-toolbox · error

client authorization is not supported

Error message

client authorization is not supported

What it means

The `toolbox invoke` CLI runs tools ephemerally without an HTTP request context, so per-request client authorization (authRequired/auth services) cannot be fulfilled. When the resolved tool reports RequiresClientAuthorization(src) == true, runInvoke aborts before invoking the tool with this error (cmd/internal/invoke/command.go:139-149).

Source

Thrown at cmd/internal/invoke/command.go:146

		return errMsg
	}

	parsedParams, err = tool.EmbedParams(ctx, parsedParams, primitiveMgr)
	if err != nil {
		errMsg := fmt.Errorf("error embedding parameters: %w", err)
		opts.Logger.ErrorContext(ctx, errMsg.Error())
		return errMsg
	}

	// Client Auth not supported for ephemeral CLI call
	requiresAuth, err := tool.RequiresClientAuthorization(src)
	if err != nil {
		errMsg := fmt.Errorf("failed to check auth requirements: %w", err)
		opts.Logger.ErrorContext(ctx, errMsg.Error())
		return errMsg
	}
	if requiresAuth {
		errMsg := fmt.Errorf("client authorization is not supported")
		opts.Logger.ErrorContext(ctx, errMsg.Error())
		return errMsg
	}

	result, err := tool.Invoke(ctx, src, parsedParams, "")
	if err != nil {
		errMsg := fmt.Errorf("tool execution failed: %w", err)
		opts.Logger.ErrorContext(ctx, errMsg.Error())
		return errMsg
	}

	// Print Result
	output, err := json.MarshalIndent(result, "", "  ")
	if err != nil {
		errMsg := fmt.Errorf("failed to marshal result: %w", err)
		opts.Logger.ErrorContext(ctx, errMsg.Error())
		return errMsg
	}

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Remove the authRequired field (or its entries) from the tool's YAML config if client auth is not actually needed.
  2. Invoke the tool through the running toolbox server instead (POST /mcp or the API endpoint with proper Authorization headers), which supports client authorization.
  3. Create a separate unauthenticated copy of the tool in the config for CLI use.
  4. Check tool.RequiresClientAuthorization for the tool kind to confirm whether it hardcodes client auth.

Example fix

// before (tools.yaml)
tools:
  search-items:
    kind: postgres-sql
    source: my-pg-instance
    authRequired:
      - my-google-auth-service
    statement: "SELECT * FROM items;"
// after
tools:
  search-items:
    kind: postgres-sql
    source: my-pg-instance
    statement: "SELECT * FROM items;"
Defensive patterns

Strategy: validation

Validate before calling

// Before invoking via CLI, check the tool config for client auth requirements:
func toolRequiresClientAuth(cfg map[string]any) bool {
    auth, ok := cfg["authRequired"].([]any)
    return ok && len(auth) > 0
}

Type guard

func hasAuthRequired(cfg map[string]any) bool {
    v, ok := cfg["authRequired"]
    if !ok || v == nil { return false }
    list, ok := v.([]any)
    return ok && len(list) > 0
}

Prevention

When it happens

Trigger: Running `toolbox invoke <tool-name> ...` where the tool's config declares authRequired[] (client auth services) so RequiresClientAuthorization returns true; also when the tool's RequiresClientAuthorization implementation itself is customized to demand client auth.

Common situations: Users copy a tool config intended for the HTTP/MCP server (which requires Google-signed ID tokens etc.) and try to invoke it directly from the CLI; tools configured with authRequired: [my-google-auth-service] in tools.yaml.

Related errors


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/6c12be78a5cd400d. Report an issue: GitHub.