config

package
v0.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package config provides configuration management and MCP proxy functionality for the Centian tool.

Index

Constants

View Source
const (
	VerificationRequirementOff      = "off"
	VerificationRequirementOptional = "optional"
	VerificationRequirementRequired = "required"
)

Gateway verification requirement values control how a gateway participates in project task verification.

View Source
const (
	DefaultProxyLogLevel      = "info"
	DefaultProxyLogOutput     = "file"
	DefaultEventStorageDriver = "sqlite"
)

Default proxy logging settings.

View Source
const (
	// BuiltinPatternRedactionProcessor redacts user-configured regex patterns.
	BuiltinPatternRedactionProcessor = "pattern_redaction_processor"
	// BuiltinSecretTokenRedactor redacts common secret and token patterns.
	BuiltinSecretTokenRedactor = "secret_token_redactor"
	// BuiltinPIIRedactor redacts deterministic PII-like patterns.
	BuiltinPIIRedactor = "pii_redactor"
	// BuiltinToolCallGuard blocks or annotates configured tool-call policy matches.
	BuiltinToolCallGuard = "tool_call_guard"
)
View Source
const (
	BuiltinRedactionModeRedact   = "redact"
	BuiltinRedactionModeAnnotate = "annotate"

	BuiltinRedactionScopeRequest  = "request"
	BuiltinRedactionScopeResponse = "response"
	BuiltinRedactionScopeBoth     = "both"
)

Builtin redaction modes and scopes for pattern-based redaction processors.

View Source
const (
	BuiltinToolGuardModeBlock    = "block"
	BuiltinToolGuardModeAnnotate = "annotate"

	BuiltinToolGuardPresetDangerousCommands = "dangerous_commands"
	BuiltinToolGuardPresetPathBoundary      = "path_boundary"
)

Builtin tool-guard modes and rule presets for the tool-call guard processor.

View Source
const BuiltinPromptInjectionGuard = "prompt_injection_guard"

BuiltinPromptInjectionGuard is the in-process prompt injection detection processor.

View Source
const DefaultAuthHeader = "X-Centian-Auth"

DefaultAuthHeader represents the default header for authentication at the Centian server.

View Source
const DefaultProjectSlug = "default"

DefaultProjectSlug is the project slug used when no explicit projects are configured.

View Source
const DefaultProxyHost = "127.0.0.1"

DefaultProxyHost represents the default bind address for the Centian server.

Variables

View Source
var ConfigCommand = &cli.Command{
	Name:        "config",
	Usage:       "Manage centian configuration",
	Description: "Commands to manage the global centian configuration at ~/.centian/config.json",
	Commands: []*cli.Command{
		configInitCommand,
		configShowCommand,
		configValidateCommand,
		configRestoreCommand,
		configRemoveCommand,
	},
}

ConfigCommand provides configuration management subcommands for the centian CLI. This is the main entry point for all config-related operations including initialization, validation, and server management.

View Source
var ServerCommand = &cli.Command{
	Name:        "server",
	Usage:       "Manage MCP servers",
	Description: "Add, remove, and configure MCP servers",
	Commands: []*cli.Command{
		{
			Name:        "list",
			Usage:       "List all configured servers",
			Description: "Display all MCP servers in the configuration",
			Flags: []cli.Flag{
				&cli.BoolFlag{
					Name:    "enabled-only",
					Aliases: []string{"e"},
					Usage:   "Show only enabled servers",
				},
			},
			Action: listServers,
		},
		{
			Name:        "add",
			Usage:       "Add a new server",
			Description: "Add a new MCP server configuration",
			Flags: []cli.Flag{
				&cli.StringFlag{
					Name:     "name",
					Aliases:  []string{"n"},
					Usage:    "Server name",
					Required: true,
				},
				&cli.StringFlag{
					Name:    "gateway",
					Aliases: []string{"gw"},
					Usage:   "Gateway name",
					Value:   "default",
				},
				&cli.StringFlag{
					Name:    "command",
					Aliases: []string{"c"},
					Usage:   "Server command",
				},
				&cli.StringSliceFlag{
					Name:    "args",
					Aliases: []string{"a"},
					Usage:   "Command arguments",
				},
				&cli.StringFlag{
					Name:    "url",
					Aliases: []string{"u"},
					Usage:   "Server URL",
				},
				&cli.StringMapFlag{
					Name:    "headers",
					Aliases: []string{"hd"},
					Usage:   "Server Headers",
				},
				&cli.StringFlag{
					Name:    "description",
					Aliases: []string{"d"},
					Usage:   "Server description",
				},
				&cli.BoolFlag{
					Name:  "enabled",
					Usage: "Enable server",
					Value: true,
				},
			},
			Action: addServer,
		},
		{
			Name:        "remove",
			Usage:       "Remove a server",
			Description: "Remove an MCP server from configuration",
			Flags: []cli.Flag{
				&cli.StringFlag{
					Name:     "name",
					Aliases:  []string{"n"},
					Usage:    "Server name to remove",
					Required: true,
				},
			},
			Action: removeServer,
		},
		{
			Name:        "enable",
			Usage:       "Enable a server",
			Description: "Enable an MCP server",
			Flags: []cli.Flag{
				&cli.StringFlag{
					Name:     "name",
					Aliases:  []string{"n"},
					Usage:    "Server name to enable",
					Required: true,
				},
			},
			Action: enableServer,
		},
		{
			Name:        "disable",
			Usage:       "Disable a server",
			Description: "Disable an MCP server",
			Flags: []cli.Flag{
				&cli.StringFlag{
					Name:     "name",
					Aliases:  []string{"n"},
					Usage:    "Server name to disable",
					Required: true,
				},
			},
			Action: disableServer,
		},
	},
}

