Skip to content

Commit 00c55f5

Browse files
committed
Add init command docs
1 parent fcc5a69 commit 00c55f5

File tree

6 files changed

+64
-13
lines changed

6 files changed

+64
-13
lines changed

cmd/docker-mcp/commands/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ func serverCommand(docker docker.Client, dockerCli command.Cli) *cobra.Command {
141141
}
142142
initCommand.Flags().StringVar(&language, "language", "go", "Programming language for the server (currently only 'go' is supported)")
143143
initCommand.Flags().StringVar(&templateName, "template", "basic", "Template to use (basic, chatgpt-app-basic)")
144-
initCommand.MarkFlagRequired("template")
144+
_ = initCommand.MarkFlagRequired("template")
145145
cmd.AddCommand(initCommand)
146146

147147
return cmd

cmd/docker-mcp/server/init.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func getTemplateSet(templateName string) (*templateSet, error) {
9090
}
9191

9292
// Init initializes a new MCP server project in the specified directory
93-
func Init(ctx context.Context, dir string, language string, templateName string) error {
93+
func Init(_ context.Context, dir string, language string, templateName string) error {
9494
if language != "go" {
9595
return fmt.Errorf("unsupported language: %s (currently only 'go' is supported)", language)
9696
}
@@ -102,7 +102,7 @@ func Init(ctx context.Context, dir string, language string, templateName string)
102102
}
103103

104104
// Create directory if it doesn't exist
105-
if err := os.MkdirAll(dir, 0755); err != nil {
105+
if err := os.MkdirAll(dir, 0o755); err != nil {
106106
return fmt.Errorf("creating directory: %w", err)
107107
}
108108

@@ -121,12 +121,12 @@ func Init(ctx context.Context, dir string, language string, templateName string)
121121

122122
// Generate files from templates
123123
files := map[string]string{
124-
"main.go": templates.mainGo,
125-
"Dockerfile": templates.dockerfile,
126-
"compose.yaml": templates.compose,
127-
"catalog.yaml": templates.catalog,
128-
"go.mod": templates.goMod,
129-
"README.md": templates.readme,
124+
"main.go": templates.mainGo,
125+
"Dockerfile": templates.dockerfile,
126+
"compose.yaml": templates.compose,
127+
"catalog.yaml": templates.catalog,
128+
"go.mod": templates.goMod,
129+
"README.md": templates.readme,
130130
}
131131

132132
// Add ui.html for chatgpt-app-basic template
@@ -148,7 +148,7 @@ func Init(ctx context.Context, dir string, language string, templateName string)
148148

149149
// Write file
150150
path := filepath.Join(dir, filename)
151-
if err := os.WriteFile(path, buf.Bytes(), 0644); err != nil {
151+
if err := os.WriteFile(path, buf.Bytes(), 0o644); err != nil {
152152
return fmt.Errorf("writing %s: %w", filename, err)
153153
}
154154
}

cmd/docker-mcp/server/templates/basic/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func main() {
2222
mcp.AddTool(server, &mcp.Tool{
2323
Name: "greet",
2424
Description: "say hi",
25-
}, func(ctx context.Context, req *mcp.CallToolRequest, args args) (*mcp.CallToolResult, any, error) {
25+
}, func(_ context.Context, _ *mcp.CallToolRequest, args args) (*mcp.CallToolResult, any, error) {
2626
return &mcp.CallToolResult{
2727
Content: []mcp.Content{
2828
&mcp.TextContent{Text: "Hi " + args.Name},

cmd/docker-mcp/server/templates/chatgpt-app-basic/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func main() {
2121
Name: "Greeter Widget",
2222
Description: "Interactive UI for the greeter tool",
2323
MIMEType: "text/html+skybridge",
24-
}, func(ctx context.Context, req *mcp.ReadResourceRequest) (*mcp.ReadResourceResult, error) {
24+
}, func(_ context.Context, _ *mcp.ReadResourceRequest) (*mcp.ReadResourceResult, error) {
2525
return &mcp.ReadResourceResult{
2626
Contents: []*mcp.ResourceContents{
2727
{
@@ -50,7 +50,7 @@ func main() {
5050
"openai/toolInvocation/invoking": "Greeting...",
5151
"openai/widgetAccessible": true,
5252
},
53-
}, func(ctx context.Context, req *mcp.CallToolRequest, args args) (*mcp.CallToolResult, any, error) {
53+
}, func(_ context.Context, _ *mcp.CallToolRequest, args args) (*mcp.CallToolResult, any, error) {
5454
// Default to "Hi" if not specified
5555
greetingType := args.GreetingType
5656
if greetingType == "" {
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
command: docker mcp server init
2+
short: Initialize a new MCP server project
3+
long: |
4+
Initialize a new MCP server project in the specified directory with boilerplate code, Dockerfile, and compose.yaml
5+
usage: docker mcp server init <directory>
6+
pname: docker mcp server
7+
plink: docker_mcp_server.yaml
8+
options:
9+
- option: language
10+
value_type: string
11+
default_value: go
12+
description: |
13+
Programming language for the server (currently only 'go' is supported)
14+
deprecated: false
15+
hidden: false
16+
experimental: false
17+
experimentalcli: false
18+
kubernetes: false
19+
swarm: false
20+
- option: template
21+
value_type: string
22+
default_value: basic
23+
description: Template to use (basic, chatgpt-app-basic)
24+
deprecated: false
25+
hidden: false
26+
experimental: false
27+
experimentalcli: false
28+
kubernetes: false
29+
swarm: false
30+
deprecated: false
31+
hidden: false
32+
experimental: false
33+
experimentalcli: false
34+
kubernetes: false
35+
swarm: false
36+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# docker mcp server init
2+
3+
<!---MARKER_GEN_START-->
4+
Initialize a new MCP server project in the specified directory with boilerplate code, Dockerfile, and compose.yaml
5+
6+
### Options
7+
8+
| Name | Type | Default | Description |
9+
|:-------------|:---------|:--------|:-----------------------------------------------------------------------|
10+
| `--language` | `string` | `go` | Programming language for the server (currently only 'go' is supported) |
11+
| `--template` | `string` | `basic` | Template to use (basic, chatgpt-app-basic) |
12+
13+
14+
<!---MARKER_GEN_END-->
15+

0 commit comments

Comments
 (0)