LibreChat/api/app/clients
Danny Avila d7d02766ea
🏷️ feat: Request Placeholders for Custom Endpoint & MCP Headers (#9095)
* feat: Add conversation ID support to custom endpoint headers

- Add LIBRECHAT_CONVERSATION_ID to customUserVars when provided
- Pass conversation ID to header resolution for dynamic headers
- Add comprehensive test coverage

Enables custom endpoints to access conversation context using {{LIBRECHAT_CONVERSATION_ID}} placeholder.

* fix: filter out unresolved placeholders from headers (thanks @MrunmayS)

* feat: add support for request body placeholders in custom endpoint headers

- Add {{LIBRECHAT_BODY_*}} placeholders for conversationId, parentMessageId, messageId
- Update tests to reflect new body placeholder functionality

* refactor resolveHeaders

* style: minor styling cleanup

* fix: type error in unit test

* feat: add body to other endpoints

* feat: add body for mcp tool calls

* chore: remove changes that unnecessarily increase scope after clarification of requirements

* refactor: move http.ts to packages/api and have RequestBody intersect with Express request body

* refactor: processMCPEnv now uses single object argument pattern

* refactor: update processMCPEnv to use 'options' parameter and align types across MCP connection classes

* feat: enhance MCP connection handling with dynamic request headers to pass request body fields

---------

Co-authored-by: Gopal Sharma <gopalsharma@gopal.sharma1>
Co-authored-by: s10gopal <36487439+s10gopal@users.noreply.github.com>
Co-authored-by: Dustin Healy <dustinhealy1@gmail.com>
2025-08-16 20:45:55 -04:00
..
agents 🔗 fix: File Citation Processing to Use Tool Artifacts 2025-08-13 16:24:21 -04:00
callbacks 🏗️ fix: Agents Token Spend Race Conditions, Add Auto-refill Tx, Add Relevant Tests (#6480) 2025-03-22 17:54:25 -04:00
chains refactor(api): Central Logging 📜 (#1348) 2023-12-14 07:49:27 -05:00
document 📦 fix: npm warnings; chore: bump deprecated packages (#4707) 2024-11-12 18:51:32 -05:00
llm 🧠 feat: User Memories for Conversational Context (#7760) 2025-06-07 18:52:22 -04:00
memory 🎉 feat: Code Interpreter API and Agents Release (#4860) 2024-12-04 15:48:13 -05:00
output_parsers 🖼️ fix: correct image extraction (#3538) 2024-08-04 20:53:11 -04:00
prompts 🧩 fix: Human Message Content Handling for Legacy Content (#8525) 2025-07-17 18:34:24 -04:00
specs 🧪 feat: Claude Sonnet 4 - 1M Context Window (Beta Header) (#9093) 2025-08-16 13:36:46 -04:00
tools 🛂 feat: Role as Permission Principal Type 2025-08-13 16:24:23 -04:00
AnthropicClient.js 📦 chore: Bump Agents Packages (#7992) 2025-06-20 15:49:24 -04:00
BaseClient.js 🏷️ feat: Request Placeholders for Custom Endpoint & MCP Headers (#9095) 2025-08-16 20:45:55 -04:00
GoogleClient.js 🧠 feat: Thinking Budget, Include Thoughts, and Dynamic Thinking for Gemini 2.5 (#8055) 2025-06-25 15:14:33 -04:00
index.js 👤 feat: User Placeholder Variables for Custom Endpoint Headers (#7993) 2025-06-23 12:39:27 -04:00
OllamaClient.js 👁️ feat: Azure Mistral OCR Strategy (#7888) 2025-06-13 15:14:57 -04:00
OpenAIClient.js 🏷️ feat: Request Placeholders for Custom Endpoint & MCP Headers (#9095) 2025-08-16 20:45:55 -04:00
TextStream.js refactor(api): Central Logging 📜 (#1348) 2023-12-14 07:49:27 -05:00