Documentation
¶
Overview ¶
Package parser provides JSON parsing and writing for canonical MCP configurations. It handles loading MCP config files from disk and writing them back with proper formatting and atomic file operations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidJSON indicates the input is not valid JSON. ErrInvalidJSON = errors.New("invalid JSON") // ErrInvalidConfig indicates the JSON doesn't represent a valid MCP config. ErrInvalidConfig = errors.New("invalid MCP configuration") )
Sentinel errors for parser operations.
Functions ¶
func Parse ¶
Parse reads a canonical MCP config from JSON bytes. Returns an error if the JSON is malformed or doesn't represent a valid config.
func ParseFile ¶
ParseFile reads a canonical MCP config from a file path. Returns an empty config (not error) if the file doesn't exist, following the principle that a missing config file means "no servers configured". Returns an error for other file system issues or invalid JSON.
func Write ¶
Write writes a canonical MCP config to JSON bytes with indentation. The output is formatted with 2-space indentation for readability.
Types ¶
type ParseError ¶
ParseError wraps errors that occur during parsing with path context.
func (*ParseError) Error ¶
func (e *ParseError) Error() string
func (*ParseError) Unwrap ¶
func (e *ParseError) Unwrap() error