Show server version in logs and UI

This commit is contained in:
Brandon Zhang
2026-03-27 18:16:30 +08:00
parent 8d4392ee5a
commit 7a8dd14bd3
11 changed files with 34 additions and 7 deletions

View File

@@ -4,6 +4,7 @@ import (
"net/http"
"time"
"github.com/local-mcp/local-mcp-go/internal/config"
"github.com/local-mcp/local-mcp-go/internal/models"
)
@@ -57,6 +58,7 @@ func handleStatus(stores Stores) http.HandlerFunc {
"server": map[string]any{
"status": "up",
"started_at": serverStartTime.Format(time.RFC3339Nano),
"version": config.AppVersion,
},
"agent": agent,
"queue": map[string]any{

View File

@@ -6,7 +6,10 @@ import (
"strconv"
)
const DefaultEmptyResponse = "call this tool `get_user_request` again to fetch latest user input..."
const (
AppVersion = "1.0.0"
DefaultEmptyResponse = "call this tool `get_user_request` again to fetch latest user input..."
)
// Config holds all runtime configuration values for local-mcp.
type Config struct {

View File

@@ -53,7 +53,7 @@ func New(
broker *events.Broker,
) *Handler {
h := &Handler{
MCP: server.NewMCPServer("local-mcp", "1.0.0"),
MCP: server.NewMCPServer("local-mcp", config.AppVersion),
instStore: instStore,
settStore: settStore,
agentStore: agentStore,

View File

@@ -122,6 +122,7 @@ func main() {
mcpURL := fmt.Sprintf("http://%s/mcp", addr)
slog.Info("local-mcp-go ready",
"version", config.AppVersion,
"http", httpURL,
"mcp", mcpURL,
"stateless", cfg.MCPStateless,
@@ -131,7 +132,7 @@ func main() {
if runtime.GOOS == "windows" {
fmt.Println()
fmt.Println("╔══════════════════════════════════════════════════════════╗")
fmt.Printf("║ local-mcp-go ready on port %s%-24s║\n", port, "")
fmt.Printf("║ local-mcp-go v%-6s ready on port %s%-14s║\n", config.AppVersion, port, "")
fmt.Println("║ ║")
fmt.Printf("║ Web UI: %-46s║\n", httpURL)
fmt.Printf("║ MCP: %-46s║\n", mcpURL)