Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ issues:
exclude-use-default: false
max-issues-per-linter: 0
max-same-issues: 0
exclude-files:
- ".*_test\\.go$"

run:
timeout: 5m
130 changes: 127 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,27 @@ go build
```
This will detect your platform, locate your Claude Desktop configuration, and set up mcp-compose.

2. **Export your current MCP servers:**
2. **Browse and install MCP servers from the marketplace:**
```bash
mcp-compose dump > mcp-servers.yaml
# Interactive browsing with checkboxes (recommended!)
mcp-compose marketplace list
# 1. Browse 448+ servers from https://github.com/modelcontextprotocol/servers
# 2. Use arrow keys to navigate, space to select servers
# 3. Press enter, then provide your project path
# 4. Selected servers will be installed automatically

# Search for specific servers
mcp-compose marketplace search filesystem

# Install a single server directly
mcp-compose marketplace install filesystem /path/to/your/project
```

3. **Edit and apply changes:**
3. **Or manage servers via YAML:**
```bash
# Export your current MCP servers
mcp-compose dump > mcp-servers.yaml

# Edit the YAML file
vim mcp-servers.yaml

Expand Down Expand Up @@ -166,6 +180,82 @@ The command will:
4. Remove the server from the YAML file
5. Optionally remove it from `~/.claude.json`

## Marketplace Commands

The marketplace commands allow you to browse and install MCP servers from the official [Model Context Protocol servers repository](https://github.com/modelcontextprotocol/servers).

### Marketplace List

Browse and install MCP servers from the marketplace with an interactive interface:

```bash
mcp-compose marketplace list
```

This command will:
- Fetch the latest list of MCP servers from https://github.com/modelcontextprotocol/servers (448+ servers)
- Cache the results locally for faster subsequent access
- Display an **interactive TUI (Terminal User Interface) with checkboxes**
- Allow you to select multiple servers using the spacebar
- Ask for your project path after selection
- Install all selected servers at once to your project

**Interactive Controls:**
- Use **arrow keys** to navigate through the server list
- Press **space** to select/deselect a server
- Press **right arrow** to select all
- Press **left arrow** to deselect all
- Start **typing** to filter servers by name or description
- Press **enter** to confirm selection
- Enter your **project path** when prompted
- Selected servers will be installed automatically

This is the recommended way to discover and install MCP servers!

### Marketplace Search

Search for MCP servers by name or description:

```bash
mcp-compose marketplace search <query>
```

Examples:
```bash
# Search for filesystem-related servers
mcp-compose marketplace search filesystem

# Search for Git-related servers
mcp-compose marketplace search git

# Search for database servers
mcp-compose marketplace search database
```

The search is case-insensitive and matches against both server names and descriptions.

### Marketplace Install

Install an MCP server from the marketplace:

```bash
mcp-compose marketplace install <server-name> <project-path>
```

Example:
```bash
mcp-compose marketplace install filesystem /home/user/workspace/my-project
```

The install command will:
1. Search for the server in the marketplace
2. Display server information and installation details
3. Generate the MCP server configuration
4. Ask for confirmation before applying changes
5. Add the server to your Claude Desktop configuration for the specified project

**Note:** You may need to restart Claude Desktop for changes to take effect.

## YAML Configuration Format

The configuration is organized by project path. Each project can have its own MCP servers.
Expand Down Expand Up @@ -223,6 +313,40 @@ projects:

## Workflows

### Installing from Marketplace

**Option 1: Interactive browsing (recommended)**

1. Launch the interactive marketplace browser:
```bash
mcp-compose marketplace list
```

2. Use the interactive TUI:
- Browse 448+ servers from the official MCP repository
- Navigate with arrow keys
- Select multiple servers with spacebar
- Filter by typing
- Press enter to confirm selection

3. Enter your project path when prompted

4. Restart Claude Desktop to apply changes

**Option 2: Direct installation**

1. Search for available servers:
```bash
mcp-compose marketplace search <query>
```

2. Install the desired server:
```bash
mcp-compose marketplace install <server-name> /path/to/your/project
```

3. Restart Claude Desktop to apply changes

### Managing Existing Configuration

1. Export current configuration:
Expand Down
15 changes: 13 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
module github.com/flug/mcp-compose

go 1.25.3
go 1.23

require gopkg.in/yaml.v3 v3.0.1 // indirect
require gopkg.in/yaml.v3 v3.0.1

require (
github.com/AlecAivazis/survey/v2 v2.3.7 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/mattn/go-colorable v0.1.2 // indirect
github.com/mattn/go-isatty v0.0.8 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.4.0 // indirect
)
48 changes: 48 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,3 +1,51 @@
github.com/AlecAivazis/survey/v2 v2.3.7 h1:6I/u8FvytdGsgonrYsVn2t8t4QiRnh6QSTqkkhIiSjQ=
github.com/AlecAivazis/survey/v2 v2.3.7/go.mod h1:xUTIdE4KCOIjsBAE1JYsUPoCqYdZ1reCfTwbto0Fduo=
github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w=
github.com/creack/pty v1.1.17/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/hinshun/vt10x v0.0.0-20220119200601-820417d04eec/go.mod h1:Q48J4R4DvxnHolD5P8pOtXigYlRuPLGl6moFx3ulM68=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU=
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE=
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
50 changes: 49 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ func printUsage() {
fmt.Fprintf(os.Stderr, " %s apply <config.yaml> - Update Claude config with MCP servers from YAML\n", os.Args[0])
fmt.Fprintf(os.Stderr, " %s convert <config.json> <project-path> - Convert JSON MCP config to YAML and optionally apply\n", os.Args[0])
fmt.Fprintf(os.Stderr, " %s delete <config.yaml> <server-name> <project-path> - Delete MCP server from YAML and optionally from Claude config\n", os.Args[0])
fmt.Fprintf(os.Stderr, "\nMarketplace commands:\n")
fmt.Fprintf(os.Stderr, " %s marketplace list - Browse and install MCP servers from marketplace (interactive)\n", os.Args[0])
fmt.Fprintf(os.Stderr, " %s marketplace search <query> - Search for MCP servers in marketplace\n", os.Args[0])
fmt.Fprintf(os.Stderr, " %s marketplace install <name> <project-path> - Install an MCP server from marketplace\n", os.Args[0])
}

func main() {
Expand Down Expand Up @@ -69,9 +73,53 @@ func main() {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}
case "marketplace":
if len(os.Args) < 3 {
fmt.Fprintf(os.Stderr, "Error: marketplace command requires a subcommand\n")
fmt.Fprintf(os.Stderr, "Usage:\n")
fmt.Fprintf(os.Stderr, " %s marketplace list\n", os.Args[0])
fmt.Fprintf(os.Stderr, " %s marketplace search <query>\n", os.Args[0])
fmt.Fprintf(os.Stderr, " %s marketplace install <name> <project-path>\n", os.Args[0])
os.Exit(1)
}

subcommand := os.Args[2]
switch subcommand {
case "list":
if err := commands.MarketplaceList(); err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}
case "search":
if len(os.Args) < 4 {
fmt.Fprintf(os.Stderr, "Error: search requires a query argument\n")
fmt.Fprintf(os.Stderr, "Usage: %s marketplace search <query>\n", os.Args[0])
os.Exit(1)
}
if err := commands.MarketplaceSearch(os.Args[3]); err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}
case "install":
if len(os.Args) < 5 {
fmt.Fprintf(os.Stderr, "Error: install requires server name and project path\n")
fmt.Fprintf(os.Stderr, "Usage: %s marketplace install <name> <project-path>\n", os.Args[0])
fmt.Fprintf(os.Stderr, "\nExample:\n")
fmt.Fprintf(os.Stderr, " %s marketplace install filesystem /home/user/workspace/my-project\n", os.Args[0])
os.Exit(1)
}
if err := commands.MarketplaceInstall(os.Args[3], os.Args[4]); err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}
default:
fmt.Fprintf(os.Stderr, "Error: unknown marketplace subcommand '%s'\n", subcommand)
fmt.Fprintf(os.Stderr, "Available subcommands: list, search, install\n")
os.Exit(1)
}
default:
fmt.Fprintf(os.Stderr, "Error: unknown command '%s'\n", command)
fmt.Fprintf(os.Stderr, "Available commands: init, dump, apply, convert, delete\n")
fmt.Fprintf(os.Stderr, "Available commands: init, dump, apply, convert, delete, marketplace\n")
os.Exit(1)
}
}
5 changes: 3 additions & 2 deletions pkg/commands/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ func Apply(yamlFile string) error {
return err
}

