Skip to content

Commit bbb1d10

Browse files
committed
review http args and add lockdown ctx helpers
1 parent a92b77b commit bbb1d10

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

cmd/github-mcp-server/main.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ var (
9696
Short: "Start HTTP server",
9797
Long: `Start an HTTP server that listens for MCP requests over HTTP.`,
9898
RunE: func(_ *cobra.Command, _ []string) error {
99+
ttl := viper.GetDuration("repo-access-cache-ttl")
99100
httpConfig := ghhttp.HTTPServerConfig{
100101
Version: version,
101102
Host: viper.GetString("host"),
@@ -104,6 +105,8 @@ var (
104105
EnableCommandLogging: viper.GetBool("enable-command-logging"),
105106
LogFilePath: viper.GetString("log-file"),
106107
ContentWindowSize: viper.GetInt("content-window-size"),
108+
LockdownMode: viper.GetBool("lockdown-mode"),
109+
RepoAccessCacheTTL: &ttl,
107110
}
108111

109112
return ghhttp.RunHTTPServer(httpConfig)

pkg/context/request.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,19 @@ func GetTools(ctx context.Context) []string {
4949
}
5050
return nil
5151
}
52+
53+
// lockdownCtxKey is a context key for lockdown mode
54+
type lockdownCtxKey struct{}
55+
56+
// WithLockdownMode adds lockdown mode state to the context
57+
func WithLockdownMode(ctx context.Context, enabled bool) context.Context {
58+
return context.WithValue(ctx, lockdownCtxKey{}, enabled)
59+
}
60+
61+
// IsLockdownMode retrieves the lockdown mode state from the context
62+
func IsLockdownMode(ctx context.Context) bool {
63+
if enabled, ok := ctx.Value(lockdownCtxKey{}).(bool); ok {
64+
return enabled
65+
}
66+
return false
67+
}

0 commit comments

Comments
 (0)