Class McpConfigurationChecker
This class provides static methods to perform comprehensive validation of MCP server configuration objects, ensuring that all required fields are present and properly configured. It validates both base configuration properties and mode-specific settings for SSE and STREAMABLE server modes.
- Author:
- codeboyzhou
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheck(McpServerConfiguration configuration) Performs comprehensive validation of the MCP server configuration.static voidcheckBlank(String configKey, String value) Validates that a single string configuration value is not blank.static voidcheckBlank(String configKey, String baseValue, String profileValue) Validates that at least one of two string configuration values is not blank.static <T> voidValidates that a single configuration value is not null.static <T> voidValidates that at least one of two configuration values is not null.
-
Method Details
-
check
Performs comprehensive validation of the MCP server configuration.This method validates all required configuration properties including:
- Basic server information (enabled, mode, name, version, type, instructions)
- Timeout and capabilities settings
- Change notification configuration
- Mode-specific settings (SSE or STREAMABLE)
- Parameters:
configuration- the MCP server configuration to validate- Throws:
McpServerConfigurationException- if any required configuration property is missing
-
checkNull
Validates that at least one of two configuration values is not null.This method is typically used to validate profile-based configurations where a base value and a profile-specific value can both provide the same configuration property. At least one of them must be non-null.
- Type Parameters:
T- the type of the configuration values- Parameters:
configKey- the configuration key name used for error reportingbaseValue- the base configuration valueprofileValue- the profile-specific configuration value- Throws:
McpServerConfigurationException- if both values are null
-
checkNull
Validates that a single configuration value is not null.This method performs a simple null check on a configuration value and throws an exception if the value is null, indicating that a required configuration property is missing.
- Type Parameters:
T- the type of the configuration value- Parameters:
configKey- the configuration key name used for error reportingvalue- the configuration value to validate- Throws:
McpServerConfigurationException- if the value is null
-
checkBlank
Validates that at least one of two string configuration values is not blank.This method is typically used to validate profile-based configurations where a base value and a profile-specific value can both provide the same string configuration property. At least one of them must be non-blank. A value is considered blank if it is null, empty, or contains only whitespace.
- Parameters:
configKey- the configuration key name used for error reportingbaseValue- the base configuration string valueprofileValue- the profile-specific configuration string value- Throws:
McpServerConfigurationException- if both values are blank
-
checkBlank
Validates that a single string configuration value is not blank.This method performs a blank check on a string configuration value and throws an exception if the value is blank. A value is considered blank if it is null, empty, or contains only whitespace.
- Parameters:
configKey- the configuration key name used for error reportingvalue- the configuration string value to validate- Throws:
McpServerConfigurationException- if the value is blank
-