googleapis/mcp-toolbox · error
bucket %q is not allowed by source %q 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.
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 nilView on GitHub (pinned to 8cc6e09de2)
Solutions
- Add the requested bucket name (exact spelling) to 'allowedBuckets' in the cloud-storage source config and restart the toolbox.
- Check for case/typo mismatch between the requested name and the allowlist entry.
- 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
- Keep allowedBuckets in sync with the buckets the agent will use
- Match bucket names exactly — the check is case-sensitive and untyped
- Constrain tool descriptions so agents only request allowlisted buckets
- Review the allowlist when adding buckets in GCP
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
- local path %q is not under any allowed local roots for sourc
- description is required for tool %q
- bucket cannot be empty for tool %q
- invalid source for %q tool: source %q is not a compatible ty
- description is required for tool %q
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/bb10b41b9b0aaaf9.
Report an issue: GitHub.