Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,29 @@ help: ## Display this help.
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases

.PHONY: helm-crd
helm-crd: manifests ## Generate Helm CRD template from the generated CRD definition.
@echo "Generating Helm CRD template from config/crd/bases/kagent.dev_mcpservers.yaml"
@mkdir -p helm/kmcp/templates/crds
@echo '{{- if .Values.crd.create }}' > helm/kmcp/templates/crds/mcpserver-crd.yaml
@awk '/^ name: mcpservers.kagent.dev$$/ { \
print; \
print " labels:"; \
print " {{- include \"kmcp.labels\" . | nindent 4 }}"; \
next; \
} \
{ print }' config/crd/bases/kagent.dev_mcpservers.yaml >> helm/kmcp/templates/crds/mcpserver-crd.yaml
@echo '{{- end }}' >> helm/kmcp/templates/crds/mcpserver-crd.yaml
@echo "Helm CRD template generated at helm/kmcp/templates/crds/mcpserver-crd.yaml"

.PHONY: helm-templates
helm-templates: helm-crd ## Generate all Helm templates from source definitions.
@echo "All Helm templates updated successfully"

.PHONY: manifests-all
manifests-all: manifests helm-templates ## Generate both Kustomize and Helm manifests from source definitions.
@echo "All manifests (Kustomize and Helm) updated successfully"

.PHONY: generate
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
Expand Down
3 changes: 3 additions & 0 deletions config/crd/bases/kagent.dev_mcpservers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ spec:
description: HTTPTransport defines the configuration for a Streamable
HTTP transport.
properties:
path:
description: the target path where MCP is served
type: string
targetPort:
description: target port is the HTTP port that serves the MCP
server.over HTTP
Expand Down
20 changes: 20 additions & 0 deletions helm/kmcp/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
19 changes: 19 additions & 0 deletions helm/kmcp/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v2
name: kmcp
description: A Helm chart for KMCP (Kubernetes MCP Server Controller)
type: application
version: 0.1.0
appVersion: "0.1.0"
home: https://github.com/kagent-dev/kmcp
sources:
- https://github.com/kagent-dev/kmcp
maintainers:
- name: kmcp-maintainers
email: maintainers@kagent.dev
keywords:
- mcp
- kubernetes
- controller
- server
annotations:
category: Infrastructure
147 changes: 147 additions & 0 deletions helm/kmcp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# KMCP Helm Chart

A Helm chart for deploying the KMCP (Kubernetes MCP Server Controller) to Kubernetes clusters.

## Overview

KMCP is a Kubernetes controller that manages MCP (Model Context Protocol) servers. It provides a declarative way to deploy and manage MCP servers in your Kubernetes environment.

## Prerequisites

- Kubernetes 1.11.3+
- Helm 3.0+

## Installation

### Add the Helm Repository

```bash
# Add the repository (once available)
helm repo add kmcp https://charts.kagent.dev
helm repo update
```

### Install the Chart

```bash
# Install with default values
helm install kmcp kmcp/kmcp

# Install in a specific namespace
helm install kmcp kmcp/kmcp --namespace kmcp-system --create-namespace

# Install with custom values
helm install kmcp kmcp/kmcp --values values.yaml
```

## Configuration

The following table lists the configurable parameters of the KMCP chart and their default values.

### Image Configuration

| Parameter | Description | Default |
|-----------|-------------|---------|
| `image.repository` | Container image repository | `controller` |
| `image.tag` | Container image tag | `""` (uses appVersion) |
| `image.pullPolicy` | Container image pull policy | `IfNotPresent` |
| `imagePullSecrets` | Image pull secrets | `[]` |

### Controller Configuration

| Parameter | Description | Default |
|-----------|-------------|---------|
| `controller.replicaCount` | Number of controller replicas | `1` |
| `controller.leaderElection.enabled` | Enable leader election | `true` |
| `controller.healthProbe.bindAddress` | Health probe bind address | `:8081` |
| `controller.metrics.enabled` | Enable metrics endpoint | `true` |
| `controller.metrics.bindAddress` | Metrics bind address | `:8443` |

