feat(mcp): add SSE transport support and related configuration options
Some checks failed
CI / build-and-test (push) Failing after -30m37s
Some checks failed
CI / build-and-test (push) Failing after -30m37s
This commit is contained in:
@@ -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"`
|
||||
|
||||
@@ -58,6 +58,7 @@ func defaultConfig() Config {
|
||||
},
|
||||
MCP: MCPConfig{
|
||||
Path: "/mcp",
|
||||
SSEPath: "/sse",
|
||||
ServerName: "amcs",
|
||||
Version: info.Version,
|
||||
Transport: "streamable_http",
|
||||
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user