Skip to content

Config Options

ConfigInput

The type passed to defineConfig():

ts
interface ConfigInput {
  servers?: ServerConfig[];
  rules?: Array<Rule | RuleBuilder>;
  protect?: string[];
  onViolation?: "block" | "warn" | "log";
  trace?: TraceConfig;
  log?: LogConfig;
}
FieldTypeDefaultDescription
serversServerConfig[]--Backend MCP server definitions
rules(Rule | RuleBuilder)[]--Array of rules to apply
protectstring[]--Preset names to enable
onViolation"block" | "warn" | "log""block"Default action on violation
traceTraceConfig--Trace settings
logLogConfig--Log settings

ServerConfig

ts
interface ServerConfig {
  name: string;
  command: string;
  args?: string[];
  env?: Record<string, string>;
  cwd?: string;
}
FieldTypeRequiredDescription
namestringYesServer identifier
commandstringYesLaunch command
argsstring[]NoCommand arguments
envRecord<string, string>NoEnvironment variables (${VAR} expansion supported)
cwdstringNoWorking directory

TraceConfig

ts
interface TraceConfig {
  maxMessages?: number;
  export?: string;
}
FieldTypeDefaultDescription
maxMessagesnumber1000Max messages to retain
exportstring--Trace output path

LogConfig

ts
interface LogConfig {
  level?: "debug" | "info" | "warn" | "error";
  format?: "json" | "text";
  output?: string;
}
FieldTypeDefaultDescription
level"debug" | "info" | "warn" | "error""info"Log level
format"json" | "text""text"Output format
outputstring--Log file path

GuardrailsConfig

The final config type returned by defineConfig():

ts
interface GuardrailsConfig {
  servers?: ServerConfig[];
  rules: Rule[];
  onViolation?: "block" | "warn" | "log";
  trace?: TraceConfig;
  log?: LogConfig;
}

Differences from ConfigInput:

  • rules is Rule[] only (builders are resolved)
  • No protect field (presets are expanded into rules)