Documentation
¶
Overview ¶
Package bootstrap is the composition root entry point for the kite-mcp-server stack. Deploy repos import this package and call Main(Options{}) from their thin main.go.
All composition + DI wiring + HTTP serving lives in subpackages:
- app/ : Fx wiring + HTTP mux + lifecycle
- kc/ : Kite client manager + sessions + credential store
- kc/ops/ : Admin + user dashboards + scanner + payoff
- mcp/ : MCP tool registrations + middleware
- plugins/ : plugin scaffolding sub-module
- testutil/ : test fixtures sub-module
Index ¶
Constants ¶
const MemoryLimitBytes int64 = 450 * 1024 * 1024 // 450 MB
MemoryLimitBytes is the soft GC target for the Go runtime — set via runtime/debug.SetMemoryLimit at package init. Path C item per the kite-mcp-server audit 6ee6520: prevents OOM-kill on the 512MB Fly.io machine.
450 MB target leaves ~62 MB headroom on a 512 MB machine — the empirical industry standard is 85-90% of available RAM, so 450/512 = 88% sits in the conservative upper-band.
GOMEMLIMIT env var (read at runtime startup) overrides this — the in-code default is intentionally visible for ops audit + debugging.
Variables ¶
This section is empty.
Functions ¶
func InitLogger ¶
InitLogger constructs the production logger + log buffer pair. LOG_LEVEL env var controls the slog level via ParseLogLevel. The returned *ops.LogBuffer captures the last 500 log entries for the ops dashboard log streaming endpoint.
func Main ¶
Main is the composition-root entry point. Deploy repos call this from their thin main.go after parsing --version flags themselves.
Main blocks until shutdown (SIGINT/SIGTERM/SIGUSR2 graceful restart). Returns os.Exit code: 0 on clean shutdown, 1 on config-load failure or server start failure.
Contract: Main does NOT call os.Exit itself — callers should:
func main() {
os.Exit(bootstrap.Main(bootstrap.Options{
Version: MCP_SERVER_VERSION,
BuildString: buildString,
}))
}
func ParseLogLevel ¶
ParseLogLevel maps a raw LOG_LEVEL env value to a slog.Level. Empty string or unrecognised values default to LevelInfo. Pure function.
Valid input values: "debug", "info", "warn", "error", "". Anything else also defaults to info; the "default to INFO if invalid" branch is fail- open: a typo'd LOG_LEVEL must not silence logs.
func PrintVersion ¶
func PrintVersion(o Options)
PrintVersion writes version + build info to stdout — exposed so deploy repos can implement their own --version flag in main without importing fmt themselves.
Types ¶
type Options ¶
type Options struct {
// Version is the MCP_SERVER_VERSION string (typically set via ldflags
// at build time: -X main.MCP_SERVER_VERSION=v1.2.3).
Version string
// BuildString is the human-readable build identifier (typically set
// via ldflags at build time: -X 'main.buildString=2026-05-16 abc123').
BuildString string
}
Options are the runtime parameters a deploy repo's main.go injects when calling Main. Both fields default to dev placeholders when empty.