2026-04-15 12:06:28 +00:00
# Bootstrap CLI
Le package `bootstrap` reste optionnel : une application peut l'utiliser pour uniformiser le parsing CLI et l'aide, sans imposer de runtime monolithique.
Exemple minimal :
```go
func main() {
err := bootstrap.Run(context.Background(), bootstrap.Options{
BinaryName: "my-mcp",
Description: "Client MCP",
Version: version,
EnableDoctorAlias: true, // expose `doctor` comme alias de `config test`
AliasDescriptions: map[string]string{
"doctor": "Diagnostiquer la configuration locale.",
},
Hooks: bootstrap.Hooks{
Setup: func(ctx context.Context, inv bootstrap.Invocation) error {
return runSetup(ctx, inv.Args)
},
2026-04-20 10:38:58 +00:00
Login: func(ctx context.Context, inv bootstrap.Invocation) error {
return runLogin(ctx, inv.Args)
},
2026-04-15 12:06:28 +00:00
MCP: func(ctx context.Context, inv bootstrap.Invocation) error {
return runMCP(ctx, inv.Args)
},
ConfigShow: func(ctx context.Context, inv bootstrap.Invocation) error {
return runConfigShow(ctx, inv.Args)
},
ConfigTest: func(ctx context.Context, inv bootstrap.Invocation) error {
return runConfigTest(ctx, inv.Args)
},
Update: func(ctx context.Context, inv bootstrap.Invocation) error {
return runUpdate(ctx, inv.Args)
},
},
})
if err != nil {
log.Fatal(err)
}
}
```
Si `Hooks.Version` n'est pas fourni, la sous-commande `version` affiche automatiquement `Options.Version` .
Sans arguments, `bootstrap.Run` affiche l'aide globale (pas de lancement implicite de `mcp` ).
2026-04-20 10:38:58 +00:00
La commande `login` est optionnelle et peut être branchée pour gérer un unlock Bitwarden interactif.
2026-04-15 12:06:28 +00:00
La commande `config` impose une sous-commande (`show`, `test` , et optionnellement `delete` ).
Les alias déclarés (ou `EnableDoctorAlias` ) sont affichés dans l'aide globale.
2026-04-20 09:36:07 +00:00
Le flag global `--debug` est supporté et active le debug des appels Bitwarden
(`MCP_FRAMEWORK_BITWARDEN_DEBUG=1`).