@@ -14,15 +14,20 @@ import (
1414type Client struct {
1515 baseURL string
1616 token string
17+ version string
18+ userAgent string
1719 httpClient * http.Client
1820 reqID atomic.Int64
1921}
2022
21- // New creates an MCP client.
22- func New (baseURL , token string ) * Client {
23+ // New creates an MCP client. version is used in the User-Agent header
24+ // and the MCP clientInfo.
25+ func New (baseURL , token , version string ) * Client {
2326 return & Client {
2427 baseURL : baseURL ,
2528 token : token ,
29+ version : version ,
30+ userAgent : "pipeboard-cli/" + version ,
2631 httpClient : & http.Client {},
2732 }
2833}
@@ -71,7 +76,7 @@ func (c *Client) Initialize(serverPath string) error {
7176 "capabilities" : map [string ]interface {}{},
7277 "clientInfo" : map [string ]string {
7378 "name" : "pipeboard-cli" ,
74- "version" : "0.1.0" ,
79+ "version" : c . version ,
7580 },
7681 }
7782
@@ -137,6 +142,7 @@ func (c *Client) call(serverPath, method string, params interface{}) (json.RawMe
137142
138143 httpReq .Header .Set ("Content-Type" , "application/json" )
139144 httpReq .Header .Set ("Authorization" , "Bearer " + c .token )
145+ httpReq .Header .Set ("User-Agent" , c .userAgent )
140146
141147 resp , err := c .httpClient .Do (httpReq )
142148 if err != nil {
@@ -218,6 +224,7 @@ func (c *Client) notify(serverPath, method string, params interface{}) error {
218224
219225 httpReq .Header .Set ("Content-Type" , "application/json" )
220226 httpReq .Header .Set ("Authorization" , "Bearer " + c .token )
227+ httpReq .Header .Set ("User-Agent" , c .userAgent )
221228
222229 resp , err := c .httpClient .Do (httpReq )
223230 if err != nil {
0 commit comments