ServerCommand provides MCP server management functionality.

Functions

func EnsureConfigDir

func EnsureConfigDir() error

EnsureConfigDir creates the config directory if it doesn't exist.

func GetConfigDir

func GetConfigDir() (string, error)

GetConfigDir returns the centian config directory path.

func GetConfigPath

func GetConfigPath() (string, error)

GetConfigPath returns the full path to config.json.

func HasOAuthServers added in v0.0.6

func HasOAuthServers(config *GlobalConfig) bool

HasOAuthServers reports whether any configured downstream server enables OAuth. Checks both legacy flat gateways and project-scoped gateways.

func ImportServers added in v0.0.6

func ImportServers(cfg *GlobalConfig, servers []ImportedServer) (int, error)

ImportServers adds imported servers to the default gateway when they validate cleanly.

func InferCommandFromPath added in v0.0.4

func InferCommandFromPath(path string) (command string, args []string, err error)

InferCommandFromPath determines the runtime command and args for a CLI processor based on the file extension of the script path.

func InferProcessorNameFromPath added in v0.0.4

func InferProcessorNameFromPath(path string) string

InferProcessorNameFromPath extracts a processor name from a file path. Strips the directory and extension, lowercases the result.

func InferProcessorNameFromWebhookURL added in v0.0.6

func InferProcessorNameFromWebhookURL(rawURL string) string

InferProcessorNameFromWebhookURL extracts a processor name from a webhook URL. Prefers the last path segment and falls back to hostname when no path segment exists.

func ProcessorConfigStringMap added in v0.0.6

func ProcessorConfigStringMap(value interface{}) (map[string]string, error)

ProcessorConfigStringMap converts a config value into a string map. Accepts both map[string]string and map[string]interface{} with string values.

func ResolveEventStorePath added in v0.4.0

func ResolveEventStorePath(settings *EventStorageCapabilitySettings) (string, error)

ResolveEventStorePath resolves the effective SQLite event-store path using the same semantics Centian startup applies at runtime.

func SaveConfig

func SaveConfig(config *GlobalConfig) error

SaveConfig saves the configuration to ~/.centian/config.json. Creates the ~/.centian directory if it doesn't exist and writes the configuration as formatted JSON with proper indentation.

func ValidateConfig

func ValidateConfig(config *GlobalConfig, strict bool) error

ValidateConfig performs basic schema validation on the configuration. This validates required fields and structure but allows empty gateways. Use ValidateConfigForServer for operational validation before starting a server.

Supports both legacy flat layout and project-based layout.

Types

type AuthBackendSettings added in v0.4.4

type AuthBackendSettings struct {
	Type  string `json:"type,omitempty"`  // "sqlite" (default) or "file"
	Store string `json:"store,omitempty"` // Backend location (sqlite db path or key file path)
}

AuthBackendSettings configures where principals and their credentials are stored. This is a truly global setting because authentication resolves a token to a principal at the HTTP layer, before any project is selected. Type and Store may be empty; the auth package resolves empties to defaults (sqlite at the default principals database path).

