Skip to content

Commit 0cd3da4

Browse files
authored
add setup instructions to fly mcp launch (#4410)
1 parent 63f9b2b commit 0cd3da4

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

internal/command/mcp/launch.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ func NewLaunch() *cobra.Command {
105105
Name: "image",
106106
Description: "The image to use for the app",
107107
},
108+
flag.StringSlice{
109+
Name: "setup",
110+
Description: "Additional setup commands to run before launching the MCP server",
111+
},
108112
flag.VMSizeFlags,
109113
)
110114

@@ -134,6 +138,11 @@ func runLaunch(ctx context.Context) error {
134138
return fmt.Errorf("missing command or image to run")
135139
}
136140

141+
setup := flag.GetStringSlice(ctx, "setup")
142+
if len(setup) > 0 && image == "" {
143+
image = "flyio/mcp"
144+
}
145+
137146
// extract the entrypoint from the image
138147
entrypoint := []string{}
139148
if image != "" {
@@ -150,7 +159,10 @@ func runLaunch(ctx context.Context) error {
150159
return fmt.Errorf("failed to get image config: %w", err)
151160
}
152161
entrypoint = cfg.Config.Entrypoint
153-
cmdParts = cfg.Config.Cmd
162+
163+
if len(cmdParts) == 0 {
164+
cmdParts = cfg.Config.Cmd
165+
}
154166
}
155167

156168
// determine the name of the MCP server
@@ -210,6 +222,8 @@ func runLaunch(ctx context.Context) error {
210222
"COPY --from=flyio/flyctl /flyctl /usr/bin/flyctl",
211223
}
212224

225+
dockerfile = append(dockerfile, setup...)
226+
213227
if len(cmdParts) > 0 {
214228
// Build the Dockerfile - no longer needed; but may once again be useful in the future?
215229
jsonData, err := json.Marshal(cmdParts)

0 commit comments

Comments
 (0)