类 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.
- 作者:
- codeboyzhou
- 另请参阅:
-
方法概要
修饰符和类型方法说明static 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.
-
方法详细资料
-
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)
- 参数:
configuration- the MCP server configuration to validate- 抛出:
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.
- 类型参数:
T- the type of the configuration values- 参数:
configKey- the configuration key name used for error reportingbaseValue- the base configuration valueprofileValue- the profile-specific configuration value- 抛出:
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.
- 类型参数:
T- the type of the configuration value- 参数:
configKey- the configuration key name used for error reportingvalue- the configuration value to validate- 抛出:
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.
- 参数:
configKey- the configuration key name used for error reportingbaseValue- the base configuration string valueprofileValue- the profile-specific configuration string value- 抛出:
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.
- 参数:
configKey- the configuration key name used for error reportingvalue- the configuration string value to validate- 抛出:
McpServerConfigurationException- if the value is blank
-