Module: GroqRuby::MCP::ClaudeDesktopConfig
- Defined in:
- lib/groq_ruby/mcp/claude_desktop_config.rb
Overview
Loads MCP server configurations from the same JSON shape Claude Desktop uses (‘claude_desktop_config.json`’s ‘mcpServers` block) and returns a list of ServerConfig ready for Bridge.new.
Supports ‘$VAR` interpolation in `args` and `env` values. Lookup order: the server’s own ‘env` block first, then the process’s ‘ENV`. Unresolved references raise so silent misconfigurations don’t ship.
Constant Summary collapse
- VAR_PATTERN =
/\$\{([A-Z_][A-Z0-9_]*)\}/
Class Method Summary collapse
-
.load(path) ⇒ Array<ServerConfig>
Load configurations from a JSON file path.
-
.parse(input) ⇒ Array<ServerConfig>
Parse configurations from an already-decoded Hash (or a JSON string).
Class Method Details
.load(path) ⇒ Array<ServerConfig>
Load configurations from a JSON file path.
38 39 40 |
# File 'lib/groq_ruby/mcp/claude_desktop_config.rb', line 38 def self.load(path) parse(JSON.parse(File.read(File.(path)))) end |
.parse(input) ⇒ Array<ServerConfig>
Parse configurations from an already-decoded Hash (or a JSON string).
48 49 50 51 52 |
# File 'lib/groq_ruby/mcp/claude_desktop_config.rb', line 48 def self.parse(input) hash = input.is_a?(String) ? JSON.parse(input) : input servers = hash["mcpServers"] || hash[:mcpServers] || {} servers.map { |name, entry| build_server_config(name.to_s, entry) } end |