Skip to content

Commit 12f60bf

Browse files
authored
Merge pull request #4 from jritsema/feature/container-tool
Add container-tool config option
2 parents 790d1a7 + e169521 commit 12f60bf

5 files changed

Lines changed: 53 additions & 9 deletions

File tree

AmazonQ.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,4 +231,4 @@ The output MCP JSON file would look like this.
231231

232232
# Guidelines
233233

234-
Before making any code changes, first checkout a new git branch. After updating code, run `make build` to ensure that the code compiles. Then, after testing, git commit your changes with a concise short message on one line along with a longer summary message.
234+
Before making any code changes, first checkout a new git branch. After updating code, run `make build` to ensure that the code compiles. Run `go fmt` to ensure your code is correctly formatted. Then, after testing your changes, git commit your changes with a concise short message on one line along with a longer summary message.

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ MCP CLI supports these predefined tool shortcuts for popular AI tools:
9292
- `claude-desktop` - Claude Desktop (`$HOME/Library/Application Support/Claude/claude_desktop_config.json`)
9393
- `cursor` - Cursor IDE (`$HOME/.cursor/mcp.json`)
9494

95-
### Setting Default Tool
95+
### Setting Default AI Tool
9696

97-
Configure a default tool to avoid specifying `-t` each time:
97+
Configure a default AI tool to avoid specifying `-t` each time:
9898

9999
```sh
100100
# Set Amazon Q CLI as your default tool
@@ -107,6 +107,15 @@ mcp set programming
107107
mcp set
108108
```
109109

110+
### Setting Container Tool
111+
112+
If you're using containers to run your MCP servers (by setting the `image` property), then MCP CLI will output `docker` run commands by default. If you're using a different container tool such as `finch` or `podman`, etc., then you can use the `set container-tool` command.
113+
114+
```sh
115+
# Set a custom container tool (default is docker)
116+
mcp config set container-tool finch
117+
```
118+
110119
### Profiles
111120

112121
Organize your MCP servers with profiles using the `labels` field in your `mcp-compose.yml`:

cmd/config.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import (
1111

1212
// CLIConfig represents the structure of the MCP CLI config file
1313
type CLIConfig struct {
14-
Tool string `json:"tool,omitempty"`
14+
Tool string `json:"tool,omitempty"`
15+
ContainerTool string `json:"container-tool,omitempty"`
1516
}
1617

1718
var configCmd = &cobra.Command{
@@ -29,7 +30,7 @@ var configSetCmd = &cobra.Command{
2930
key := args[0]
3031
value := args[1]
3132

32-
if key != "tool" {
33+
if key != "tool" && key != "container-tool" {
3334
fmt.Fprintf(os.Stderr, "Error: unsupported configuration key: %s\n", key)
3435
os.Exit(1)
3536
}
@@ -71,6 +72,8 @@ var configSetCmd = &cobra.Command{
7172
switch key {
7273
case "tool":
7374
config.Tool = value
75+
case "container-tool":
76+
config.ContainerTool = value
7477
}
7578

7679
// Write the updated config

cmd/list.go

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package cmd
22

33
import (
4+
"encoding/json"
45
"fmt"
56
"os"
7+
"path/filepath"
68
"strings"
79
"text/tabwriter"
810

@@ -104,9 +106,24 @@ func printServerRow(w *tabwriter.Writer, name string, service Service) {
104106
if longFormat {
105107
var commandStr string
106108

109+
// Get the container tool from config, default to "docker"
110+
containerTool := "docker"
111+
configDir := getConfigDir()
112+
configPath := filepath.Join(configDir, "config.json")
113+
114+
if _, err := os.Stat(configPath); err == nil {
115+
data, err := os.ReadFile(configPath)
116+
if err == nil {
117+
var config CLIConfig
118+
if err := json.Unmarshal(data, &config); err == nil && config.ContainerTool != "" {
119+
containerTool = config.ContainerTool
120+
}
121+
}
122+
}
123+
107124
if service.Image != "" {
108-
// For image-based servers, show the docker run command format
109-
commandStr = fmt.Sprintf("docker run -i --rm")
125+
// For image-based servers, show the container run command format
126+
commandStr = fmt.Sprintf("%s run -i --rm", containerTool)
110127

111128
// Add environment variables to the command
112129
for key := range service.Environment {

cmd/set.go

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,27 @@ type MCPServer struct {
152152
func convertToMCPConfig(servers map[string]Service, envVars map[string]string) MCPConfig {
153153
mcpServers := make(map[string]MCPServer)
154154

155+
// Get the container tool from config, default to "docker"
156+
containerTool := "docker"
157+
configDir := getConfigDir()
158+
configPath := filepath.Join(configDir, "config.json")
159+
160+
if _, err := os.Stat(configPath); err == nil {
161+
data, err := os.ReadFile(configPath)
162+
if err == nil {
163+
var config CLIConfig
164+
if err := json.Unmarshal(data, &config); err == nil && config.ContainerTool != "" {
165+
containerTool = config.ContainerTool
166+
}
167+
}
168+
}
169+
155170
for name, service := range servers {
156171
var mcpServer MCPServer
157172

158173
if service.Image != "" {
159-
// Docker container
160-
mcpServer.Command = "docker"
174+
// Container-based server
175+
mcpServer.Command = containerTool
161176
args := []string{"run", "-i", "--rm"}
162177

163178
// Add environment variables with expanded values

0 commit comments

Comments
 (0)