Skip to content

Commit d8860c7

Browse files
committed
refactor: rename TLS_HOST_AUTO_DETECT to AUTO_TLS for clarity
- Rename environment variable TLS_HOST_AUTO_DETECT to AUTO_TLS - Update CLI flag from --tls-host-auto-detect to --auto-tls - Update function parameter names and error messages - Update documentation in README.md This change improves naming consistency and clarity of the TLS configuration option.
1 parent 7f3c0ea commit d8860c7

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ For a simpler approach to publish local MCP servers over OAuth, consider [MCP Wa
104104
| ---------------------- | -------- | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------ |
105105
| `LISTEN` | No | Server listen address | `:80` |
106106
| `TLS_LISTEN` | No | Address to listen on for TLS | `:443` |
107+
| `AUTO_TLS` | No | Automatically setup TLS certificates from externalURL | `true` |
107108
| `TLS_HOST` | No | Host name for automatic TLS certificate | - |
108-
| `TLS_HOST_AUTO_DETECT` | No | Automatically detect TLS host from externalURL | `true` |
109109
| `TLS_DIRECTORY_URL` | No | ACME directory URL for TLS certificates | `https://acme-v02.api.letsencrypt.org/directory` |
110110
| `TLS_ACCEPT_TOS` | No | Accept TLS terms of service | `false` |
111111
| `DATA_PATH` | No | Data directory path | `./data` |
@@ -210,3 +210,7 @@ Breaking changes should be indicated by a `!` after the type/scope:
210210
```
211211
feat!: change authentication API to support multiple providers
212212
```
213+
214+
### PR Template
215+
216+
- [./.github/pull_request_template.md](./.github/pull_request_template.md)

main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ func getEnvBoolWithDefault(key string, defaultValue bool) bool {
2828
func main() {
2929
var listen string
3030
var listenTLS string
31+
var autoTLS bool
3132
var tlsHost string
32-
var tlsHostAutoDetect bool
3333
var tlsDirectoryURL string
3434
var tlsAcceptTOS bool
3535
var dataPath string
@@ -76,8 +76,8 @@ func main() {
7676
if err := mcpproxy.Run(
7777
listen,
7878
listenTLS,
79+
autoTLS,
7980
tlsHost,
80-
tlsHostAutoDetect,
8181
tlsDirectoryURL,
8282
tlsAcceptTOS,
8383
dataPath,
@@ -101,8 +101,8 @@ func main() {
101101

102102
rootCmd.Flags().StringVar(&listen, "listen", getEnvWithDefault("LISTEN", ":80"), "Address to listen on")
103103
rootCmd.Flags().StringVar(&listenTLS, "listen-tls", getEnvWithDefault("TLS_LISTEN", ":443"), "Address to listen on for TLS")
104+
rootCmd.Flags().BoolVar(&autoTLS, "auto-tls", getEnvBoolWithDefault("AUTO_TLS", true), "Automatically detect TLS host from externalURL")
104105
rootCmd.Flags().StringVarP(&tlsHost, "tls-host", "H", getEnvWithDefault("TLS_HOST", ""), "Host name for TLS")
105-
rootCmd.Flags().BoolVar(&tlsHostAutoDetect, "tls-host-auto-detect", getEnvBoolWithDefault("TLS_HOST_AUTO_DETECT", true), "Automatically detect TLS host from externalURL")
106106
rootCmd.Flags().StringVar(&tlsDirectoryURL, "tls-directory-url", getEnvWithDefault("TLS_DIRECTORY_URL", "https://acme-v02.api.letsencrypt.org/directory"), "ACME directory URL for TLS certificates")
107107
rootCmd.Flags().BoolVar(&tlsAcceptTOS, "tls-accept-tos", getEnvBoolWithDefault("TLS_ACCEPT_TOS", false), "Accept TLS terms of service")
108108
rootCmd.Flags().StringVarP(&dataPath, "data", "d", getEnvWithDefault("DATA_PATH", "./data"), "Path to the data directory")

pkg/mcp-proxy/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ var ServerShutdownTimeout = 5 * time.Second
3636
func Run(
3737
listen string,
3838
listenTLS string,
39+
autoTLS bool,
3940
tlsHost string,
40-
tlsHostAutoDetect bool,
4141
tlsDirectoryURL string,
4242
tlsAcceptTOS bool,
4343
dataPath string,
@@ -188,7 +188,7 @@ func Run(
188188
proxyRouter.SetupRoutes(router)
189189

190190
var tlsHostDetected bool
191-
if tlsHostAutoDetect &&
191+
if autoTLS &&
192192
tlsHost == "" &&
193193
parsedExternalURL.Scheme == "https" &&
194194
parsedExternalURL.Host != "localhost" {
@@ -204,7 +204,7 @@ func Run(
204204
if tlsHost != "" {
205205
if !tlsAcceptTOS {
206206
if tlsHostDetected {
207-
return errors.New("TLS host is auto-detected, but tlsAcceptTOS is not set to true. Please agree to the TOS or set tlsHostAutoDetect to false")
207+
return errors.New("TLS host is auto-detected, but tlsAcceptTOS is not set to true. Please agree to the TOS or set autoTLS to false")
208208
} else {
209209
return errors.New("TLS is enabled, but tlsAcceptTOS is not set to true. Please explicitly agree to the TOS")
210210
}

0 commit comments

Comments
 (0)