Skip to content

Commit de312ee

Browse files
committed
review http args and add lockdown ctx helpers
1 parent c35ab93 commit de312ee

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
@@ -95,6 +95,7 @@ var (
9595
Short: "Start HTTP server",
9696
Long: `Start an HTTP server that listens for MCP requests over HTTP.`,
9797
RunE: func(_ *cobra.Command, _ []string) error {
98+
ttl := viper.GetDuration("repo-access-cache-ttl")
9899
httpConfig := ghhttp.HTTPServerConfig{
99100
Version: version,
100101
Host: viper.GetString("host"),
@@ -103,6 +104,8 @@ var (
103104
EnableCommandLogging: viper.GetBool("enable-command-logging"),
104105
LogFilePath: viper.GetString("log-file"),
105106
ContentWindowSize: viper.GetInt("content-window-size"),
107+
LockdownMode: viper.GetBool("lockdown-mode"),
108+
RepoAccessCacheTTL: &ttl,
106109
}
107110

108111
return ghhttp.RunHTTPServer(httpConfig)

pkg/context/request.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,19 @@ func GetToolset(ctx context.Context) string {
3333
}
3434
return ""
3535
}
36+
37+
// lockdownCtxKey is a context key for lockdown mode
38+
type lockdownCtxKey struct{}
39+
40+
// WithLockdownMode adds lockdown mode state to the context
41+
func WithLockdownMode(ctx context.Context, enabled bool) context.Context {
42+
return context.WithValue(ctx, lockdownCtxKey{}, enabled)
43+
}
44+
45+
// IsLockdownMode retrieves the lockdown mode state from the context
46+
func IsLockdownMode(ctx context.Context) bool {
47+
if enabled, ok := ctx.Value(lockdownCtxKey{}).(bool); ok {
48+
return enabled
49+
}
50+
return false
51+
}

0 commit comments

Comments
 (0)