added auth to remote mcps
This commit is contained in:
@@ -25,22 +25,24 @@ type MCPListenerConfig struct {
|
||||
|
||||
// ModelConfig holds configuration for the LLM
|
||||
type ModelConfig struct {
|
||||
ModelID string `toml:"model_id"`
|
||||
Endpoint string `toml:"endpoint"`
|
||||
APIKey string `toml:"api_key"`
|
||||
Temperature float32 `toml:"temperature"`
|
||||
MaxTokens int `toml:"max_tokens"`
|
||||
TimeoutSecs int `toml:"timeout_secs"`
|
||||
ModelID string `toml:"model_id"`
|
||||
Endpoint string `toml:"endpoint"`
|
||||
APIKey string `toml:"api_key"`
|
||||
Temperature float32 `toml:"temperature"`
|
||||
MaxTokens int `toml:"max_tokens"`
|
||||
TimeoutSecs int `toml:"timeout_secs"`
|
||||
Timeout time.Duration `toml:"-"`
|
||||
}
|
||||
|
||||
// MCPServerConfig configures a single MCP server connection
|
||||
type MCPServerConfig struct {
|
||||
Transport string `toml:"transport"` // "stdio", "sse", "http", "websocket"
|
||||
Command string `toml:"command"` // for stdio
|
||||
Args []string `toml:"args"` // for stdio
|
||||
Env []string `toml:"env"` // for stdio, format "KEY=VALUE"
|
||||
URL string `toml:"url"` // for HTTP/SSE/WebSocket
|
||||
Transport string `toml:"transport"` // "stdio", "sse", "http", "websocket"
|
||||
Command string `toml:"command"` // for stdio
|
||||
Args []string `toml:"args"` // for stdio
|
||||
Env []string `toml:"env"` // for stdio, format "KEY=VALUE"
|
||||
URL string `toml:"url"` // for HTTP/SSE/WebSocket
|
||||
AuthToken string `toml:"auth_token"` // for HTTP Bearer authentication
|
||||
Headers map[string]string `toml:"headers"` // for custom headers
|
||||
}
|
||||
|
||||
// AgentConfig holds configuration for a specific agent instance
|
||||
@@ -66,6 +68,14 @@ func resolveEnv(val string) string {
|
||||
return val
|
||||
}
|
||||
|
||||
func (s *MCPServerConfig) Resolve() {
|
||||
s.URL = resolveEnv(s.URL)
|
||||
s.AuthToken = resolveEnv(s.AuthToken)
|
||||
for k, v := range s.Headers {
|
||||
s.Headers[k] = resolveEnv(v)
|
||||
}
|
||||
}
|
||||
|
||||
// Resolve applies environment variable resolution to relevant fields
|
||||
func (m *ModelConfig) Resolve() {
|
||||
m.ModelID = resolveEnv(m.ModelID)
|
||||
@@ -92,6 +102,10 @@ func LoadConfig(path string) (*ProjectConfig, error) {
|
||||
m.Resolve()
|
||||
cfg.Models[k] = m
|
||||
}
|
||||
for k, s := range cfg.MCPServers {
|
||||
s.Resolve()
|
||||
cfg.MCPServers[k] = s
|
||||
}
|
||||
for k, a := range cfg.Agents {
|
||||
a.ID = k
|
||||
a.ToolResponseThreshold = cfg.ToolResponseThreshold
|
||||
|
||||
Reference in New Issue
Block a user