Commit 0009501
Refactor server init to use template files with --template flag
Restructures the `docker mcp server init` command to use file-based templates
instead of embedded constants, making it easier to maintain and extend.
Changes:
- Created two template directories:
- templates/basic: Simple MCP server without UI
- templates/chatgpt-app-basic: MCP server with ChatGPT App UI
- Each template has separate .tmpl files for all generated files
- Refactored init.go to use go:embed and text/template
- Added required --template flag to init command
- Template files use {{.ServerName}} for customization
Templates:
- basic: Simple greeter with single name parameter, no UI
- chatgpt-app-basic: Greeter with dropdown (Hi/Hey/Hello), UI resource,
and full ChatGPT App integration
Usage:
- docker mcp server init --template=basic my-server
- docker mcp server init --template=chatgpt-app-basic my-app
Benefits:
- Easy to add new templates (just create new folder)
- Templates are actual files, easier to edit and test
- Clear separation between basic and ChatGPT App templates
- Better error messages for invalid templates
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 0c26008 commit 0009501
File tree
15 files changed
+635
-478
lines changed- cmd/docker-mcp
- commands
- server
- templates
- basic
- chatgpt-app-basic
15 files changed
+635
-478
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| 122 | + | |
122 | 123 | | |
123 | 124 | | |
124 | 125 | | |
125 | 126 | | |
126 | 127 | | |
127 | 128 | | |
128 | 129 | | |
129 | | - | |
| 130 | + | |
130 | 131 | | |
131 | 132 | | |
132 | 133 | | |
133 | | - | |
| 134 | + | |
134 | 135 | | |
135 | 136 | | |
136 | 137 | | |
| |||
139 | 140 | | |
140 | 141 | | |
141 | 142 | | |
| 143 | + | |
| 144 | + | |
142 | 145 | | |
143 | 146 | | |
144 | 147 | | |
| |||
0 commit comments