@@ -21,6 +21,7 @@ func workingSetCommand() *cobra.Command {
2121 cmd .AddCommand (importWorkingSetCommand ())
2222 cmd .AddCommand (showWorkingSetCommand ())
2323 cmd .AddCommand (listWorkingSetsCommand ())
24+ cmd .AddCommand (serversCommand ())
2425 cmd .AddCommand (pushWorkingSetCommand ())
2526 cmd .AddCommand (pullWorkingSetCommand ())
2627 cmd .AddCommand (createWorkingSetCommand ())
@@ -199,3 +200,55 @@ func removeWorkingSetCommand() *cobra.Command {
199200 },
200201 }
201202}
203+
204+ func serversCommand () * cobra.Command {
205+ var opts struct {
206+ WorkingSetID string
207+ Filter string
208+ Format string
209+ }
210+
211+ cmd := & cobra.Command {
212+ Use : "servers" ,
213+ Short : "List servers across working sets" ,
214+ Long : `List all servers grouped by working set.
215+
216+ Use --filter to search for servers matching a query (case-insensitive substring matching on image names or source URLs).
217+ Use --workingset to show servers only from a specific working set.` ,
218+ Example : ` # List all servers across all working sets
219+ docker mcp workingset servers
220+
221+ # Filter servers by name
222+ docker mcp workingset servers --filter github
223+
224+ # Show servers from a specific working set
225+ docker mcp workingset servers --workingset my-dev-env
226+
227+ # Combine filter and working set
228+ docker mcp workingset servers --workingset my-dev-env --filter slack
229+
230+ # Output in JSON format
231+ docker mcp workingset servers --format json` ,
232+ Args : cobra .NoArgs ,
233+ RunE : func (cmd * cobra.Command , _ []string ) error {
234+ supported := slices .Contains (workingset .SupportedFormats (), opts .Format )
235+ if ! supported {
236+ return fmt .Errorf ("unsupported format: %s" , opts .Format )
237+ }
238+
239+ dao , err := db .New ()
240+ if err != nil {
241+ return err
242+ }
243+
244+ return workingset .Servers (cmd .Context (), dao , opts .Filter , opts .WorkingSetID , workingset .OutputFormat (opts .Format ))
245+ },
246+ }
247+
248+ flags := cmd .Flags ()
249+ flags .StringVarP (& opts .WorkingSetID , "workingset" , "w" , "" , "Show servers only from specified working set" )
250+ flags .StringVar (& opts .Filter , "filter" , "" , "Filter servers by image name or source URL" )
251+ flags .StringVar (& opts .Format , "format" , string (workingset .OutputFormatHumanReadable ), fmt .Sprintf ("Supported: %s." , strings .Join (workingset .SupportedFormats (), ", " )))
252+
253+ return cmd
254+ }
0 commit comments