LibreChat/packages/api/src/utils
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
..
axios.spec.ts 👁️ feat: Azure Mistral OCR Strategy (#7888) 2025-06-13 15:14:57 -04:00
axios.ts 👁️ feat: Azure Mistral OCR Strategy (#7888) 2025-06-13 15:14:57 -04:00
azure.spec.ts
azure.ts
common.spec.ts
common.ts
env.spec.ts 🏷️ feat: Request Placeholders for Custom Endpoint & MCP Headers (#9095) 2025-08-16 20:45:55 -04:00
env.ts 🏷️ feat: Request Placeholders for Custom Endpoint & MCP Headers (#9095) 2025-08-16 20:45:55 -04:00
events.ts 🕐 feat: Configurable Retention Period for Temporary Chats (#8056) 2025-06-25 17:16:26 -04:00
files.spec.ts
files.ts
generators.ts
http.ts 🔧 refactor: customUserVar Error Normalization (#8950) 2025-08-08 15:53:04 -04:00
index.ts 🔧 refactor: customUserVar Error Normalization (#8950) 2025-08-08 15:53:04 -04:00
key.test.ts 🔑 feat: Base64 Google Service Keys and Reliable Private Key Formats (#8385) 2025-07-10 20:33:01 -04:00
key.ts 🔑 feat: Base64 Google Service Keys and Reliable Private Key Formats (#8385) 2025-07-10 20:33:01 -04:00
llm.test.ts 🤖 feat: Streamline Endpoints to Agent Framework (#8013) 2025-06-23 09:59:05 -04:00
llm.ts 🤖 feat: Streamline Endpoints to Agent Framework (#8013) 2025-06-23 09:59:05 -04:00
math.ts 🕐 feat: Configurable Retention Period for Temporary Chats (#8056) 2025-06-25 17:16:26 -04:00
openid.ts
tempChatRetention.spec.ts 🕐 feat: Configurable Retention Period for Temporary Chats (#8056) 2025-06-25 17:16:26 -04:00
tempChatRetention.ts 🕐 feat: Configurable Retention Period for Temporary Chats (#8056) 2025-06-25 17:16:26 -04:00
tokenizer.spec.ts
tokenizer.ts
yaml.ts 🕐 feat: Configurable Retention Period for Temporary Chats (#8056) 2025-06-25 17:16:26 -04:00