Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
41 changes: 41 additions & 0 deletions .github/workflows/openev-data-mcp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: openev-data-mcp chart

on:
pull_request:
paths:
- "charts/openev-data-mcp/**"
- ".github/workflows/openev-data-mcp.yml"
- ".github/workflows/chart-test.yml"
push:
branches: [main]
paths:
- "charts/openev-data-mcp/**"
- ".github/workflows/openev-data-mcp.yml"
- ".github/workflows/chart-test.yml"
workflow_dispatch: {}

permissions:
contents: read

jobs:
test:
uses: ./.github/workflows/chart-test.yml
with:
chart: openev-data-mcp
chart-repos: qdrant=https://qdrant.github.io/qdrant-helm
# Default values (bundled CNPG cluster and Qdrant), external database,
# and external Qdrant with the scheduled vector sync.
template-args: |
--set mcp.config.embedding.apiKey=dummy
-f charts/openev-data-mcp/ci/external-db-values.yaml
-f charts/openev-data-mcp/ci/external-qdrant-values.yaml
install-cnpg: true
release: mcp-mock
# There is no Gemini key in CI: the server only needs one to answer
# searches, but the vector sync would fail embedding the dataset.
install-args: --set mcp.config.embedding.apiKey=dummy --set vectorSync.enabled=false
install-timeout: 8m
rollouts: |
deployment/mcp-mock-mcp
statefulset/mcp-mock-qdrant
smoke-test: kubectl -n "$RELEASE" exec deploy/mcp-mock-mcp -- /usr/local/bin/grpc_health_probe -addr=:9090
31 changes: 25 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,18 @@ permissions:
packages: write

env:
CHART_PATH: charts/open-ev-data
REGISTRY: ghcr.io
# Charts are published as oci://ghcr.io/<owner>/open-ev-data-helm/open-ev-data
# Charts are published as oci://ghcr.io/<owner>/open-ev-data-helm/<chart>
REPO_OWNER: chargepi

jobs:
release:
runs-on: ubuntu-latest
strategy:
matrix:
chart:
- open-ev-data
- openev-data-mcp
steps:
- uses: actions/checkout@v4

Expand All @@ -40,12 +44,27 @@ jobs:
fi
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"

- name: Build chart dependencies
run: |
helm repo add qdrant https://qdrant.github.io/qdrant-helm
helm dependency build "charts/${{ matrix.chart }}"

