Documentation
¶
Overview ¶
Package mcpconfig reads MCP (Model Context Protocol) server configuration from the Claude Code settings file (~/.claude/settings.json).
V1 scope:
- Lists plugins from the enabledPlugins map as MCP entries.
- Status is "enabled" for true entries, "disabled" for false entries.
- Tool count is 0 (live socket ping is deferred to V2).
LSP detection is explicitly out of scope for V1 — callers receive an empty LSP list. This is a known limitation documented here.
Read failure (file missing, permission denied, malformed JSON) is treated as an empty configuration — no error is propagated to the caller.
The Source type satisfies ports.MCPSource — pass it wherever that interface is expected.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
Source reads MCP configuration from the Claude Code settings file.
Backed by a claudesettings.Reader so the parse is served from cache when the file hasn't changed since the last call. Production code should share the Reader with lspscan so the per-tick reads coalesce.
Source satisfies the ports.MCPSource interface.
func New ¶
func New() Source
New constructs a Source with its own private settings Reader at the default path. Use NewWith to share a Reader across adapters.
func NewWith ¶
func NewWith(r *claudesettings.Reader) Source
NewWith constructs a Source backed by the given settings Reader. A nil reader is treated as "use a fresh default-path Reader".
func (Source) MCPs ¶
MCPs implements ports.MCPSource.
It returns the list of configured MCP entries from the settings file, sorted alphabetically by name for stable output.
An empty slice (no error) is returned when:
- The settings file does not exist.
- The file cannot be read or parsed.
- No enabledPlugins key is present.