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.cr

Constant 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

Class Method Detail

def self.check(text : String) : Result #

Parse and check a config. Raises ArgumentError when the file is not a JSON object with an "mcpServers" object.


[View source]
def self.check_args(report : ServerReport, value : JSON::Any) : Nil #

[View source]
def self.check_env(report : ServerReport, value : JSON::Any) : Nil #

[View source]
def self.check_server(name : String, config : JSON::Any) : ServerReport #

[View source]
def self.check_url(report : ServerReport, value : JSON::Any) : Nil #

[View source]
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.


[View source]
def self.host_of(rest : String) : String #

Host part of the text after "http://" or "https://" (userinfo and port removed).


[View source]
def self.render(result : Result) : String #

[View source]