Skip to content

LibreChat Integration#

LibreChat is the current AI runtime for Critical Manufacturing MES. It provides the runtime in which configured AI Agents can use the tools exposed by their associated MCP Servers and interact with users through the native Ask User tool.

Runtime Synchronization#

Critical Manufacturing MES synchronizes AI Agents, MCP Servers, and their associations with LibreChat. The synchronization runs asynchronously after the relevant definitions are deployed or updated.

After a synchronization completes successfully, the associated MCP Server is available in LibreChat and its tool metadata is updated in MES. The system records runtime metadata, including synchronization status and the most recent tool synchronization.

Ask User#

The native Ask User tool enables an AI Agent to request information or a choice from the user during a conversation. After the user responds, the agent resumes the interaction with the existing conversation context. The tool is available independently of MCP Server configuration after the agent is synchronized with LibreChat.

Configuration Flow#

To make tools available to an AI Agent in LibreChat:

  1. Configure an MCP Server that exposes the required tools.
  2. Associate the MCP Server with a AI Agent.
  3. Configure the prompt behavior through Prompt Configuration.

For system-defined definitions, the required runtime configuration is created during deployment. Do not manually change synchronized tool metadata.

Run Prompts from MES#

Use AIAgent.RunPrompt(string prompt) to call a synchronized AI Agent from MES code, including Dynamic Execution Engine (DEE) actions. Both system-defined and user-defined agents support this method. Wait for the agent to synchronize successfully with LibreChat before calling it.

LibreChat manages chat and API sharing permissions separately. When synchronization creates an agent in LibreChat, MES shares it with everyone for both chat access (agent_viewer) and API access (remoteAgent_viewer). Chat access alone is not sufficient for RunPrompt.

The supplied librechat.yaml configuration and deployment template enable remote-agent use, sharing, and public sharing. Keep use, share, and public enabled under remoteAgents for API access.

MCP Server Connections

If the agent uses MCP Servers, first open a chat with that agent in AI and connect to the required servers before calling RunPrompt from MES. This is a LibreChat limitation.

Authentication#

User-defined MCP Servers can use OAuth Client Secret Basic authentication or API key authentication.

For OAuth authentication, configure the required OAuth client and callback URIs in the Security Portal. For API key authentication, configure the API key fields on the MCP Server.

Do not expose API keys or OAuth client secrets in AI Agent or UI Page definitions.