Skip to content

Commit 429424d

Browse files
Need to fix mcp server endpoitn setup
since it's behind a tls terminating proxy, need to let it know how to handle nothing
1 parent f156481 commit 429424d

File tree

5 files changed

+102
-26
lines changed

5 files changed

+102
-26
lines changed

apps/core/lib/core/mcp/router.ex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ defmodule Core.MCP.Router do
88
pass: ["text/*"],
99
json_decoder: Jason
1010

11+
plug Plug.SSL, rewrite_on: [
12+
:x_forwarded_proto,
13+
:x_forwarded_host,
14+
:x_forwarded_port
15+
]
16+
1117
plug :match
1218
plug :ensure_session_id
1319
plug :authorize

apps/core/lib/core/mcp/server.ex

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,23 @@ defmodule Core.MCP.Server do
1818
end
1919

2020
@impl true
21-
def handle_initialize(request_id, params) do
22-
case validate_protocol_version(params["protocolVersion"]) do
23-
:ok ->
24-
{:ok,
25-
%{
26-
jsonrpc: "2.0",
27-
id: request_id,
28-
result: %{
29-
protocolVersion: @protocol_version,
30-
capabilities: %{
31-
tools: %{
32-
listChanged: true
33-
}
34-
},
35-
serverInfo: %{
36-
name: "Plural MCP Server",
37-
version: "0.1.0"
38-
}
39-
}
40-
}}
41-
42-
{:error, reason} ->
43-
{:error, reason}
44-
end
21+
def handle_initialize(request_id, _params) do
22+
{:ok, %{
23+
jsonrpc: "2.0",
24+
id: request_id,
25+
result: %{
26+
protocolVersion: @protocol_version,
27+
capabilities: %{
28+
tools: %{
29+
listChanged: true
30+
}
31+
},
32+
serverInfo: %{
33+
name: "Plural MCP Server",
34+
version: "0.1.0"
35+
}
36+
}
37+
}}
4538
end
4639

4740
@impl true

plural/helm/plural/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: plural
33
description: A helm chart for installing plural
44
appVersion: 0.11.8
5-
version: 0.10.102
5+
version: 0.10.103
66
dependencies:
77
- name: hydra
88
version: 0.26.5

plural/helm/plural/templates/deployment.yaml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,3 +271,80 @@ spec:
271271
topologySpreadConstraints:
272272
{{- toYaml . | nindent 8 }}
273273
{{- end }}
274+
---
275+
apiVersion: apps/v1
276+
kind: Deployment
277+
metadata:
278+
name: plural-mcp
279+
labels:
280+
{{ include "plural.labels" . | indent 4 }}
281+
spec:
282+
replicas: 1
283+
selector:
284+
matchLabels:
285+
app.kubernetes.io/name: plural-mcp
286+
app.kubernetes.io/instance: {{ .Release.Name }}
287+
template:
288+
metadata:
289+
labels:
290+
app.kubernetes.io/name: plural-mcp
291+
app.kubernetes.io/instance: {{ .Release.Name }}
292+
plural.sh/monitoring: scrape
293+
annotations:
294+
prometheus.io/scrape: "true"
295+
prometheus.io/path: "/metrics"
296+
prometheus.io/port: {{ .Values.api.port | quote }}
297+
checksum/config: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
298+
spec:
299+
serviceAccountName: plural
300+
{{- with .Values.imagePullSecrets }}
301+
imagePullSecrets:
302+
{{- toYaml . | nindent 6 }}
303+
{{- end }}
304+
initContainers:
305+
{{ include "plural.wait-for-migration" . | nindent 6 }}
306+
containers:
307+
- name: api
308+
image: "{{ .Values.global.registry }}/{{ .Values.image.repository }}:{{ include "plural.imageTag" . }}"
309+
imagePullPolicy: {{ .Values.image.pullPolicy }}
310+
envFrom:
311+
- secretRef:
312+
name: plural-env
313+
env:
314+
{{ include "plural.env" . | nindent 8 }}
315+
ports:
316+
- name: http
317+
containerPort: {{ .Values.api.port }}
318+
protocol: TCP
319+
- name: epmd
320+
containerPort: 4369
321+
protocol: TCP
322+
- name: mcp
323+
containerPort: {{ .Values.mcp.port }}
324+
protocol: TCP
325+
livenessProbe:
326+
httpGet:
327+
path: /health
328+
port: http
329+
readinessProbe:
330+
httpGet:
331+
path: /__traffic
332+
port: http
333+
resources:
334+
{{- toYaml .Values.api.resources | nindent 12 }}
335+
{{- with .Values.nodeSelector }}
336+
nodeSelector:
337+
{{- toYaml . | nindent 8 }}
338+
{{- end }}
339+
{{- with .Values.affinity }}
340+
affinity:
341+
{{- toYaml . | nindent 8 }}
342+
{{- end }}
343+
{{- with .Values.tolerations }}
344+
tolerations:
345+
{{- toYaml . | nindent 8 }}
346+
{{- end }}
347+
{{- with .Values.api.topologySpreadConstraints }}
348+
topologySpreadConstraints:
349+
{{- toYaml . | nindent 8 }}
350+
{{- end }}

plural/helm/plural/templates/service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ spec:
3838
protocol: TCP
3939
name: mcp
4040
selector:
41-
app.kubernetes.io/name: plural-api
41+
app.kubernetes.io/name: plural-mcp
4242
app.kubernetes.io/instance: {{ .Release.Name }}
4343
---
4444
apiVersion: v1

0 commit comments

Comments
 (0)