mirror of
https://github.com/wso2/open-mcp-auth-proxy.git
synced 2025-06-27 09:05:41 +00:00
parent
fc0d939e16
commit
316370be1c
4 changed files with 37 additions and 41 deletions
|
@ -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"
|
||||
|
|
|
@ -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, `"`, `\"`)
|
||||
|
|
|
@ -138,18 +138,13 @@ func TestGetMCPPaths(t *testing.T) {
|
|||
Paths: PathsConfig{
|
||||
SSE: "/custom-sse",
|
||||
Messages: "/custom-messages",
|
||||
StreamableHTTP: "/custom-streamable",
|
||||
},
|
||||
}
|
||||
|
||||
paths := cfg.GetMCPPaths()
|
||||
if len(paths) != 2 {
|
||||
t.Errorf("Expected 2 MCP paths, got %d", len(paths))
|
||||
}
|
||||
if paths[0] != "/custom-sse" {
|
||||
t.Errorf("Expected first path=/custom-sse, got %s", paths[0])
|
||||
}
|
||||
if paths[1] != "/custom-messages" {
|
||||
t.Errorf("Expected second path=/custom-messages, got %s", paths[1])
|
||||
if len(paths) != 3 {
|
||||
t.Errorf("Expected 3 MCP paths, got %d", len(paths))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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"
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue