Skip to content

Commit 9942425

Browse files
committed
refactor: Improve logging for MCP client creation and shutdown
1 parent e0c36e8 commit 9942425

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,5 @@ fabric.properties
140140
# End of https://www.toptal.com/developers/gitignore/api/goland,go
141141

142142

143-
/mcp-proxy
143+
/mcp-proxy
144+
/build

main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,11 @@ func start(config *Config) {
9696
Name: config.Server.Name,
9797
Version: config.Server.Version,
9898
}
99+
99100
for name, clientConfig := range config.Clients {
100101
mcpClient, err := newMCPClient(name, clientConfig)
101102
if err != nil {
102-
log.Fatalf("Failed to create MCP client: %v", err)
103+
log.Fatalf("<%s> Failed to create client: %v", name, err)
103104
}
104105
mcpServer, sseServer := newMCPServer(name, config, clientConfig)
105106

@@ -119,7 +120,7 @@ func start(config *Config) {
119120
log.Printf("<%s> Connected", name)
120121
httpMux.Handle(fmt.Sprintf("/%s/", name), chainMiddleware(sseServer, newAuthMiddleware(tokens)))
121122
httpServer.RegisterOnShutdown(func() {
122-
log.Printf("Closing client %s", name)
123+
log.Printf("<%s> Shutting down", name)
123124
_ = mcpClient.Close()
124125
})
125126
return nil

0 commit comments

Comments
 (0)