### RBAC Configuration

| Parameter | Description | Default |
|-----------|-------------|---------|
| `rbac.create` | Create RBAC resources | `true` |
| `serviceAccount.create` | Create service account | `true` |
| `serviceAccount.name` | Service account name | `""` (generated) |
| `serviceAccount.annotations` | Service account annotations | `{}` |

### Resource Configuration

| Parameter | Description | Default |
|-----------|-------------|---------|
| `resources.limits.cpu` | CPU limit | `500m` |
| `resources.limits.memory` | Memory limit | `128Mi` |
| `resources.requests.cpu` | CPU request | `10m` |
| `resources.requests.memory` | Memory request | `64Mi` |

### Security Configuration

| Parameter | Description | Default |
|-----------|-------------|---------|
| `podSecurityContext.runAsNonRoot` | Run as non-root user | `true` |
| `podSecurityContext.seccompProfile.type` | Seccomp profile type | `RuntimeDefault` |
| `securityContext.allowPrivilegeEscalation` | Allow privilege escalation | `false` |
| `securityContext.capabilities.drop` | Capabilities to drop | `["ALL"]` |

### Service Configuration

| Parameter | Description | Default |
|-----------|-------------|---------|
| `service.type` | Service type | `ClusterIP` |
| `service.port` | Service port | `8443` |
| `service.targetPort` | Service target port | `8443` |

### Custom Resource Definition

| Parameter | Description | Default |
|-----------|-------------|---------|
| `crd.create` | Create CRDs | `true` |

## Usage

After installation, you can create MCP servers using the `MCPServer` custom resource:

```yaml
apiVersion: kagent.dev/v1alpha1
kind: MCPServer
metadata:
name: my-mcp-server
spec:
transportType: http
deployment:
image: my-mcp-server:latest
port: 8080
httpTransport:
targetPort: 8080
```

## Monitoring

The controller exposes metrics on port 8443 by default. These metrics can be scraped by Prometheus or other monitoring systems.

## Upgrading

To upgrade the chart:

```bash
helm upgrade kmcp kmcp/kmcp
```

## Uninstalling

To uninstall the chart:

```bash
helm uninstall kmcp
```

**Note**: This will remove all the Kubernetes resources associated with the chart and delete the release.

## Contributing

For information on contributing to this project, please see the [main repository](https://github.com/kagent-dev/kmcp).

## License

This project is licensed under the terms specified in the main repository.
99 changes: 99 additions & 0 deletions helm/kmcp/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "kmcp.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "kmcp.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "kmcp.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "kmcp.labels" -}}
helm.sh/chart: {{ include "kmcp.chart" . }}
{{ include "kmcp.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "kmcp.selectorLabels" -}}
app.kubernetes.io/name: {{ include "kmcp.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
control-plane: controller-manager
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "kmcp.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (printf "%s-controller-manager" (include "kmcp.fullname" .)) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Create the namespace to use
*/}}
{{- define "kmcp.namespace" -}}
{{- if .Values.namespace }}
{{- .Values.namespace }}
{{- else }}
{{- .Release.Namespace }}
{{- end }}
{{- end }}

{{/*
Create the image reference
*/}}
{{- define "kmcp.image" -}}
{{- $tag := .Values.image.tag | default .Chart.AppVersion }}
{{- printf "%s:%s" .Values.image.repository $tag }}
{{- end }}

{{/*
Create controller manager container args
*/}}
{{- define "kmcp.controllerArgs" -}}
{{- $args := list }}
{{- if .Values.controller.leaderElection.enabled }}
{{- $args = append $args "--leader-elect" }}
{{- end }}
{{- if .Values.controller.healthProbe.bindAddress }}
{{- $args = append $args (printf "--health-probe-bind-address=%s" .Values.controller.healthProbe.bindAddress) }}
{{- end }}
{{- if .Values.controller.metrics.enabled }}
{{- $args = append $args (printf "--metrics-bind-address=%s" .Values.controller.metrics.bindAddress) }}
{{- end }}
{{- toYaml $args }}
{{- end }}
Loading
Loading