type BuiltinPathBoundarySettings added in v0.4.4

type BuiltinPathBoundarySettings struct {
	AllowedRoots     []string
	RelativeBaseRoot string
	ToolPatterns     []string
	ArgumentPaths    []string
	DeniedPaths      []string
}

BuiltinPathBoundarySettings contains path-aware tool guard settings.

type BuiltinProcessorSettings added in v0.4.3

type BuiltinProcessorSettings struct {
	Processor    string
	Mode         string
	Scope        string
	Rules        []BuiltinRedactionRule
	Presets      []string
	GuardRules   []BuiltinToolGuardRule
	PathBoundary *BuiltinPathBoundarySettings
}

BuiltinProcessorSettings contains parsed runtime settings for a built-in processor.

func ParseBuiltinProcessorSettings added in v0.4.3

func ParseBuiltinProcessorSettings(processor *ProcessorConfig) (*BuiltinProcessorSettings, error)

ParseBuiltinProcessorSettings validates and extracts built-in processor settings.

type BuiltinRedactionRule added in v0.4.4

type BuiltinRedactionRule struct {
	Name        string
	Pattern     string
	Replacement string
}

BuiltinRedactionRule contains one configurable pattern redaction rule.

type BuiltinToolGuardArgumentRule added in v0.4.4

type BuiltinToolGuardArgumentRule struct {
	Path    string
	Pattern string
}

BuiltinToolGuardArgumentRule contains one tool-call argument matcher.

type BuiltinToolGuardRule added in v0.4.4

type BuiltinToolGuardRule struct {
	Name          string
	Category      string
	Severity      string
	Message       string
	ToolPatterns  []string
	ArgumentRules []BuiltinToolGuardArgumentRule
}

BuiltinToolGuardRule contains one configurable tool-call deny rule.

type CLIProcessorSettings added in v0.0.6

type CLIProcessorSettings struct {
	Command string
	Args    []string
}

CLIProcessorSettings contains parsed runtime settings for a CLI processor.

func ParseCLIProcessorSettings added in v0.0.6

func ParseCLIProcessorSettings(processor *ProcessorConfig) (*CLIProcessorSettings, error)

ParseCLIProcessorSettings validates and extracts CLI processor settings.

type CapabilitiesSettings added in v0.2.0

type CapabilitiesSettings struct {
	TaskVerification *TaskVerificationCapabilitySettings `json:"taskVerification,omitempty"`
	EventStorage     *EventStorageCapabilitySettings     `json:"eventStorage,omitempty"`
	TestTools        *TestToolsCapabilitySettings        `json:"testTools,omitempty"`
	UI               *UICapabilitySettings               `json:"ui,omitempty"`
}

CapabilitiesSettings groups optional proxy-owned capabilities.

func NewDefaultCapabilities added in v0.3.3

func NewDefaultCapabilities() *CapabilitiesSettings

NewDefaultCapabilities creates default capability settings for a project.

type EventStorageCapabilitySettings added in v0.2.0

type EventStorageCapabilitySettings struct {
	Enabled *bool  `json:"enabled,omitempty"`
	Driver  string `json:"driver,omitempty"`
	Path    string `json:"path,omitempty"`
}

EventStorageCapabilitySettings controls durable storage for task and action events.

func (*EventStorageCapabilitySettings) GetDriver added in v0.2.0

func (e *EventStorageCapabilitySettings) GetDriver() string

GetDriver returns the configured event storage driver or the default.

func (*EventStorageCapabilitySettings) IsEnabled added in v0.2.0

func (e *EventStorageCapabilitySettings) IsEnabled() bool

IsEnabled reports whether event storage is enabled. Defaults to true.

type GatewayConfig

type GatewayConfig struct {
	AllowDynamic            bool                        `json:"allowDynamic,omitempty"`            // Allow dynamic proxy endpoints
	AllowGatewayEndpoint    bool                        `json:"setupGateway,omitempty"`            // Setup gateway endpoint with namespacing
	ForceReadOnlyHints      *bool                       `json:"forceReadOnlyHints,omitempty"`      // Override all tool annotations to readOnlyHint=true
	ForceSafeToolHints      *bool                       `json:"forceSafeToolHints,omitempty"`      // Override all tool annotations to conservative safe defaults for MCP clients
	VerificationRequirement string                      `json:"verificationRequirement,omitempty"` // Gateway task verification policy: off, optional, required
	MCPServers              map[string]*MCPServerConfig `json:"mcpServers"`                        // HTTP MCP servers in this gateway
	Processors              []*ProcessorConfig          `json:"processors,omitempty"`
}

