feat(mcp): add SSE transport support and related configuration options
Some checks failed
CI / build-and-test (push) Failing after -30m37s

This commit is contained in:
2026-04-05 15:57:34 +02:00
parent 1958eaca01
commit 5f48a197e8
10 changed files with 276 additions and 6 deletions

View File

@@ -32,6 +32,7 @@ type ServerConfig struct {
type MCPConfig struct {
Path string `yaml:"path"`
SSEPath string `yaml:"sse_path"`
ServerName string `yaml:"server_name"`
Version string `yaml:"version"`
Transport string `yaml:"transport"`

View File

@@ -58,6 +58,7 @@ func defaultConfig() Config {
},
MCP: MCPConfig{
Path: "/mcp",
SSEPath: "/sse",
ServerName: "amcs",
Version: info.Version,
Transport: "streamable_http",

View File

@@ -33,6 +33,14 @@ func (c Config) Validate() error {
if strings.TrimSpace(c.MCP.Path) == "" {
return fmt.Errorf("invalid config: mcp.path is required")
}
if c.MCP.SSEPath != "" {
if strings.TrimSpace(c.MCP.SSEPath) == "" {
return fmt.Errorf("invalid config: mcp.sse_path must not be blank whitespace")
}
if c.MCP.SSEPath == c.MCP.Path {
return fmt.Errorf("invalid config: mcp.sse_path %q must differ from mcp.path", c.MCP.SSEPath)
}
}
if c.MCP.SessionTimeout <= 0 {
return fmt.Errorf("invalid config: mcp.session_timeout must be greater than zero")
}