Skip to content

Commit cb84497

Browse files
sneaxhuhameijer
andauthored
added-mcp-config (#311)
* added-mcp-config Signed-off-by: sneax <paladesh600@gmail.com> * Remove redundant MCP extraEnv configuration Signed-off-by: sneax <paladesh600@gmail.com> * removed-extraenv Signed-off-by: sneax <paladesh600@gmail.com> * ingress-support-mcp Signed-off-by: sneax <paladesh600@gmail.com> * Update Chart.yaml Signed-off-by: Alex Meijer <ameijer@users.noreply.github.com> * Update values.yaml Signed-off-by: Alex Meijer <ameijer@users.noreply.github.com> * Update Chart.yaml Signed-off-by: Alex Meijer <ameijer@users.noreply.github.com> --------- Signed-off-by: sneax <paladesh600@gmail.com> Signed-off-by: Alex Meijer <ameijer@users.noreply.github.com> Co-authored-by: Alex Meijer <ameijer@users.noreply.github.com>
1 parent 43501d6 commit cb84497

File tree

5 files changed

+95
-7
lines changed

5 files changed

+95
-7
lines changed

charts/opencost/Chart.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ keywords:
1111
- opencost
1212
version: 2.3.2
1313
maintainers:
14-
- name: jessegoodier
15-
- name: toscott
16-
- name: mittal-ishaan
17-
- name: brito-rafa
18-
email: rafa@stormforge.io
14+
- name: jessegoodier
15+
- name: toscott
16+
- name: mittal-ishaan
17+
- name: brito-rafa
18+
email: rafa@stormforge.io
1919
home: https://github.com/opencost/opencost-helm-chart

charts/opencost/templates/deployment.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ spec:
105105
ports:
106106
- containerPort: {{ .Values.opencost.exporter.apiPort }}
107107
name: http
108+
{{- if .Values.opencost.mcp.enabled }}
109+
- containerPort: {{ .Values.opencost.mcp.port }}
110+
name: mcp-server
111+
{{- end }}
108112
resources: {{- toYaml .Values.opencost.exporter.resources | nindent 12 }}
109113
{{- if .Values.opencost.exporter.startupProbe.enabled }}
110114
startupProbe:
@@ -315,6 +319,13 @@ spec:
315319
- name: {{ $key }}
316320
value: {{ $value | quote }}
317321
{{- end }}
322+
{{- if .Values.opencost.mcp.enabled }}
323+
# MCP Server Configuration
324+
- name: MCP_SERVER_ENABLED
325+
value: "true"
326+
- name: MCP_HTTP_PORT
327+
value: {{ .Values.opencost.mcp.port | quote }}
328+
{{- end }}
318329
{{- if or .Values.plugins.enabled .Values.opencost.exporter.persistence.enabled .Values.opencost.exporter.extraVolumeMounts .Values.opencost.customPricing.enabled .Values.opencost.cloudIntegrationSecret .Values.opencost.updateCaTrust.enabled}}
319330
volumeMounts:
320331
{{- if .Values.plugins.enabled }}
@@ -518,4 +529,4 @@ spec:
518529
{{- with .Values.extraVolumes }}
519530
{{- toYaml . | nindent 8 }}
520531
{{- end }}
521-
{{- end }}
532+
{{- end }}

charts/opencost/templates/ingress.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,45 @@ spec:
7878
name: {{ $.Values.opencost.exporter.apiIngress.servicePort }}
7979
{{- end }}
8080
{{- end }}
81+
{{- end }}
82+
---
83+
{{- if and .Values.opencost.mcp.enabled .Values.opencost.mcp.ingress.enabled }}
84+
apiVersion: networking.k8s.io/v1
85+
kind: Ingress
86+
metadata:
87+
name: {{ include "opencost.fullname" . }}-mcp-ingress
88+
namespace: {{ include "opencost.namespace" . }}
89+
labels: {{- include "opencost.labels" . | nindent 4 }}
90+
{{- with .Values.opencost.mcp.ingress.annotations }}
91+
annotations: {{- toYaml . | nindent 4 }}
92+
{{- end }}
93+
spec:
94+
{{- with .Values.opencost.mcp.ingress.ingressClassName }}
95+
ingressClassName: {{ . }}
96+
{{- end }}
97+
{{- if .Values.opencost.mcp.ingress.tls }}
98+
tls:
99+
{{- range .Values.opencost.mcp.ingress.tls }}
100+
- hosts:
101+
{{- range .hosts }}
102+
- {{ . | quote }}
103+
{{- end }}
104+
secretName: {{ .secretName }}
105+
{{- end }}
106+
{{- end }}
107+
rules:
108+
{{- range .Values.opencost.mcp.ingress.hosts }}
109+
- host: {{ .host | quote }}
110+
http:
111+
paths:
112+
{{- range .paths }}
113+
- path: {{ .path }}
114+
pathType: {{ .pathType }}
115+
backend:
116+
service:
117+
name: {{ include "opencost.fullname" $ }}
118+
port:
119+
name: mcp-server
120+
{{- end }}
121+
{{- end }}
81122
{{- end }}

charts/opencost/templates/service.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ spec:
2727
- name: http
2828
port: {{ .Values.opencost.exporter.apiPort }}
2929
targetPort: {{ .Values.opencost.exporter.apiPort }}
30+
{{- if .Values.opencost.mcp.enabled }}
31+
- name: mcp-server
32+
port: {{ .Values.opencost.mcp.port }}
33+
targetPort: {{ .Values.opencost.mcp.port }}
34+
{{- end }}
3035
{{- if .Values.opencost.ui.enabled }}
3136
- name: http-ui
3237
port: {{ .Values.opencost.ui.uiPort }}
@@ -45,4 +50,4 @@ spec:
4550
{{- with .Values.service.extraPorts }}
4651
{{- toYaml . | nindent 4 }}
4752
{{- end }}
48-
{{- end }}
53+
{{- end }}

charts/opencost/values.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,37 @@ opencost:
128128
# -- <SECRET_NAME> for the secret containing the Cloud Costs cloud-integration.json https://www.opencost.io/docs/configuration/#cloud-costs
129129
# -- kubectl create secret generic <SECRET_NAME> --from-file=cloud-integration.json -n opencost
130130
cloudIntegrationSecret: ""
131+
132+
# -- MCP (Model Context Protocol) Server Configuration
133+
# The MCP server provides AI agents with access to cost allocation and asset data
134+
mcp:
135+
# -- Enable MCP server for AI agent integration (default: true)
136+
# Set to false to disable MCP server completely
137+
enabled: true
138+
# -- HTTP port for MCP server (default: 8081)
139+
# Change this if port 8081 conflicts with other services
140+
port: 8081
141+
ingress:
142+
# -- Ingress for MCP server
143+
enabled: false
144+
# -- Ingress controller which implements the resource
145+
ingressClassName: ""
146+
# -- Annotations for Ingress resource
147+
annotations: {}
148+
# kubernetes.io/tls-acme: "true"
149+
# -- A list of host rules used to configure the Ingress
150+
# @default -- See [values.yaml](values.yaml)
151+
hosts:
152+
- host: example.local
153+
paths:
154+
- path: /
155+
pathType: Prefix
156+
# -- Ingress TLS configuration
157+
tls: []
158+
# - secretName: chart-example-tls
159+
# hosts:
160+
# - chart-example.local
161+
131162
exporter:
132163
# API_PORT for the cost-model to listen on
133164
apiPort: 9003

0 commit comments

Comments
 (0)