GatewayConfig represents a logical grouping of HTTP MCP servers.

func (*GatewayConfig) AddServer

func (g *GatewayConfig) AddServer(name string, server *MCPServerConfig)

AddServer adds a the provided server to the gateways MCP servers using name as key.

func (*GatewayConfig) ForceReadOnlyHintsEnabled added in v0.3.1

func (g *GatewayConfig) ForceReadOnlyHintsEnabled() bool

ForceReadOnlyHintsEnabled reports whether all tool annotations should be overridden to readOnlyHint=true for this gateway. Defaults to false.

func (*GatewayConfig) ForceSafeToolHintsEnabled added in v0.4.0

func (g *GatewayConfig) ForceSafeToolHintsEnabled() bool

ForceSafeToolHintsEnabled reports whether all tool annotations should be overridden to conservative safe defaults for this gateway. Defaults to false.

func (*GatewayConfig) HasServer

func (g *GatewayConfig) HasServer(name string) bool

HasServer returns true if a server with the provided name exists in this gateway.

func (*GatewayConfig) ListServers

func (g *GatewayConfig) ListServers() []*MCPServerConfig

ListServers returns a slice of all available MCPServerConfigs for this GatewayConfig.

func (*GatewayConfig) NormalizedVerificationRequirement added in v0.4.2

func (g *GatewayConfig) NormalizedVerificationRequirement() string

NormalizedVerificationRequirement returns the configured requirement after trimming and lowercasing. Empty means the gateway should use the default policy.

func (*GatewayConfig) RemoveServer

func (g *GatewayConfig) RemoveServer(name string)

RemoveServer removes server identified via name.

type GlobalConfig

type GlobalConfig struct {
	Name    string `json:"name"`    // Name of the server - simplifies server identification
	Version string `json:"version"` // Config schema version

	// Truly global settings - apply to the whole server process.
	Proxy       *ProxySettings       `json:"proxy,omitempty"`       // Proxy-level settings (host, port, logLevel, logOutput, timeout)
	AuthBackend *AuthBackendSettings `json:"authBackend,omitempty"` // Global principal/credential storage backend

	// Project-based layout: each project is an isolated tenant.
	Projects map[string]*ProjectConfig `json:"projects,omitempty"` // Named project configs

	// Legacy flat fields - auto-migrated into a "default" project by ResolveProjects().
	// When Projects is non-empty these MUST be empty (enforced by validation).
	AuthEnabled *bool                     `json:"auth,omitempty"`       // Enable or disable proxy auth
	AuthHeader  string                    `json:"authHeader,omitempty"` // Header name for proxy auth
	Gateways    map[string]*GatewayConfig `json:"gateways,omitempty"`   // HTTP proxy gateways
	Processors  []*ProcessorConfig        `json:"processors,omitempty"` // Processor chain
	Metadata    map[string]interface{}    `json:"metadata,omitempty"`   // Additional metadata
}

GlobalConfig represents the main configuration structure stored at ~/.centian/config.json. This is the root configuration object that contains all settings for MCP servers, proxy behavior, processors, and additional metadata.

GlobalConfig supports two layouts:

  1. Flat (legacy): gateways, processors, auth, and capabilities live directly on GlobalConfig. These are auto-wrapped into a "default" ProjectConfig at load time via ResolveProjects().
  2. Project-based: one or more named ProjectConfig entries under the "projects" field. Each project gets its own route prefix, database, feature flags, gateways, and processors.

func DefaultConfig

func DefaultConfig() *GlobalConfig

DefaultConfig returns a default configuration using the legacy flat layout. Callers that need the project-based layout should call ResolveProjects() after populating gateways, or use DefaultProjectBasedConfig().

func DefaultProjectBasedConfig added in v0.3.3

func DefaultProjectBasedConfig() *GlobalConfig

DefaultProjectBasedConfig returns a default configuration using the project-based layout.

func LoadConfig

func LoadConfig() (*GlobalConfig, error)

LoadConfig loads the global configuration from ~/.centian/config.json. If the config file doesn't exist, it creates a new one with default settings. The configuration is validated after loading to ensure it's properly formatted.

func LoadConfigFromPath

func LoadConfigFromPath(path string) (*GlobalConfig, error)

