versions
This commit is contained in:
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