googleapis/mcp-toolbox · error

bucket is not allowed by source configuration

Error message

bucket %q is not allowed by source %q configuration

What it means

CloudStorage source implements an allowlist: if 'allowedBuckets' is configured, every bucket-touching operation (list, read, create, metadata, IAM policy) is checked against it. A request for a bucket not on the list is rejected before any GCS API call. If the list is empty, all buckets are permitted.

Solutions

  1. Add the requested bucket name (exact spelling) to 'allowedBuckets' in the cloud-storage source config and restart the toolbox.
  2. Check for case/typo mismatch between the requested name and the allowlist entry.
  3. If all buckets should be accessible, remove the allowedBuckets field (empty list permits everything).

Example fix

# before
allowedBuckets: [my-bucket-a]
# after
allowedBuckets: [my-bucket-a, my-bucket-b]
Defensive patterns

Strategy: validation

Validate before calling

allowed := map[string]bool{"my-bucket-a": true, "my-bucket-b": true}
if !allowed[bucketName] {
    return fmt.Errorf("bucket %q must be added to allowedBuckets", bucketName)
}

Prevention

When it happens

Trigger: Calling ListObjects, ReadObject, CreateBucket, GetBucketMetadata, GetBucketIAMPolicy, or GetObjectMetadata with a bucket name that is not an exact (case-sensitive) entry in the source's allowedBuckets list while that list is non-empty.

Common situations: LLM agent requests a bucket that exists in GCP but was never allowlisted in the toolbox config; typos or case mismatch between config and actual bucket name; buckets added in GCP after the config was written.

Related errors


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

Appendix: source

Thrown at internal/sources/cloudstorage/cloudstorage.go:104

}

var _ sources.Source = &Source{}

type Source struct {
	Config
	client *storage.Client
}

func (s *Source) validateBucket(bucket string) error {
	if len(s.AllowedBuckets) == 0 {
		return nil
	}
	for _, b := range s.AllowedBuckets {
		if b == bucket {
			return nil
		}
	}
	return fmt.Errorf("bucket %q is not allowed by source %q configuration", bucket, s.Name)
}

// validateLocalPath enforces allowedLocalRoots. The path must sit under an
// allowed root both as written and after symlinks are resolved: the first check
// keeps the rejection message tied to what the caller actually asked for, and
// the second is what makes the root a real boundary, since a symlink planted
// under a root can otherwise point anywhere on the filesystem.
//
// The resolved comparison uses resolved roots as well, so an allowed root that
// is itself reached through a symlink (/tmp on macOS, a symlinked workspace)
// still matches.
func (s *Source) validateLocalPath(p string) error {
	clean, err := cloudstoragecommon.ValidateLocalPath(p)
	if err != nil {
		return err
	}
	if len(s.AllowedLocalRoots) == 0 {
		return nil

View on GitHub (pinned to 8cc6e09de2)