package main import ( "encoding/json" "errors" "fmt" "io/fs" "os" "path/filepath" "sort" "strings" ) type serverTemplate struct { Name string Description string Config func(cwd string) ServerConfig } func setupTemplates() map[string]serverTemplate { return map[string]serverTemplate{ "grep": { Name: "grep", Description: "Search real-world code across public GitHub repositories via grep.app.", Config: func(cwd string) ServerConfig { return ServerConfig{ Transport: "streamable-http", URL: "https://mcp.grep.app/", } }, }, "filesystem": { Name: "filesystem", Description: "Read/write files under the current project directory using the official filesystem MCP server.", Config: func(cwd string) ServerConfig { return ServerConfig{ Transport: "stdio", Command: "npx", Args: []string{"-y", "@modelcontextprotocol/server-filesystem", cwd}, } }, }, "context7": { Name: "context7", Description: "Fetch up-to-date library documentation and examples via Context7.", Config: func(cwd string) ServerConfig { return ServerConfig{ Transport: "stdio", Command: "npx", Args: []string{"-y", "@upstash/context7-mcp@latest"}, } }, }, "playwright": { Name: "playwright", Description: "Browser automation via Playwright MCP.", Config: func(cwd string) ServerConfig { return ServerConfig{ Transport: "stdio", Command: "npx", Args: []string{"-y", "@executeautomation/playwright-mcp-server"}, } }, }, } } func setupHelp() string { templates := setupTemplates() names := make([]string, 0, len(templates)) for name := range templates { names = append(names, name) } sort.Strings(names) var b strings.Builder b.WriteString("mcp-bridge setup\n\n") b.WriteString("Add a known MCP server template to your zot MCP config.\n\n") b.WriteString("Usage:\n") b.WriteString(" /mcp setup add