LoadConfigFromPath loads configuration from a custom file path. The configuration is validated after loading.

func (*GlobalConfig) AddProcessor added in v0.0.4

func (g *GlobalConfig) AddProcessor(p *ProcessorConfig)

AddProcessor appends a processor to the global processor chain.

func (*GlobalConfig) GetAuthBackend added in v0.4.4

func (g *GlobalConfig) GetAuthBackend() (backendType, store string)

GetAuthBackend returns the configured auth backend type and store. Both may be empty when no backend block is configured; callers resolve empties to defaults.

func (*GlobalConfig) GetAuthHeader

func (g *GlobalConfig) GetAuthHeader() string

GetAuthHeader returns the configured auth header name or the default. After ResolveProjects(), this checks the legacy flat field; prefer checking ProjectConfig.GetAuthHeader() for project-aware code.

func (*GlobalConfig) GetDefaultProject added in v0.3.3

func (g *GlobalConfig) GetDefaultProject() *ProjectConfig

GetDefaultProject returns the "default" project after ResolveProjects() has been called. Returns nil if no default project exists.

func (*GlobalConfig) HasProcessor added in v0.0.4

func (g *GlobalConfig) HasProcessor(name string) bool

HasProcessor returns true if a processor with the given name exists in the global config.

func (*GlobalConfig) IsAuthEnabled

func (g *GlobalConfig) IsAuthEnabled() bool

IsAuthEnabled returns true when auth is enabled or unset. After ResolveProjects(), this checks the legacy flat field; prefer checking ProjectConfig.IsAuthEnabled() for project-aware code.

func (*GlobalConfig) IsLegacyLayout added in v0.3.3

func (g *GlobalConfig) IsLegacyLayout() bool

IsLegacyLayout returns true when the config uses the flat (non-project) layout.

func (*GlobalConfig) ReplaceProcessor added in v0.0.4

func (g *GlobalConfig) ReplaceProcessor(name string, p *ProcessorConfig) bool

ReplaceProcessor replaces an existing processor by name, preserving its position in the chain. Returns false if no processor with the given name was found.

func (*GlobalConfig) ResolveProjects added in v0.3.3

func (g *GlobalConfig) ResolveProjects()

ResolveProjects normalizes the GlobalConfig so that callers can always work with the Projects map. When the config uses the legacy flat layout (no explicit projects), a single "default" project is synthesized from the top-level gateways, processors, auth, and capability fields.

After this call, the legacy flat fields on GlobalConfig are cleared.

func (*GlobalConfig) SearchServerByName

func (g *GlobalConfig) SearchServerByName(name string) []ServerSearchResult

SearchServerByName searches for a server given a name, can return multiple results for different gateways.

type ImportedServer added in v0.0.6

type ImportedServer struct {
	Name        string
	Command     string
	Args        []string
	Env         map[string]string
	URL         string
	Headers     map[string]string
	Transport   string
	Description string
	Source      string
	SourcePath  string
}

ImportedServer represents a server parsed from an external MCP config file.

func ParseImportedConfigFile added in v0.0.6

func ParseImportedConfigFile(data []byte, filePath string) ([]ImportedServer, error)

ParseImportedConfigFile parses an external MCP config file into importable servers.

type MCPServerConfig

type MCPServerConfig struct {
	Name        string                 `json:"name"`                  // MCP Server name - used to reference this specific server
	Command     string                 `json:"command,omitempty"`     // MCP Server Executable command (for stdio/process transport)
	Args        []string               `json:"args,omitempty"`        // MCP Server Command arguments
	Env         map[string]string      `json:"env,omitempty"`         // Environment variables
	URL         string                 `json:"url,omitempty"`         // MCP Server URL (for http/sse transport)
	Headers     map[string]string      `json:"headers,omitempty"`     // HTTP headers (supports ${ENV_VAR} substitution)
	OAuth       *OAuthConfig           `json:"oauth,omitempty"`       // Downstream OAuth settings for HTTP MCP servers
	Enabled     *bool                  `json:"enabled,omitempty"`     // Whether server is active
	Description string                 `json:"description,omitempty"` // Human readable description
	Source      string                 `json:"source,omitempty"`      // Source file path for auto-discovered servers
	Config      map[string]interface{} `json:"config,omitempty"`      // Server-specific config
}

MCPServerConfig represents a single MCP server configuration. Each server defines how to start and connect to an MCP server process, including all necessary arguments, e.g. command, arguments, environment variables, and metadata.