# Charts with required values (e.g. openev-data-mcp's Gemini API key) are
# linted with their ci/*-values.yaml examples instead of the defaults.
- name: Lint chart
run: helm lint "${{ env.CHART_PATH }}"
run: |
CHART="charts/${{ matrix.chart }}"
if ls "${CHART}"/ci/*-values.yaml >/dev/null 2>&1; then
for values in "${CHART}"/ci/*-values.yaml; do
helm lint "${CHART}" -f "${values}"
done
else
helm lint "${CHART}"
fi

- name: Package chart
run: |
helm package "${{ env.CHART_PATH }}" \
helm package "charts/${{ matrix.chart }}" \
--version "${{ steps.version.outputs.version }}" \
--app-version "${{ steps.version.outputs.version }}" \
--destination .cr-release-packages
Expand All @@ -58,9 +77,9 @@ jobs:
- name: Push chart to GHCR (OCI)
run: |
helm push \
".cr-release-packages/open-ev-data-${{ steps.version.outputs.version }}.tgz" \
".cr-release-packages/${{ matrix.chart }}-${{ steps.version.outputs.version }}.tgz" \
"oci://${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/open-ev-data-helm"

- name: Summary
run: |
echo "Published oci://${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/open-ev-data-helm/open-ev-data:${{ steps.version.outputs.version }}" >> "$GITHUB_STEP_SUMMARY"
echo "Published oci://${{ env.REGISTRY }}/${{ env.REPO_OWNER }}/open-ev-data-helm/${{ matrix.chart }}:${{ steps.version.outputs.version }}" >> "$GITHUB_STEP_SUMMARY"
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Chart dependencies, fetched with `helm dependency build` (pinned by Chart.lock).
charts/*/charts/
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,24 @@ as OCI artifacts to GHCR.
| Chart | Description |
|---|---|
| [`open-ev-data`](charts/open-ev-data) | Deploys the [API](https://github.com/open-ev-data/open-ev-data-api) (`ev-server`), which fetches the [dataset](https://github.com/open-ev-data/open-ev-data-dataset)'s sqlite release at pod startup. A single chart, no chart dependencies. |
| [`openev-data-mcp`](charts/openev-data-mcp) | Deploys [openev-data-mcp](https://github.com/ChargePi/openev-data-mcp), an MCP server exposing EV specs over the Model Context Protocol, backed by PostgreSQL provisioned via the [CloudNativePG](https://cloudnative-pg.io) operator. |

## Installing

```console
helm install my-release oci://ghcr.io/chargepi/open-ev-data-helm/open-ev-data --version <version>
helm install my-release oci://ghcr.io/chargepi/open-ev-data-helm/openev-data-mcp --version <version>
```

See [`charts/open-ev-data/README.md`](charts/open-ev-data/README.md) for full configuration docs, including
how to source the sqlite database file from somewhere other than GitHub Releases.
See [`charts/open-ev-data/README.md`](charts/open-ev-data/README.md) and
[`charts/openev-data-mcp/README.md`](charts/openev-data-mcp/README.md) for full configuration docs.

## Development

```console
helm lint charts/open-ev-data
helm template test charts/open-ev-data

helm lint charts/openev-data-mcp
helm template test charts/openev-data-mcp
```
7 changes: 7 additions & 0 deletions charts/openev-data-mcp/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Patterns to ignore when building packages.
.git/
.gitignore
.DS_Store
.vscode/
.idea/
*.md
6 changes: 6 additions & 0 deletions charts/openev-data-mcp/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: qdrant
repository: https://qdrant.github.io/qdrant-helm
version: 1.19.2
digest: sha256:ba790ce755bdac57afbe702728e97c3faba182e3c892e85f5c151de1a3a5e752
generated: "2026-10-15T09:17:58.734896692+02:00"
25 changes: 25 additions & 0 deletions charts/openev-data-mcp/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: v2
name: openev-data-mcp
description: Helm chart for the OpenEV Data MCP server, exposing EV specifications to AI assistants over the Model Context Protocol, backed by PostgreSQL and Qdrant semantic search
type: application
version: 0.2.0
appVersion: "1.0.0"
home: https://github.com/ChargePi/openev-data-mcp
sources:
- https://github.com/ChargePi/openev-data-mcp
maintainers:
- name: open-ev-data
keywords:
- electric-vehicle
- ev
- mcp
- model-context-protocol
- postgresql
- cloudnative-pg
- qdrant
- semantic-search
dependencies:
- name: qdrant
version: 1.19.2
repository: https://qdrant.github.io/qdrant-helm
condition: qdrant.enabled
143 changes: 143 additions & 0 deletions charts/openev-data-mcp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
# openev-data-mcp

Helm chart for [openev-data-mcp](https://github.com/ChargePi/openev-data-mcp), an MCP (Model Context
Protocol) server that exposes EV specifications (battery capacity, range ratings, charging capabilities,
etc) to AI assistants over streamable HTTP, backed by PostgreSQL, with semantic vehicle search
(the `search_vehicles` tool) backed by Qdrant and Gemini embeddings.

## Prerequisites

- Kubernetes 1.23+
- Helm 3.8+
- The [CloudNativePG](https://cloudnative-pg.io) operator, if you want this chart to provision its own
Postgres cluster (the default — see below for using an external database instead).
- A [Gemini API key](https://aistudio.google.com/apikey), used to embed vehicles and search queries.

## Why no bundled PostgreSQL chart dependency?

The usual default (Bitnami's `postgresql` chart) had its free OCI images frozen in 2025 — no more
updates unless you pay for Bitnami Secure Images. A Helm subchart also isn't a great fit for a Postgres
*operator* anyway: its CRDs are cluster-scoped and normally installed once per cluster by a platform
team, not tied to an individual application release's install/uninstall lifecycle.

Instead, this chart targets [CloudNativePG](https://cloudnative-pg.io): install the operator once per
cluster,

```console
helm repo add cnpg https://cloudnative-pg.github.io/charts
helm upgrade --install cnpg-operator cnpg/cloudnative-pg --namespace cnpg-system --create-namespace
```

and this chart's own `Cluster` resource (`postgresql.cnpg.enabled: true`, the default) provisions a
dedicated Postgres instance per release on top of it. Set `postgresql.cnpg.enabled: false` and configure
`postgresql.external` instead to point at any Postgres you already manage (a CNPG cluster in another
namespace, RDS, etc) without provisioning a new one — see
[`ci/external-db-values.yaml`](ci/external-db-values.yaml) for a worked example:

```console
helm install my-release charts/openev-data-mcp -f charts/openev-data-mcp/ci/external-db-values.yaml
```

## Installing

```console
kubectl create secret generic openev-mcp-gemini --from-literal=api-key='<your-gemini-api-key>'
helm install my-release oci://ghcr.io/chargepi/open-ev-data-helm/openev-data-mcp --version <version> \
--set mcp.config.embedding.existingSecret=openev-mcp-gemini
```

Or from a local checkout of this repository (fetch the Qdrant dependency first):

```console
helm dependency build charts/openev-data-mcp
helm install my-release charts/openev-data-mcp --set mcp.config.embedding.existingSecret=openev-mcp-gemini
```

`mcp.config.embedding.apiKey` can be set instead of `existingSecret`, in which case the chart stores the
key in a Secret of its own.

## Database schema and seed data

`openev-data-mcp` does not run its schema migration on startup — it just connects. This chart applies
the upstream project's `migrations/001_initial.sql` (schema + seed data) via a **post-install-only** Job
that fetches the file from `raw.githubusercontent.com/ChargePi/openev-data-mcp` at the release tag
matching the deployed image (the `mcp.image.tag` git tag, defaulting to `v<appVersion>`), the same way
`api.database.fetch` in the sibling `open-ev-data` chart fetches its dataset — rather than vendoring the
SQL into this chart, so the schema always matches the server version.

It only runs on install (not on every upgrade) because the migration isn't idempotent — re-running it
against an already-migrated database would fail on "relation already exists". To pick up a newer
migration after bumping `mcp.image.tag`, apply it yourself:

```console
kubectl get configmap my-release-mcp-migrate -o jsonpath='{.data.migrate\.sh}' | kubectl exec -i <a-pod-with-psql> -- sh
```

or run `helm template ... | kubectl apply -f -` targeting just the Job after deleting the old one.

Set `migration.enabled: false` to skip this entirely (e.g. if you're pointing at a database that's
already migrated some other way).

## Semantic search

The `search_vehicles` tool embeds a natural language query with Gemini and matches it against a Qdrant
collection holding one embedded document per vehicle.

**Qdrant.** By default the official [Qdrant chart](https://github.com/qdrant/qdrant-helm) is installed as
a dependency, with an API key generated on install and kept across upgrades. Everything under `qdrant`
other than `external` is passed through to it (persistence, resources, replicas, etc). Set
`qdrant.enabled: false` and configure `qdrant.external` to use a Qdrant you manage yourself, e.g. Qdrant
Cloud — see [`ci/external-qdrant-values.yaml`](ci/external-qdrant-values.yaml).

**Vector sync.** The collection is filled by `openev-data-mcp migrate`, which provisions the collection,
embeds new or changed vehicles, deletes removed ones and skips unchanged ones, so re-running it is cheap.
The chart runs it as a Helm hook Job on install (after the database migration) and on every upgrade.
The MCP server does not wait for it: searches work over whatever is already indexed.

Helm waits for the hook, so a failed sync fails the install or upgrade. On the Gemini **free tier** the
first sync of the full dataset (~1200 vehicles) exceeds the daily embedding quota (~1000 requests); the
sync stops when Gemini reports the daily quota is exhausted and picks up where it left off on the next
run. Either use a paid key, or set `vectorSync.enabled: false` and enable `vectorSync.cronJob` so the
index completes over consecutive days. The CronJob is also useful on its own, to pick up dataset changes
without a Helm upgrade.

## Values

| Key | Description | Default |
|---|---|---|
| `mcp.replicaCount` | Replica count | `1` |
| `mcp.image.repository` / `mcp.image.tag` | MCP server image; `tag` defaults to `v<appVersion>`, the release's git tag | `ghcr.io/chargepi/openev-data-mcp` / `""` |
| `mcp.service.port` | MCP (streamable HTTP) port | `8080` |
| `mcp.service.healthPort` | gRPC health-check port (probed via the `grpc_health_probe` binary baked into the image) | `9090` |
| `mcp.config.refreshInterval` | How often the in-memory resource cache refreshes from the database | `5m` |
| `mcp.config.observability.enabled` / `mcp.config.observability.otlpEndpoint` | OpenTelemetry OTLP export | `false` / `""` |
| `mcp.ingress.enabled` | Expose the MCP endpoint via Ingress | `false` |
| `mcp.autoscaling.enabled` | Enable a HorizontalPodAutoscaler | `false` |
| `postgresql.cnpg.enabled` | Provision a dedicated Postgres cluster via CloudNativePG | `true` |
| `postgresql.cnpg.database` | Application database (and owner role) name | `openevdata` |
| `postgresql.cnpg.storage.size` | PVC size for the CNPG cluster | `1Gi` |
| `postgresql.external.*` | Connection details for a database you manage yourself, used when `postgresql.cnpg.enabled: false` | — |
| `migration.enabled` | Run the post-install schema/seed Job | `true` |
| `migration.gitRef` | Override the git ref to fetch `migrations/001_initial.sql` from; required if `mcp.image.tag` isn't a semver release | `""` (the image tag) |
| `mcp.config.embedding.apiKey` / `mcp.config.embedding.existingSecret` | Gemini API key, inline or from an existing Secret (key `existingSecretKey`); one is required | `""` / `""` |
| `mcp.config.embedding.model` / `mcp.config.embedding.dimensions` | Embedding model and vector size; changing the size requires deleting the collection | `gemini-embedding-001` / `768` |
| `mcp.config.search.collection` | Qdrant collection name | `ev_vehicles` |
| `mcp.config.search.limit` / `mcp.config.search.minScore` | Maximum results per search and the minimum cosine similarity for a match | `10` / `0.6` |
| `qdrant.enabled` | Install the bundled Qdrant chart | `true` |
| `qdrant.apiKey` | Generate an API key for the bundled Qdrant | `true` |
| `qdrant.persistence.size` | PVC size for the bundled Qdrant | `1Gi` |
| `qdrant.external.*` | Connection details (host, gRPC port, TLS, API key Secret) for a Qdrant you manage yourself, used when `qdrant.enabled: false` | — |
| `vectorSync.enabled` | Run the vector sync as a post-install/post-upgrade hook Job | `true` |
| `vectorSync.activeDeadlineSeconds` | Time limit for one sync run | `3600` |
| `vectorSync.cronJob.enabled` / `vectorSync.cronJob.schedule` | Also run the sync on a schedule | `false` / `"0 3 * * *"` |

See `values.yaml` for the full set of options (resources, security contexts, node selectors, etc).

## Upgrading the MCP server

```console
helm upgrade my-release charts/openev-data-mcp --set mcp.image.tag=v1.0.0
```

The database migration Job does not re-run on upgrade (see above); the `mcp` Deployment rolls and the
vector sync re-runs, re-embedding only vehicles whose indexed document changed.
42 changes: 42 additions & 0 deletions charts/openev-data-mcp/ci/external-db-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Example values for pointing openev-data-mcp at a PostgreSQL database you
# already manage yourself (RDS, a shared on-prem instance, a CNPG cluster in
# another namespace, etc), instead of having this chart provision a dedicated
# CNPG Cluster.
#
# The referenced Secret is NOT created by this chart — create it yourself
# first, e.g.:
#
# kubectl create secret generic openev-mcp-db-credentials \
# --from-literal=username=openevdata \
# --from-literal=password='<your-password>'
#
# Then apply the schema once against that database (this chart's migration
# Job will do it automatically on install if migration.enabled stays true —
# see the chart README for details on its post-install-only semantics), or
# run migrations/001_initial.sql yourself and set migration.enabled: false.
#
# The Gemini API key for semantic search is read from an existing Secret too:
#
# kubectl create secret generic openev-mcp-gemini --from-literal=api-key='<your-key>'
#
# Usage:
# helm install my-release charts/openev-data-mcp -f ci/external-db-values.yaml

mcp:
config:
embedding:
existingSecret: openev-mcp-gemini

postgresql:
sslMode: require

cnpg:
enabled: false

external:
host: my-postgres.example.internal
port: 5432
database: openevdata
existingSecret: openev-mcp-db-credentials
userKey: username
passwordKey: password
31 changes: 31 additions & 0 deletions charts/openev-data-mcp/ci/external-qdrant-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Example values for pointing openev-data-mcp at a Qdrant you already manage
# yourself (e.g. Qdrant Cloud), instead of installing the bundled Qdrant chart.
#
# The referenced Secrets are NOT created by this chart, create them first:
#
# kubectl create secret generic openev-mcp-qdrant --from-literal=api-key='<qdrant-api-key>'
# kubectl create secret generic openev-mcp-gemini --from-literal=api-key='<gemini-api-key>'
#
# Usage:
# helm install my-release charts/openev-data-mcp -f ci/external-qdrant-values.yaml

mcp:
config:
embedding:
existingSecret: openev-mcp-gemini

qdrant:
enabled: false
external:
host: xyz-example.eu-central.aws.cloud.qdrant.io
port: 6334
useTls: true
existingSecret: openev-mcp-qdrant
apiKeyKey: api-key

vectorSync:
# Re-run the sync nightly to finish an index cut short by the Gemini
# free-tier daily quota, and to pick up dataset changes.
cronJob:
enabled: true
schedule: "0 3 * * *"
Loading
Loading