22package mcp
33
44import (
5+ "time"
6+
57 "github.com/co-browser/agent-browser/internal/log"
68 "go.uber.org/fx"
79)
@@ -15,8 +17,12 @@ type RemoteMCPServer struct {
1517
1618// MCPServerConfig holds the configuration for the MCP server
1719type MCPServerConfig struct {
18- RemoteServers []RemoteMCPServer `json:"remote_servers"`
19- Port int `json:"port" default:"8087"`
20+ RemoteServers []RemoteMCPServer `json:"remote_servers"`
21+ Port int `json:"port" default:"8087"`
22+ HeartbeatInterval time.Duration `json:"heartbeat_interval" default:"15s"`
23+ HealthCheckInterval time.Duration `json:"health_check_interval" default:"30s"`
24+ ConnectionTimeout time.Duration `json:"connection_timeout" default:"5s"`
25+ MaxReconnectAttempts int `json:"max_reconnect_attempts" default:"10"`
2026}
2127
2228// ConfigParams contains the parameters needed for configuration
@@ -35,9 +41,12 @@ type ConfigResult struct {
3541
3642// NewMCPConfig creates a new MCP configuration
3743func NewMCPConfig (p ConfigParams ) (ConfigResult , error ) {
38- // TODO: Load from environment or config file
3944 config := MCPServerConfig {
40- Port : 8087 ,
45+ Port : 8087 ,
46+ HeartbeatInterval : 15 * time .Second ,
47+ HealthCheckInterval : 30 * time .Second ,
48+ ConnectionTimeout : 5 * time .Second ,
49+ MaxReconnectAttempts : 10 ,
4150 RemoteServers : []RemoteMCPServer {
4251 {
4352 URL : "http://0.0.0.0:8001/sse" ,
@@ -54,6 +63,9 @@ func NewMCPConfig(p ConfigParams) (ConfigResult, error) {
5463
5564 p .Logger .Info ().
5665 Int ("port" , config .Port ).
66+ Dur ("heartbeat" , config .HeartbeatInterval ).
67+ Dur ("health_check" , config .HealthCheckInterval ).
68+ Int ("max_reconnect" , config .MaxReconnectAttempts ).
5769 Int ("remote_servers" , len (config .RemoteServers )).
5870 Msg ("MCP configuration loaded" )
5971
0 commit comments