Add StreambleHTTP support

This commit is contained in:
Thilina Shashimal Senarath 2025-05-27 11:44:23 +05:30
parent fc0d939e16
commit 99d4fa6f47
3 changed files with 32 additions and 31 deletions

View file

@ -2,14 +2,15 @@
# Common configuration for all transport modes
listen_port: 8080
base_url: "http://localhost:8000" # Base URL for the MCP server
port: 8000 # Port for the MCP server
base_url: "http://localhost:3001" # Base URL for the MCP server
port: 3001 # Port for the MCP server
timeout_seconds: 10
# Path configuration
paths:
sse: "/sse" # SSE endpoint path
messages: "/messages/" # Messages endpoint path
streamable_http: "/mcp" # MCP endpoint path
# Transport mode configuration
transport_mode: "sse" # Options: "sse" or "stdio"
@ -28,7 +29,7 @@ path_mapping:
# CORS configuration
cors:
allowed_origins:
- "http://localhost:5173"
- "http://127.0.0.1:6274"
allowed_methods:
- "GET"
- "POST"

View file

@ -21,6 +21,7 @@ const (
type PathsConfig struct {
SSE string `yaml:"sse"`
Messages string `yaml:"messages"`
StreamableHTTP string `yaml:"streamable_http"` // Path for streamable HTTP requests
}
// StdioConfig contains stdio-specific configuration
@ -138,7 +139,7 @@ func (c *Config) Validate() error {
// GetMCPPaths returns the list of paths that should be proxied to the MCP server
func (c *Config) GetMCPPaths() []string {
return []string{c.Paths.SSE, c.Paths.Messages}
return []string{c.Paths.SSE, c.Paths.Messages, c.Paths.StreamableHTTP}
}
// BuildExecCommand constructs the full command string for execution in stdio mode
@ -147,7 +148,6 @@ func (c *Config) BuildExecCommand() string {
return ""
}
if runtime.GOOS == "windows" {
// For Windows, we need to properly escape the inner command
escapedCommand := strings.ReplaceAll(c.Stdio.UserCommand, `"`, `\"`)

View file

@ -10,7 +10,7 @@ import (
"github.com/wso2/open-mcp-auth-proxy/internal/authz"
"github.com/wso2/open-mcp-auth-proxy/internal/config"
"github.com/wso2/open-mcp-auth-proxy/internal/logging"
logger "github.com/wso2/open-mcp-auth-proxy/internal/logging"
"github.com/wso2/open-mcp-auth-proxy/internal/util"
)