diff --git a/go.mod b/go.mod index 82b89a581d7bbd35698ed5f555ad0e1b324b9ff4..7e41d27cb2c2b8c7382ebfefaeab5188c5dc1e67 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,7 @@ require ( github.com/google/uuid v1.6.0 github.com/invopop/jsonschema v0.13.0 github.com/joho/godotenv v1.5.1 - github.com/mark3labs/mcp-go v0.34.0 + github.com/mark3labs/mcp-go v0.36.0 github.com/muesli/termenv v0.16.0 github.com/ncruces/go-sqlite3 v0.25.0 github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 diff --git a/go.sum b/go.sum index c223c37700b6b9f3f3fc0fb6c537c734bab63ac7..37c3c7ed4509a19f5732262c904cf01ad329a51b 100644 --- a/go.sum +++ b/go.sum @@ -180,8 +180,8 @@ github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69 github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= -github.com/mark3labs/mcp-go v0.34.0 h1:eWy7WBGvhk6EyAAyVzivTCprE52iXJwNtvHV6Cv3bR0= -github.com/mark3labs/mcp-go v0.34.0/go.mod h1:rXqOudj/djTORU/ThxYx8fqEVj/5pvTuuebQ2RC7uk4= +github.com/mark3labs/mcp-go v0.36.0 h1:rIZaijrRYPeSbJG8/qNDe0hWlGrCJ7FWHNMz2SQpTis= +github.com/mark3labs/mcp-go v0.36.0/go.mod h1:T7tUa2jO6MavG+3P25Oy/jR7iCeJPHImCZHRymCn39g= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= diff --git a/internal/llm/agent/mcp-tools.go b/internal/llm/agent/mcp-tools.go index 97f00c92d156b5d50c2a6a84d1f853a0db1246aa..8df78e52452385a44a06fd07feb62d3b9892388f 100644 --- a/internal/llm/agent/mcp-tools.go +++ b/internal/llm/agent/mcp-tools.go @@ -11,10 +11,8 @@ import ( "github.com/charmbracelet/crush/internal/config" "github.com/charmbracelet/crush/internal/csync" "github.com/charmbracelet/crush/internal/llm/tools" - "github.com/charmbracelet/crush/internal/version" - "github.com/charmbracelet/crush/internal/permission" - + "github.com/charmbracelet/crush/internal/version" "github.com/mark3labs/mcp-go/client" "github.com/mark3labs/mcp-go/client/transport" "github.com/mark3labs/mcp-go/mcp" @@ -191,6 +189,7 @@ func createMcpClient(m config.MCPConfig) (*client.Client, error) { return client.NewStreamableHttpClient( m.URL, transport.WithHTTPHeaders(m.ResolvedHeaders()), + transport.WithLogger(mcpHTTPLogger{}), ) case config.MCPSse: return client.NewSSEMCPClient( @@ -201,3 +200,9 @@ func createMcpClient(m config.MCPConfig) (*client.Client, error) { return nil, fmt.Errorf("unsupported mcp type: %s", m.Type) } } + +// for MCP's HTTP client. +type mcpHTTPLogger struct{} + +func (l mcpHTTPLogger) Errorf(format string, v ...any) { slog.Error(fmt.Sprintf(format, v...)) } +func (l mcpHTTPLogger) Infof(format string, v ...any) { slog.Info(fmt.Sprintf(format, v...)) }