func (*MCPServerConfig) GetSubstitutedHeaders

func (s *MCPServerConfig) GetSubstitutedHeaders() map[string]string

GetSubstitutedHeaders returns headers with environment variables substituted. Supports both ${VAR_NAME} and $VAR_NAME syntax. Example: "Bearer ${GITHUB_TOKEN}" -> "Bearer ghp_abc123...".

func (*MCPServerConfig) GetTransport added in v0.0.3

func (s *MCPServerConfig) GetTransport() common.McpTransportType

GetTransport returns McpTransportType based on config data.

func (*MCPServerConfig) IsEnabled

func (s *MCPServerConfig) IsEnabled() bool

IsEnabled returns true if the MCP server is either explicitly enabled or the flag is unset (nil).

func (*MCPServerConfig) OAuthEnabled added in v0.0.6

func (s *MCPServerConfig) OAuthEnabled() bool

OAuthEnabled returns true when downstream OAuth is configured and enabled.

type OAuthConfig added in v0.0.6

type OAuthConfig struct {
	Enabled               bool     `json:"enabled"`
	ClientID              string   `json:"clientId,omitempty"`
	ClientSecret          string   `json:"clientSecret,omitempty"`
	ClientAuthMethod      string   `json:"clientAuthMethod,omitempty"`
	Scopes                []string `json:"scopes,omitempty"`
	Resource              string   `json:"resource,omitempty"`
	Issuer                string   `json:"issuer,omitempty"`
	AuthorizationEndpoint string   `json:"authorizationEndpoint,omitempty"`
	TokenEndpoint         string   `json:"tokenEndpoint,omitempty"`
}

OAuthConfig defines downstream OAuth settings for HTTP MCP servers.

type ProcessorConfig

type ProcessorConfig struct {
	Name    string                 `json:"name"`              // Unique processor name
	Type    string                 `json:"type"`              // Processor type: "cli", "webhook", or "builtin"
	Enabled bool                   `json:"enabled"`           // Whether processor is active
	Timeout int                    `json:"timeout,omitempty"` // Timeout in seconds (default: 15)
	Parts   []string               `json:"parts,omitempty"`   // Which context parts to provide: "payload", "meta", "routing", "auth", "annotations" (default: ["payload","meta"])
	Config  map[string]interface{} `json:"config"`            // Type-specific configuration

	// Determines if processor is required to run, "false" by default,
	// meaning the processor can both fail initiation and
	// processing without causing the whole processor chain to fail.
	// If set to true, a failure will cause subsequent processors NOT to run.
	Required bool `json:"required"`
}

ProcessorConfig defines a single processor that executes during MCP request/response flow. Processors are composable units that can inspect, modify, or reject MCP messages.

Type-specific configuration (Config field):

For CLIProcessor processors:

  • "command" (string, required): Executable command to run (e.g., "python", "bash", "node").
  • "args" (array of strings, optional): Command-line arguments (e.g., ["script.py", "--flag"]).

For BuiltinProcessor processors (see type BuiltinProcessorSettings):

  • "processor" (string, required): Built-in processor identifier (e.g., "prompt_injection_guard").
  • "mode" (string, optional): Built-in processor mode.

Example CLI processor:

{.
  "name": "security-validator",
  "type": "cli",
  "enabled": true,
  "timeout": 20,
  "config": {
    "command": "python",
    "args": ["~/processors/security.py", "--strict"]
  }
}.

func (*ProcessorConfig) GetParts added in v0.0.3

func (p *ProcessorConfig) GetParts() []string

GetParts returns the configured parts, defaulting to ["payload"] if not specified.

type ProcessorType

type ProcessorType string

ProcessorType defines the type of processor, e.g. cli, webhook, internal, etc.

const (
	// CLIProcessor represents the type of a CLI-based processor -> "cli".
	CLIProcessor ProcessorType = "cli"
	// WebhookProcessor represents the type of a webhook-based processor -> "webhook".
	WebhookProcessor ProcessorType = "webhook"
	// BuiltinProcessor represents an in-process processor shipped with Centian -> "builtin".
	BuiltinProcessor ProcessorType = "builtin"
)

type ProjectConfig added in v0.3.3

