Model Context Protocol (MCP) server for Harvester HCI that enables Claude Desktop, Cursor, and other AI assistants to interact with Harvester clusters through the MCP protocol.
Harvester MCP Server is a Go implementation of the Model Context Protocol (MCP) specifically designed for Harvester HCI. It allows AI assistants like Claude Desktop and Cursor to perform CRUD operations on Harvester clusters, which are essentially Kubernetes clusters with Harvester-specific CRDs.
The following diagram illustrates how Harvester MCP Server bridges the gap between AI assistants and Harvester clusters:
graph LR;
subgraph "AI Assistants"
A[Claude Desktop] --> C[MCP Client];
B[Cursor IDE] --> C;
end
subgraph "Harvester MCP Server"
C --> D[MCP Server];
D --> E[Resource Handler];
E --> F[Formatter Registry];
F -->|Get Formatter| G[Core Resource Formatters];
F -->|Get Formatter| H[Harvester Resource Formatters];
end
subgraph "Kubernetes / Harvester"
G --> I[Kubernetes API];
H --> I;
I --> J[Harvester Cluster];
end
style A fill:#f9f,stroke:#333,stroke-width:2px;
style B fill:#f9f,stroke:#333,stroke-width:2px;
style D fill:#bbf,stroke:#333,stroke-width:2px;
style J fill:#bfb,stroke:#333,stroke-width:2px;
This architecture enables AI assistants to interact with Harvester clusters through natural language, making complex Kubernetes operations more accessible to users.
Kubernetes Core Resources:
Harvester-Specific Resources:
Enhanced User Experience:
# Clone the repository
git clone https://github.com/starbops/harvester-mcp-server.git
cd harvester-mcp-server
# Build
make build
# Run
./bin/harvester-mcp-server
go install github.com/starbops/harvester-mcp-server/cmd/harvester-mcp-server@latest
The server automatically looks for Kubernetes configuration in the following order:
--kubeconfig
flagKUBECONFIG
environment variable~/.kube/config
Usage:
harvester-mcp-server [flags]
Flags:
-h, --help help for harvester-mcp-server
--kubeconfig string Path to the kubeconfig file (default is $KUBECONFIG or $HOME/.kube/config)
--log-level string Log level (debug, info, warn, error, fatal, panic) (default "info")
Using a specific kubeconfig file:
harvester-mcp-server --kubeconfig=/path/to/kubeconfig.yaml
Using the KUBECONFIG environment variable:
export KUBECONFIG=$HOME/config.yaml
harvester-mcp-server
With debug logging:
harvester-mcp-server --log-level=debug
~/Library/Application\ Support/Claude/claude_desktop_config.json
or similar)mcpServers
section:{
"mcpServers": {
"harvester": {
"command": "/path/to/harvester-mcp-server",
"args": ["--kubeconfig", "/path/to/kubeconfig.yaml", "--log-level", "info"]
}
}
}
Once your Harvester MCP server is configured in Claude Desktop, you can ask questions like:
cmd/harvester-mcp-server
: Main application entry pointpkg/client
: Kubernetes client implementationpkg/cmd
: CLI commands implementation using Cobrapkg/mcp
: MCP server implementationpkg/kubernetes
: Unified resource handlers for Kubernetes resourcespkg/tools
: Legacy tool implementations for interacting with Harvester resourcesThe project uses a unified approach to handle Kubernetes resources:
The pkg/kubernetes/resources.go
file contains a ResourceHandler
that provides common operations for all resource types:
The pkg/kubernetes/formatters*.go
files contain formatters for different resource types:
The pkg/kubernetes/types.go
file maps friendly resource type names to Kubernetes GroupVersionResource objects:
To add a new tool:
pkg/kubernetes/types.go
pkg/mcp/server.go
in the registerTools
method using the unified resource handlerEach resource type has two formatting functions:
formatXList
- Formats a list of resources with concise information, grouped by namespaceformatX
- Formats a single resource with detailed informationThis project is licensed under the Apache License 2.0 - see the LICENSE file for details.
{
"mcpServers": {
"harvester": {
"env": {},
"args": [
"--kubeconfig",
"/path/to/kubeconfig.yaml",
"--log-level",
"info"
],
"command": "harvester-mcp-server"
}
}
}
Seamless access to top MCP servers powering the future of AI integration.