configPath, _ := config.GetClaudeConfigPath()
fmt.Printf("Successfully updated %s\n", configPath)
if configPath, err := config.GetClaudeConfigPath(); err == nil {
fmt.Printf("Successfully updated %s\n", configPath)
}
fmt.Printf("Updated %d project(s)\n", len(yamlConfig.Projects))

return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/commands/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func Convert(jsonFile, projectPath string) error {
if err := os.WriteFile(tmpFile, yamlData, 0644); err != nil {
return fmt.Errorf("error creating temporary file: %w", err)
}
defer os.Remove(tmpFile)
defer func() { _ = os.Remove(tmpFile) }() //nolint:errcheck // Cleanup, error not critical

// Apply the configuration
if err := Apply(tmpFile); err != nil {
Expand Down
10 changes: 7 additions & 3 deletions pkg/commands/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ func Delete(yamlFile, serverName, projectPath string) error {

// Display server configuration
serverConfig := projectConfig.MCPServers[serverName]
serverYAML, _ := yaml.Marshal(map[string]models.MCPServer{serverName: serverConfig})
serverYAML, err := yaml.Marshal(map[string]models.MCPServer{serverName: serverConfig})
if err != nil {
return fmt.Errorf("error marshaling server config: %w", err)
}
fmt.Println("Configuration:")
fmt.Println("─────────────────────────────────────")
fmt.Print(string(serverYAML))
Expand Down Expand Up @@ -126,8 +129,9 @@ func Delete(yamlFile, serverName, projectPath string) error {
return fmt.Errorf("error updating ~/.claude.json: %w", err)
}

configPath, _ := config.GetClaudeConfigPath()
fmt.Printf("✓ Server '%s' deleted from %s\n", serverName, configPath)
if configPath, err := config.GetClaudeConfigPath(); err == nil {
fmt.Printf("✓ Server '%s' deleted from %s\n", serverName, configPath)
}
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions pkg/commands/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ func Dump() error {
for projectPath, projectConfig := range claudeConfig.Projects {
// Only include projects that have MCP servers
if len(projectConfig.MCPServers) > 0 {
yamlConfig.Projects[projectPath] = models.ProjectServers{
MCPServers: projectConfig.MCPServers,
}
yamlConfig.Projects[projectPath] = models.ProjectServers(projectConfig)
}
}

Expand Down
Loading
Loading