type ProjectConfig struct {
	Slug        string `json:"slug,omitempty"`        // URL-safe project slug (derived from map key if empty)
	Description string `json:"description,omitempty"` // Human readable project description
	AuthEnabled *bool  `json:"auth,omitempty"`        // Enable or disable project-level auth
	AuthHeader  string `json:"authHeader,omitempty"`  // Header name for project-level auth

	Capabilities *CapabilitiesSettings     `json:"capabilities,omitempty"` // Project-scoped feature flags
	Web          *ProxyWebSettings         `json:"web,omitempty"`          // Public web settings (OAuth flows)
	Gateways     map[string]*GatewayConfig `json:"gateways,omitempty"`     // HTTP proxy gateways
	Processors   []*ProcessorConfig        `json:"processors,omitempty"`   // Processor chain
	Metadata     map[string]interface{}    `json:"metadata,omitempty"`     // Additional metadata
}

ProjectConfig represents an isolated project (tenant) within the Centian server. Each project gets its own:

  • Route prefix: /<project_slug>/mcp/<gateway> and /<project_slug>/ui
  • SQLite database for event storage
  • Feature flags (capabilities)
  • Auth settings
  • Gateways, processors, and metadata

func NewDefaultProjectConfig added in v0.3.3

func NewDefaultProjectConfig() *ProjectConfig

NewDefaultProjectConfig creates a default ProjectConfig with standard capabilities.

func (*ProjectConfig) EventStorageCapability added in v0.3.3

func (p *ProjectConfig) EventStorageCapability() *EventStorageCapabilitySettings

EventStorageCapability returns the configured event storage capability block.

func (*ProjectConfig) GetAuthHeader added in v0.3.3

func (p *ProjectConfig) GetAuthHeader() string

GetAuthHeader returns the configured auth header name or the default.

func (*ProjectConfig) HasOAuthServers added in v0.3.3

func (p *ProjectConfig) HasOAuthServers() bool

HasOAuthServers reports whether any gateway in this project has OAuth enabled.

func (*ProjectConfig) IsAuthEnabled added in v0.3.3

func (p *ProjectConfig) IsAuthEnabled() bool

IsAuthEnabled returns true when auth is enabled for this project (defaults to true).

func (*ProjectConfig) TaskVerificationCapability added in v0.3.3

func (p *ProjectConfig) TaskVerificationCapability() *TaskVerificationCapabilitySettings

TaskVerificationCapability returns the configured taskverification capability block.

func (*ProjectConfig) TaskVerificationEnabled added in v0.3.3

func (p *ProjectConfig) TaskVerificationEnabled() bool

TaskVerificationEnabled reports whether taskverification tools are enabled. Defaults to false.

func (*ProjectConfig) TestToolsCapability added in v0.3.3

func (p *ProjectConfig) TestToolsCapability() *TestToolsCapabilitySettings

TestToolsCapability returns the configured test tools capability block.

func (*ProjectConfig) TestToolsEnabled added in v0.3.3

func (p *ProjectConfig) TestToolsEnabled() bool

TestToolsEnabled reports whether proxy-owned test tools are enabled. Defaults to false.

func (*ProjectConfig) UICapability added in v0.3.3

func (p *ProjectConfig) UICapability() *UICapabilitySettings

UICapability returns the configured embedded UI capability block.

func (*ProjectConfig) UIEnabled added in v0.3.3

func (p *ProjectConfig) UIEnabled() bool

UIEnabled reports whether the embedded UI should be served. Defaults to false.

type ProxySettings

type ProxySettings struct {
	Host         string                `json:"host,omitempty"`         // Bind address for the proxy
	Port         string                `json:"port,omitempty"`         // HTTP proxy port (if enabled)
	LogLevel     string                `json:"logLevel,omitempty"`     // debug, info, warn, error
	LogOutput    string                `json:"logOutput,omitempty"`    // file, console, both
	LogFile      string                `json:"logFile,omitempty"`      // Log file path for internal logger
	Timeout      int                   `json:"timeout,omitempty"`      // Request timeout in seconds
	Capabilities *CapabilitiesSettings `json:"capabilities,omitempty"` // Optional proxy-owned capabilities
	Web          *ProxyWebSettings     `json:"web,omitempty"`          // Public web settings for hosted OAuth flows
}

ProxySettings contains proxy-level configuration that affects how the centian proxy operates, including transport method, logging, and timeouts.

func NewDefaultProxySettings

func NewDefaultProxySettings() ProxySettings

