@@ -2,6 +2,7 @@ package main
22
33import (
44 "context"
5+ "encoding/base64"
56 "encoding/json"
67 "fmt"
78 "os"
@@ -164,8 +165,9 @@ func runUnauthorizeApp(ctx context.Context, opts unauthorizeOptions) error {
164165}
165166
166167type addOptions struct {
167- Name string
168- Value string
168+ Name string
169+ Value string
170+ Base64 bool
169171}
170172
171173type deleteOptions struct {
@@ -187,6 +189,7 @@ func AddSecret(ctx context.Context) *cobra.Command {
187189 _ = cmd .MarkFlagRequired ("name" )
188190 flags .StringVarP (& opts .Value , "value" , "v" , "" , "Value of the secret" )
189191 _ = cmd .MarkFlagRequired ("value" )
192+ flags .BoolVar (& opts .Base64 , "base64" , false , "Is the value base64 encoded" )
190193 return cmd
191194}
192195
@@ -228,7 +231,17 @@ func runAddSecret(ctx context.Context, opts addOptions) error {
228231 if err := assertMcpPolicyExists (ctx , c ); err != nil {
229232 return err
230233 }
231- return c .SetSecret (ctx , secretsapi.Secret {Name : opts .Name , Value : opts .Value , Policies : []string {mcpPolicyName }})
234+
235+ value := opts .Value
236+ if opts .Base64 {
237+ decodedValue , err := base64 .StdEncoding .DecodeString (value )
238+ if err != nil {
239+ return fmt .Errorf ("failed to decode base64 value: %w" , err )
240+ }
241+ value = string (decodedValue )
242+ }
243+
244+ return c .SetSecret (ctx , secretsapi.Secret {Name : opts .Name , Value : value , Policies : []string {mcpPolicyName }})
232245}
233246
234247func runListSecrets (ctx context.Context ) error {
0 commit comments