Thank you for installing {{ .Chart.Name }}!

Your Nextcloud MCP Server has been deployed in {{ .Values.auth.mode }} authentication mode.

1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
  {{- range .paths }}
  http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
  {{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
  export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "nextcloud-mcp-server.fullname" . }})
  export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
  echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
     NOTE: It may take a few minutes for the LoadBalancer IP to be available.
           You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "nextcloud-mcp-server.fullname" . }}'
  export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "nextcloud-mcp-server.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
  echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
  export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "nextcloud-mcp-server.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
  export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
  echo "Visit http://127.0.0.1:8080 to use your MCP server"
  kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}

2. Check the deployment status:
  kubectl --namespace {{ .Release.Namespace }} get pods -l "app.kubernetes.io/name={{ include "nextcloud-mcp-server.name" . }},app.kubernetes.io/instance={{ .Release.Name }}"

{{- if eq .Values.auth.mode "basic" }}

3. Basic Authentication Mode:
   {{- if .Values.auth.basic.existingSecret }}
   - Credentials: (using existing secret {{ .Values.auth.basic.existingSecret }})
   {{- else }}
   - Username: {{ .Values.auth.basic.username }}
   - Password: (stored in secret {{ include "nextcloud-mcp-server.basicAuthSecretName" . }})
   {{- end }}
   - Connected to: {{ .Values.nextcloud.host }}
{{- else if eq .Values.auth.mode "oauth" }}

3. OAuth Authentication Mode:
   - Server URL: {{ include "nextcloud-mcp-server.mcpServerUrl" . }}
   - Issuer URL: {{ include "nextcloud-mcp-server.publicIssuerUrl" . }}
   - Connected to: {{ .Values.nextcloud.host }}
   {{- if .Values.auth.oauth.existingSecret }}
   - Using existing OAuth client secret: {{ .Values.auth.oauth.existingSecret }}
   {{- else if and .Values.auth.oauth.clientId .Values.auth.oauth.clientSecret }}
   - Using pre-registered OAuth client
   {{- else }}
   - Using Dynamic Client Registration (DCR)
   {{- end }}
   {{- if .Values.auth.oauth.persistence.enabled }}
   - OAuth client credentials are persisted in PVC: {{ include "nextcloud-mcp-server.oauthPvcName" . }}
   {{- end }}

   IMPORTANT: OAuth mode is experimental and requires patches to the user_oidc app.
   See: https://github.com/cbcoutinho/nextcloud-mcp-server#authentication
{{- end }}

{{- if .Values.documentProcessing.enabled }}

4. Document Processing:
   - Enabled: {{ .Values.documentProcessing.enabled }}
   - Default processor: {{ .Values.documentProcessing.defaultProcessor }}
   {{- if .Values.documentProcessing.unstructured.enabled }}
   - Unstructured API: {{ .Values.documentProcessing.unstructured.apiUrl }}
   {{- end }}
{{- end }}

For more information and documentation:
- GitHub: https://github.com/cbcoutinho/nextcloud-mcp-server
- Documentation: https://github.com/cbcoutinho/nextcloud-mcp-server#readme

To upgrade this deployment:
  helm upgrade {{ .Release.Name }} nextcloud-mcp-server

To uninstall:
  helm uninstall {{ .Release.Name }}
