McpServiceConfig.java

package fr.tiogars.chat.domains.mcp.models;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;

import java.util.Map;

/**
 * Configuration for an MCP service.
 */
@Schema(description = "MCP service configuration")
public record McpServiceConfig(
        @NotBlank
        @Schema(description = "Unique identifier for the MCP service", example = "filesystem")
        String id,

        @NotBlank
        @Schema(description = "Display name for the MCP service", example = "File System Access")
        String name,

        @Schema(description = "Description of what the service provides")
        String description,

        @Schema(description = "Command to start the MCP service", example = "npx @modelcontextprotocol/server-filesystem")
        String command,

        @Schema(description = "Environment variables for the service")
        Map<String, String> env,

        @Schema(description = "Whether the service is enabled", defaultValue = "true")
        boolean enabled,

        @Schema(description = "Timeout in seconds", defaultValue = "30")
        int timeoutSeconds
) {
    public McpServiceConfig {
        if (timeoutSeconds <= 0) {
            timeoutSeconds = 30;
        }
    }
}