googleapis / googleapis/mcp-toolbox

Support recursive subdirectory scanning for --config-folder

Open
#3,540 3 comments 0 reactions 0 assignees View on GitHub
priority: p2 status: help wanted type: feature request
Dominant language
Go
Stars
16.4k
Forks
1.7k
Avg merge
4d 9h
Merged PRs (30d)
85

Description

### What you trying to do that currently feels hard or impossible?

I'd like to organize my configuration across a nested directory tree and point Toolbox at the root:

```
src/
sources.yaml
tools-a/
tool-a.yaml
tools-b/
tool-c.yaml
```
```bash
toolbox --config-folder src/
```

Currently this loads only `src/sources.yaml` and silently ignores the subdirectories. `GetPathsFromConfigFolder` (`cmd/internal/config.go:432`) uses a flat glob rather than a recursive walk:

```go
pattern := filepath.Join(folderPath, "*.yaml") // matches src/*.yaml only
```

Because no warning is emitted, the omission is easy to miss. As the number of tools grows, grouping YAML files into subdirectories is the natural way to keep them maintainable.

### Suggested Solution(s)

Make `--config-folder` recurse into subdirectories by replacing the flat `filepath.Glob` with a `filepath.WalkDir` that collects all `*.yaml`/`*.yml` files under the root, in deterministic order. Merge semantics would remain unchanged, and the config watcher (`cmd/root.go`) would be extended to watch subdirectories so hot-reload continues to work.

### Alternatives Considered

- Listing every file via `--configs` — works, but verbose and must be updated on every file change.
- Flattening all files into a single folder — defeats the purpose of organizing tools into groups.

### Additional Details

Related to #1868 (name collisions when merging multiple files), though that concerns the merge step rather than file discovery. Happy to open a PR.

Contributor guide

Open the contributing guide

Research direction

Start in cmd/internal/config.go:432 and inspect how GetPathsFromConfigFolder currently discovers YAML files, then read the config watcher in cmd/root.go. Verify recursive discovery, deterministic ordering, unchanged merge semantics, and watcher coverage for subdirectories; done means nested .yaml and .yml files load and hot-reload continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.