How can I connect an AI server and OPAL-RT

Does anyone know how to connect AI server and OPAL-RT?
The AI server can be modeled as a AI server and the work load profie can be transfer to OPAL-RT.

For AI integration with RT-LAB, the most practical approach would likely be for the customer to build an MCP server on top of the RT-LAB Python API.

For example, the customer could use FastMCP 2.0 to implement the server. The MCP server would expose the relevant RT-LAB API operations as tools that an AI agent can call. These tools could cover operations such as:

  • Loading or opening an RT-LAB project
  • Building and executing a model
  • Starting, pausing, or stopping a simulation
  • Reading and modifying model parameters
  • Retrieving signals, results, logs, and simulation status
  • Handling common RT-LAB errors

It may not be necessary to expose every Python API function immediately. A good starting point would be to implement the operations required by the customer’s main use cases, then add more tools as needed. An AI coding agent could help generate much of the initial MCP server code from the RT-LAB Python API documentation, although the generated tools would still need to be reviewed and tested.

Once the MCP server is ready, the customer can configure it in an MCP-compatible AI environment, such as Claude Desktop or Visual Studio Code with a compatible AI extension. The AI agent would then be able to interact with RT-LAB through the tools exposed by the server.

The implementation should be relatively straightforward, provided that the required RT-LAB operations are available through its Python API. However, the customer should also consider access control, input validation, error handling, logging, and safeguards for operations that could modify or stop a running simulation.

Please note that, to the best of our knowledge, an official MCP server for RT-LAB is not currently available. The customer would therefore need to develop and maintain this integration.

@PFA007 Thank you for your help.

Do you have any user case or example which I can refer?

Hi,

Yes, connecting an AI server to OPAL-RT is feasible and is a use case we’re actively seeing in the field. As PFA007 mentioned, the MCP server approach built on top of the RT-LAB Python API is the recommended path today.

General architecture pattern:

AI Server — runs your AI/ML workload (inference, optimization, control decisions)

Communication layer — Python API calls or a protocol bridge (e.g., MCP via FastMCP) exposing RT-LAB operations as callable tools

OPAL-RT Simulator — receives commands and sends back signals/measurements in real time

Typical operations exposed:

Load/open a project

Build and execute a model

Read signals and simulation status

Modify parameters in real time

Start/stop/pause simulation

Common application patterns:

AI workload profiles (e.g., GPU cluster demand) transferred to the simulator for power infrastructure validation

AI-based controllers sending commands back to a running real-time model

Automated test orchestration driven by an AI agent

Regarding specific use cases or reference examples: we do have validated implementations, but details depend on the specific application and setup. I’d recommend contacting the OPAL-RT Support Center- they can discuss your particular requirements and connect you with the right resources for your project.

You can reach them here: Support Center | Access Technical Help and System Resources | OPAL-RT