versions
This commit is contained in:
		| @@ -74,6 +74,7 @@ cremote <command> [options] | ||||
|  | ||||
| ### Commands | ||||
|  | ||||
| - `version`: Show version information for CLI and daemon | ||||
| - `open-tab`: Open a new tab and return its ID | ||||
| - `load-url`: Load a URL in a tab | ||||
| - `fill-form`: Fill a form field with a value | ||||
|   | ||||
| @@ -58,6 +58,25 @@ func (c *Client) CheckStatus() (bool, error) { | ||||
| 	return response.Success, nil | ||||
| } | ||||
|  | ||||
| // GetVersion gets the daemon version | ||||
| func (c *Client) GetVersion() (string, error) { | ||||
| 	response, err := c.SendCommand("version", map[string]string{}) | ||||
| 	if err != nil { | ||||
| 		return "", err | ||||
| 	} | ||||
|  | ||||
| 	if !response.Success { | ||||
| 		return "", fmt.Errorf("failed to get version: %s", response.Error) | ||||
| 	} | ||||
|  | ||||
| 	// The version should be in the Data field as a string | ||||
| 	if version, ok := response.Data.(string); ok { | ||||
| 		return version, nil | ||||
| 	} | ||||
|  | ||||
| 	return "", fmt.Errorf("unexpected version response format") | ||||
| } | ||||
|  | ||||
| // TabInfo contains information about a tab | ||||
| type TabInfo struct { | ||||
| 	ID           string `json:"id"` | ||||
|   | ||||
| @@ -21,6 +21,8 @@ import ( | ||||
| 	"github.com/go-rod/rod/lib/proto" | ||||
| ) | ||||
|  | ||||
| const Version = "2.0.0" | ||||
|  | ||||
| // Daemon is the main server that manages browser connections | ||||
| type Daemon struct { | ||||
| 	browser     *rod.Browser | ||||
| @@ -226,6 +228,12 @@ func (d *Daemon) handleCommand(w http.ResponseWriter, r *http.Request) { | ||||
| 	var response Response | ||||
|  | ||||
| 	switch cmd.Action { | ||||
| 	case "version": | ||||
| 		response = Response{ | ||||
| 			Success: true, | ||||
| 			Data:    Version, | ||||
| 		} | ||||
|  | ||||
| 	case "open-tab": | ||||
| 		timeoutStr := cmd.Params["timeout"] | ||||
|  | ||||
|   | ||||
							
								
								
									
										16
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								main.go
									
									
									
									
									
								
							| @@ -9,6 +9,8 @@ import ( | ||||
| 	"git.teamworkapps.com/shortcut/cremote/client" | ||||
| ) | ||||
|  | ||||
| const Version = "2.0.0" | ||||
|  | ||||
| var ( | ||||
| 	// Global flags | ||||
| 	daemonHost = flag.String("host", "localhost", "Daemon host") | ||||
| @@ -149,6 +151,19 @@ func main() { | ||||
|  | ||||
| 	// Parse the appropriate subcommand | ||||
| 	switch os.Args[1] { | ||||
| 	case "version": | ||||
| 		fmt.Printf("cremote CLI version %s\n", Version) | ||||
|  | ||||
| 		// Also get daemon version if possible | ||||
| 		c := client.NewClient("localhost", 8989) | ||||
| 		daemonVersion, err := c.GetVersion() | ||||
| 		if err != nil { | ||||
| 			fmt.Printf("Daemon: Unable to connect (%v)\n", err) | ||||
| 		} else { | ||||
| 			fmt.Printf("Daemon version %s\n", daemonVersion) | ||||
| 		} | ||||
| 		return | ||||
|  | ||||
| 	case "open-tab": | ||||
| 		openTabCmd.Parse(os.Args[2:]) | ||||
|  | ||||
| @@ -487,6 +502,7 @@ func main() { | ||||
| func printUsage() { | ||||
| 	fmt.Println("Usage: cremote <command> [options]") | ||||
| 	fmt.Println("Commands:") | ||||
| 	fmt.Println("  version           Show version information for CLI and daemon") | ||||
| 	fmt.Println("  open-tab          Open a new tab and return its ID") | ||||
| 	fmt.Println("  load-url          Load a URL in a tab") | ||||
| 	fmt.Println("  fill-form         Fill a form field with a value") | ||||
|   | ||||
| @@ -32,6 +32,20 @@ This is a Model Context Protocol (MCP) server that exposes cremote's web automat | ||||
|  | ||||
| ## Available Tools (27 Total) | ||||
|  | ||||
| ### Version Information | ||||
|  | ||||
| #### `version_cremotemcp` | ||||
| Get version information for MCP server and daemon. | ||||
|  | ||||
| ```json | ||||
| { | ||||
|   "name": "version_cremotemcp", | ||||
|   "arguments": {} | ||||
| } | ||||
| ``` | ||||
|  | ||||
| Returns version information for both the MCP server and the connected daemon. | ||||
|  | ||||
| ### Core Web Automation Tools (10 tools) | ||||
|  | ||||
| #### 1. `web_navigate_cremotemcp` | ||||
|   | ||||
							
								
								
									
										
											BIN
										
									
								
								mcp/cremote-mcp
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								mcp/cremote-mcp
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										26
									
								
								mcp/main.go
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								mcp/main.go
									
									
									
									
									
								
							| @@ -14,6 +14,8 @@ import ( | ||||
| 	"github.com/mark3labs/mcp-go/server" | ||||
| ) | ||||
|  | ||||
| const Version = "2.0.0" | ||||
|  | ||||
| // CremoteServer wraps the cremote client for MCP | ||||
| type CremoteServer struct { | ||||
| 	client      *client.Client | ||||
| @@ -80,6 +82,30 @@ func main() { | ||||
| 	// Create MCP server | ||||
| 	mcpServer := server.NewMCPServer("cremote-mcp", "2.0.0") | ||||
|  | ||||
| 	// Register version tool | ||||
| 	mcpServer.AddTool(mcp.Tool{ | ||||
| 		Name:        "version_cremotemcp", | ||||
| 		Description: "Get version information for MCP server and daemon", | ||||
| 		InputSchema: mcp.ToolInputSchema{ | ||||
| 			Type:       "object", | ||||
| 			Properties: map[string]any{}, | ||||
| 			Required:   []string{}, | ||||
| 		}, | ||||
| 	}, func(ctx context.Context, request mcp.CallToolRequest) (*mcp.CallToolResult, error) { | ||||
| 		// Get daemon version | ||||
| 		daemonVersion, err := cremoteServer.client.GetVersion() | ||||
| 		if err != nil { | ||||
| 			daemonVersion = fmt.Sprintf("Unable to connect: %v", err) | ||||
| 		} | ||||
|  | ||||
| 		return &mcp.CallToolResult{ | ||||
| 			Content: []mcp.Content{ | ||||
| 				mcp.NewTextContent(fmt.Sprintf("MCP Server version: %s\nDaemon version: %s", Version, daemonVersion)), | ||||
| 			}, | ||||
| 			IsError: false, | ||||
| 		}, nil | ||||
| 	}) | ||||
|  | ||||
| 	// Register web_navigate tool | ||||
| 	mcpServer.AddTool(mcp.Tool{ | ||||
| 		Name:        "web_navigate", | ||||
|   | ||||
		Reference in New Issue
	
	Block a user