Compare commits

..

4 Commits

Author SHA1 Message Date
Yuan Teoh
72cbbe3599 Merge branch 'main' into registry-toolbox-flag 2026-01-13 11:46:35 -08:00
Yuan Teoh
239f623e93 Merge branch 'main' into registry-toolbox-flag 2026-01-12 15:56:50 -08:00
Yuan Teoh
1542566f16 bump publish version 2026-01-09 10:56:59 -08:00
Yuan Teoh
ec11b067cd feat: add remaining toolbox server flag 2026-01-09 10:55:57 -08:00
6 changed files with 91 additions and 21 deletions

View File

@@ -384,7 +384,6 @@ func NewCommand(opts ...Option) *Command {
// TODO: Insecure by default. Might consider updating this for v1.0.0
flags.StringSliceVar(&cmd.cfg.AllowedOrigins, "allowed-origins", []string{"*"}, "Specifies a list of origins permitted to access this server. Defaults to '*'.")
flags.StringSliceVar(&cmd.cfg.AllowedHosts, "allowed-hosts", []string{"*"}, "Specifies a list of hosts permitted to access this server. Defaults to '*'.")
flags.StringSliceVar(&cmd.cfg.UserAgentExtra, "user-agent-extra", []string{}, "Appends additional metadata to the User-Agent.")
// wrap RunE command so that we have access to original Command object
cmd.RunE = func(*cobra.Command, []string) error { return run(cmd) }

View File

@@ -70,9 +70,6 @@ func withDefaults(c server.ServerConfig) server.ServerConfig {
if c.AllowedHosts == nil {
c.AllowedHosts = []string{"*"}
}
if c.UserAgentExtra == nil {
c.UserAgentExtra = []string{}
}
return c
}
@@ -233,13 +230,6 @@ func TestServerConfigFlags(t *testing.T) {
AllowedHosts: []string{"http://foo.com", "http://bar.com"},
}),
},
{
desc: "user agent extra",
args: []string{"--user-agent-extra", "foo,bar"},
want: withDefaults(server.ServerConfig{
UserAgentExtra: []string{"foo", "bar"},
}),
},
}
for _, tc := range tcs {
t.Run(tc.desc, func(t *testing.T) {

View File

@@ -27,7 +27,6 @@ description: >
| | `--ui` | Launches the Toolbox UI web server. | |
| | `--allowed-origins` | Specifies a list of origins permitted to access this server for CORs access. | `*` |
| | `--allowed-hosts` | Specifies a list of hosts permitted to access this server to prevent DNS rebinding attacks. | `*` |
| | `--user-agent-extra` | Appends additional metadata to the User-Agent. | |
| `-v` | `--version` | version for toolbox | |
## Examples

View File

@@ -64,14 +64,12 @@ type ServerConfig struct {
Stdio bool
// DisableReload indicates if the user has disabled dynamic reloading for Toolbox.
DisableReload bool
// UI indicates if Toolbox UI endpoints (/ui) are available.
// UI indicates if Toolbox UI endpoints (/ui) are available
UI bool
// Specifies a list of origins permitted to access this server.
AllowedOrigins []string
// Specifies a list of hosts permitted to access this server.
// Specifies a list of hosts permitted to access this server
AllowedHosts []string
// UserAgentExtra specifies additional metadata to append to the User-Agent string.
UserAgentExtra []string
}
type logFormat string

View File

@@ -64,11 +64,7 @@ func InitializeConfigs(ctx context.Context, cfg ServerConfig) (
map[string]prompts.Promptset,
error,
) {
metadataStr := cfg.Version
if len(cfg.UserAgentExtra) > 0 {
metadataStr += "+" + strings.Join(cfg.UserAgentExtra, ".")
}
ctx = util.WithUserAgent(ctx, metadataStr)
ctx = util.WithUserAgent(ctx, cfg.Version)
instrumentation, err := util.InstrumentationFromContext(ctx)
if err != nil {
panic(err)

View File

@@ -31,6 +31,18 @@
"default": "tools.yaml",
"isRequired": false
},
{
"type": "named",
"name": "--tools-files",
"description": "Multiple file paths specifying tool configurations. Files will be merged. Cannot be used with -tools-file or -tools-folder.",
"isRequired": false
},
{
"type": "named",
"name": "--tools-folder",
"description": "Directory path containing YAML tool configuration files. All .yaml and .yml files in the directory will be loaded and merged. Cannot be used with -tools-file or -tools-files.",
"isRequired": false
},
{
"type": "named",
"name": "--address",
@@ -70,6 +82,82 @@
"warn",
"error"
]
},
{
"type": "named",
"name": "--logging-format",
"description": "Specify logging format to use.",
"default": "standard",
"choices": [
"standard",
"json"
]
},
{
"type": "named",
"name": "--disable-reload",
"description": "Disables dynamic reloading of tools file.",
"format": "boolean",
"isRequired": false
},
{
"type": "named",
"name": "--prebuilt",
"description": "Use a prebuilt tool configuration by source type.",
"isRequired": false
},
{
"type": "named",
"name": "--stdio",
"description": "Listens via MCP STDIO instead of acting as a remote HTTP server.",
"format": "boolean",
"isRequired": false
},
{
"type": "named",
"name": "--telemetry-gcp",
"description": "Enable exporting directly to Google Cloud Monitoring.",
"format": "boolean",
"isRequired": false
},
{
"type": "named",
"name": "--telemetry-otlp",
"description": "Enable exporting using OpenTelemetry Protocol (OTLP) to the specified endpoint (e.g. 'http://127.0.0.1:4318').",
"isRequired": false
},
{
"type": "named",
"name": "--telemetry-service-name",
"description": "Sets the value of the service.name resource attribute for telemetry data.",
"default": "toolbox",
"isRequired": false
},
{
"type": "named",
"name": "--ui",
"description": "Launches the Toolbox UI web server.",
"format": "boolean",
"isRequired": false
},
{
"type": "named",
"name": "--allowed-origins",
"description": "Specifies a list of origins permitted to access this server.",
"default": "*",
"isRequired": false
},
{
"type": "named",
"name": "--help",
"description": "Show help for toolbox",
"isRequired": false
},
{
"type": "named",
"name": "--version",
"description": "Show version for toolbox",
"isRequired": false
}
]
}