Skip to content

Commit e88e117

Browse files
send simple notification after startup
1 parent 51db4c5 commit e88e117

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/cmd/cli/command/mcp.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package command
22

33
import (
4+
"context"
45
"fmt"
56
"os"
67
"path/filepath"
8+
"time"
79

810
agentTools "github.com/DefangLabs/defang/src/pkg/agent/tools"
911
cliClient "github.com/DefangLabs/defang/src/pkg/cli/client"
@@ -55,6 +57,20 @@ var mcpServerCmd = &cobra.Command{
5557
return fmt.Errorf("failed to create MCP server: %w", err)
5658
}
5759

60+
go func() {
61+
time.Sleep(3 * time.Second)
62+
ctx := context.Background()
63+
term.Debug("Sending MCP server notification to client")
64+
params := map[string]any{
65+
"level": "info",
66+
"message": "Processing started",
67+
}
68+
err := s.SendNotificationToClient(ctx, "notifications/logging/message", params)
69+
if err != nil {
70+
term.Warnf("Failed to send MCP server ready notification to client: %v", err)
71+
}
72+
}()
73+
5874
// Start the server
5975
term.Println("Starting Defang MCP server")
6076
if err := server.ServeStdio(s); err != nil {

0 commit comments

Comments
 (0)