You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Should the MCP server reload its ResourceStore when complypack.yaml or the cache directory changes, and if so, what's the right implementation?
Context
The MCP server loads all artifacts, schemas, and resolved policies once at startup in NewServer and holds them in a read-only ResourceStore. Any change requires restarting the server and the MCP client session.
In Claude Code, the MCP server stays alive for the entire session. In a long session, a user may pull a new catalog version (complypack pull) or edit their config mid-conversation. Without hot-reload, picking up those changes means restarting the server and losing session context.
Config loading today is hand-rolled (os.ReadFile + yaml.Unmarshal in internal/config/). The project already uses Cobra but not Viper.
Options Considered
Viper — WatchConfig() + OnConfigChange() gives file-watch and hot-reload with minimal custom code. Also handles XDG path resolution (relevant to Persistent OCI cache with XDG_CACHE_HOME support #88). Natural pairing with Cobra. Downside: Viper is a heavy dependency for what may be a narrow use case — it pulls in a large transitive tree.
fsnotify directly — lighter dependency, more control, but more code to maintain.
Manual reload command — MCP tool or signal-based (e.g. SIGHUP). No file watching complexity, user-initiated only.
Design Question
Should the MCP server reload its ResourceStore when
complypack.yamlor the cache directory changes, and if so, what's the right implementation?Context
The MCP server loads all artifacts, schemas, and resolved policies once at startup in
NewServerand holds them in a read-onlyResourceStore. Any change requires restarting the server and the MCP client session.In Claude Code, the MCP server stays alive for the entire session. In a long session, a user may pull a new catalog version (
complypack pull) or edit their config mid-conversation. Without hot-reload, picking up those changes means restarting the server and losing session context.Config loading today is hand-rolled (
os.ReadFile+yaml.Unmarshalininternal/config/). The project already uses Cobra but not Viper.Options Considered
WatchConfig()+OnConfigChange()gives file-watch and hot-reload with minimal custom code. Also handles XDG path resolution (relevant to Persistent OCI cache with XDG_CACHE_HOME support #88). Natural pairing with Cobra. Downside: Viper is a heavy dependency for what may be a narrow use case — it pulls in a large transitive tree.Acceptance Criteria (if we proceed)