NewDefaultProxySettings creates a new ProxySettings with default values. Note: Capabilities and Web settings now live in ProjectConfig, not ProxySettings. Use NewDefaultCapabilities() for project-level defaults.

func (*ProxySettings) EventStorageCapability added in v0.2.0

func (p *ProxySettings) EventStorageCapability() *EventStorageCapabilitySettings

EventStorageCapability returns the configured event storage capability block.

func (*ProxySettings) TaskVerificationCapability added in v0.2.0

func (p *ProxySettings) TaskVerificationCapability() *TaskVerificationCapabilitySettings

TaskVerificationCapability returns the configured taskverification capability block.

func (*ProxySettings) TaskVerificationEnabled added in v0.2.0

func (p *ProxySettings) TaskVerificationEnabled() bool

TaskVerificationEnabled reports whether taskverification tools are enabled. Defaults to false.

func (*ProxySettings) TestToolsCapability added in v0.2.0

func (p *ProxySettings) TestToolsCapability() *TestToolsCapabilitySettings

TestToolsCapability returns the configured test tools capability block.

func (*ProxySettings) TestToolsEnabled added in v0.2.0

func (p *ProxySettings) TestToolsEnabled() bool

TestToolsEnabled reports whether proxy-owned test tools are enabled. Defaults to false.

func (*ProxySettings) UICapability added in v0.2.0

func (p *ProxySettings) UICapability() *UICapabilitySettings

UICapability returns the configured embedded UI capability block.

func (*ProxySettings) UIEnabled added in v0.2.0

func (p *ProxySettings) UIEnabled() bool

UIEnabled reports whether the embedded UI should be served. Defaults to false.

type ProxyWebSettings added in v0.0.6

type ProxyWebSettings struct {
	PublicBaseURL string `json:"publicBaseUrl,omitempty"`
}

ProxyWebSettings contains public-facing web settings required for browser-based flows.

type ServerSearchResult

type ServerSearchResult struct {
	// contains filtered or unexported fields
}

ServerSearchResult captures data and references when searching for a specific server in the config.

type TaskVerificationCapabilitySettings added in v0.2.0

type TaskVerificationCapabilitySettings struct {
	Enabled            *bool  `json:"enabled,omitempty"`
	TemplatesPath      string `json:"templatesPath,omitempty"`
	IdleTimeoutSeconds int    `json:"idleTimeoutSeconds,omitempty"`
}

TaskVerificationCapabilitySettings controls taskverification capability behavior.

func (*TaskVerificationCapabilitySettings) GetIdleTimeoutSeconds added in v0.2.2

func (t *TaskVerificationCapabilitySettings) GetIdleTimeoutSeconds() int

GetIdleTimeoutSeconds returns the configured task idle timeout in seconds.

func (*TaskVerificationCapabilitySettings) GetTemplatesPath added in v0.2.0

func (t *TaskVerificationCapabilitySettings) GetTemplatesPath() string

GetTemplatesPath returns the configured task template directory override.

func (*TaskVerificationCapabilitySettings) IsEnabled added in v0.2.0

IsEnabled reports whether taskverification is enabled. Defaults to false.

type TestToolsCapabilitySettings added in v0.2.0

type TestToolsCapabilitySettings struct {
	Enabled *bool `json:"enabled,omitempty"`
}

TestToolsCapabilitySettings controls Centian-owned test/debug tools.

func (*TestToolsCapabilitySettings) IsEnabled added in v0.2.0

func (t *TestToolsCapabilitySettings) IsEnabled() bool

IsEnabled reports whether Centian-owned test tools are enabled. Defaults to false.

type UICapabilitySettings added in v0.2.0

type UICapabilitySettings struct {
	Enabled *bool `json:"enabled,omitempty"`
}

UICapabilitySettings controls whether the embedded web UI is exposed.

func (*UICapabilitySettings) IsEnabled added in v0.2.0

func (u *UICapabilitySettings) IsEnabled() bool

IsEnabled reports whether the embedded UI is enabled. Defaults to false.

type WebhookProcessorSettings added in v0.0.6

type WebhookProcessorSettings struct {
	URL     string
	Headers map[string]string
}

WebhookProcessorSettings contains parsed runtime settings for a webhook processor.

func ParseWebhookProcessorSettings added in v0.0.6

func ParseWebhookProcessorSettings(processor *ProcessorConfig) (*WebhookProcessorSettings, error)

ParseWebhookProcessorSettings validates and extracts webhook processor settings.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL