#16046·LibreChat

[Bug]: Cannot use LIBRECHAT_* variables in MCP that requires authentication

Author: normunds-wipoCreated Sep 17, 2026Updated Sep 17, 2026
Labels🐛 bug

What happened?

I have MCP server that interacts with our Jira. User authenticates and interacts with Jira with their credentials. Now we we want add some caching and map it by conversation. For this we can pass conversation and even message id in header. However this approach fails as we need to authenticate - there is no request body when we do connect/reinitialize, LibreChat fails to retrieve the headers, rejects the connection and the authentication fails before it even starts. This is how we define server in librachat.yaml:

mcpServers:
  jira:
    title: Test Jira
    type: streamable-http
    url: http://localhost:9000/mcp/jira
    requiresOAuth: true
    headers:
      X-LibreChat-Conversation-Id: "{{LIBRECHAT_BODY_CONVERSATIONID}}"
      X-LibreChat-Message-Id: "{{LIBRECHAT_BODY_MESSAGEID}}"

Maybe this is an enhancement request - to allow this combination that fails today, but it feels that it should work.

Version Information

v0.8.7

Steps to Reproduce

Reference LIBRECHAT_* variables for MCP that need authentication, for example

mcpServers:
  jira:
    title: Test Jira
    type: streamable-http
    url: http://localhost:9000/mcp/jira
    requiresOAuth: true
    headers:
      X-LibreChat-Conversation-Id: "{{LIBRECHAT_BODY_CONVERSATIONID}}"
      X-LibreChat-Message-Id: "{{LIBRECHAT_BODY_MESSAGEID}}"

It fails to authenticate as is missing request body in connection requests. It feels that it needs to ignore the missing body, but it does not

What browsers are you seeing the problem on?

No response

Relevant log output

bash
2026-09-17T12:46:07.897Z info: [MCP Reinitialize] Disconnected existing user connection for server: jira {"userId":"667c2df0d252b54605df5636"}
2026-09-17T12:46:07.899Z info: [MCP Reinitialize] getConnection threw error: MCP error -32600: [MCP][User: 667c2df0d252b54605df5636][jira] Request body field(s) required to res... [truncated] {"userId":"667c2df0d252b54605df5636"}
2026-09-17T12:46:07.899Z info: [MCP Reinitialize] OAuth state - oauthRequired: false, oauthUrl: null {"userId":"667c2df0d252b54605df5636"}
2026-09-17T12:46:07.900Z error: [MCP Reinitialize] Error initializing MCP server jira for user: MCP error -32600: [MCP][User: 667c2df0d252b54605df5636][jira] Request body f... [truncated] {"userId":"667c2df0d252b54605df5636"}

Screenshots

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct