From 84fc8babe2e18e271ceb3ee3c07cbaa1343eaa28 Mon Sep 17 00:00:00 2001 From: devangpratap <115096812+devangpratap@users.noreply.github.com> Date: Sun, 24 May 2026 20:06:45 -0400 Subject: [PATCH] fix: use actual CLI version in MCP server initialize response The MCP initialize response had the server version hardcoded as "0.1.5". This wires cmd.Version into the mcp package so the reported version stays in sync with releases. --- cmd/mcp.go | 1 + internal/mcp/server.go | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/mcp.go b/cmd/mcp.go index 1a758ae..cc42687 100644 --- a/cmd/mcp.go +++ b/cmd/mcp.go @@ -28,6 +28,7 @@ Manual smoke test: For agent registration use: codag setup`, RunE: func(cmd *cobra.Command, args []string) error { + mcp.Version = Version s := mcp.NewServer() mcp.RegisterAll(s) return s.Serve() diff --git a/internal/mcp/server.go b/internal/mcp/server.go index 657c2d7..5a767dd 100644 --- a/internal/mcp/server.go +++ b/internal/mcp/server.go @@ -44,6 +44,10 @@ var ( // since are backward-compatible at the level of methods we use. const ProtocolVersion = "2025-03-26" +// Version is the CLI version reported in the MCP initialize response. +// Set by the cmd package before Serve() is called; defaults to "dev". +var Version = "dev" + // jrpcRequest is a JSON-RPC 2.0 request frame. type jrpcRequest struct { JSONRPC string `json:"jsonrpc"` @@ -184,7 +188,7 @@ func (s *Server) dispatch(req jrpcRequest) { }, "serverInfo": map[string]interface{}{ "name": "codag", - "version": "0.1.5", + "version": Version, }, }) case "notifications/initialized":