Uploaded image for project: 'Red Hat Developer Hub Bugs'
  1. Red Hat Developer Hub Bugs
  2. RHDHBUGS-2543

LCS container does not load env variables in the MCP server configuration

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • 1.8.2
    • Lightspeed, MCP
    • None
    • False
    • Hide

      None

      Show
      None
    • False

      Description of problem:

      The lightspeed configuration described in the `lightspeed-stack` ConfigMap requires to use final values and you can use env variables inside `mcp_servers` section. If you use the next definition for your MCP server:

          mcp_servers:
            - name: mcp::backstage
              provider_id: model-context-protocol
              url: https://backstage-developer-hub-rhdh-gitlab.${BASEDOMAIN}/api/mcp-actions/v1 

      It will fail with errors in the `llama-stack` container similar to the ones attached in this case (file: backstage-developer-hub-5546f44f8-8s6qd-llama-stack.log) backstage-developer-hub-5546f44f8-8s6qd-llama-stack.log

      The env variable is defined in a secret added into `lightspeed-core` container using the `envFrom` section, such as:

                    - name: lightspeed-core # Lightspeed Core Service
                      image: 'quay.io/lightspeed-core/lightspeed-stack:dev-20251021-ee9f08f'
                      envFrom:
                        - secretRef:
                            name: rhdh-secrets
                      volumeMounts:
                        - mountPath: /app-root/lightspeed-stack.yaml
                          name: lightspeed-stack
                          subPath: lightspeed-stack.yaml
                        - mountPath: /tmp/data/feedback
                          name: shared-storage
                        - mountPath: /tmp/data/transcripts
                          name: shared-storage
                        - mountPath: /tmp/data/conversations
                          name: shared-storage 

      The variable is available inside the container as we can check from the terminal:

      on 🎩 ❯ oc exec $(oc get pod -l rhdh.redhat.com/app=backstage-developer-hub -n rhdh-gitlab -o jsonpath='{.items[0].metadata.name}') -c lightspeed-core -n rhdh-gitlab -- printenv BASEDOMAIN
      apps.cluster-mxvsb.mxvsb.sandbox3509.opentlc.com 

      However, any chat conversation fails in Lightspeed Developer UI. If the `url`variable is defined without env var and using the final value, the chat conversations work succesfully.

      Prerequisites (if any, like setup, operators/versions):

      Steps to Reproduce

      The following GitHub repository has an example to replicate this error.

      https://github.com/rmarting/rhdh-exercises/blob/main/README-ai-ls.md

      Here it is the `url` definition using the env var:

      https://github.com/rmarting/rhdh-exercises/blob/main/custom-app-config-gitlab/ls-stack-configmap-15.yaml#L33

      Here it is injected the secret with the env variables:

      https://github.com/rmarting/rhdh-exercises/blob/main/custom-app-config-gitlab/rhdh-instance-15.yaml#L55

      Actual results:

      Any chat conversation fails with errors in the `llama-stack` container.

      Expected results:

      Successful chat conversations and get responses from the LLM and MCP servers.

      Reproducibility (Always/Intermittent/Only Once):

      Always

      Build Details:

      Additional info (Such as Logs, Screenshots, etc):

              Unassigned Unassigned
              rmarting@redhat.com Roman Martin Gil
              RHDH AI
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: