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":