module McpConfigCheck
Overview
Check an MCP client config (a JSON object with an "mcpServers" object). The checker never prints a url, an argument or an environment value: messages carry server names and environment variable NAMES only.
Defined in:
mcp_config_check.crConstant Summary
-
LOCAL_HOSTS =
["localhost", "127.0.0.1"] of ::String -
USAGE =
"usage: mcp-config-check config.json\nChecks the mcpServers object of an MCP client config. Exit 1 when any server has an error. More: https://www.onegtmlab.dev/glossary/model-context-protocol" -
VERSION =
"1.0.0"
Class Method Summary
-
.check(text : String) : Result
Parse and check a config.
- .check_args(report : ServerReport, value : JSON::Any) : Nil
- .check_env(report : ServerReport, value : JSON::Any) : Nil
- .check_server(name : String, config : JSON::Any) : ServerReport
- .check_url(report : ServerReport, value : JSON::Any) : Nil
-
.cli(args : Array(String), stdout : IO, stderr : IO) : Int32
Command line entry.
-
.host_of(rest : String) : String
Host part of the text after "http://" or "https://" (userinfo and port removed).
- .render(result : Result) : String
Class Method Detail
Parse and check a config. Raises ArgumentError when the file is not a JSON object with an "mcpServers" object.
def self.cli(args : Array(String), stdout : IO, stderr : IO) : Int32
#
Command line entry. Returns the exit code: 0 clean or warnings only, 1 when a server has an error or the file cannot be used, 2 for usage.
def self.host_of(rest : String) : String
#
Host part of the text after "http://" or "https://" (userinfo and port removed).