- Home
- MCP servers
- FlexSim
FlexSim
- python
0
GitHub Stars
python
Language
5 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
You can control and automate FlexSim simulations through a dedicated MCP server that launches FlexSim via FlexSimPy. This server exposes a range of tools to open models, run, stop, step through simulations, access and modify node values, evaluate FlexScript, export results, and more, all through an MCP client.
How to use
Interact with an MCP client (such as Claude/Cursor) to send commands to the FlexSim MCP server. You will orchestrate FlexSim models by opening a model, running the simulation to a specific time, stepping through events, querying and setting model values, evaluating scripts, and exporting results. The server can be run in test mode for manual exploration or in standard stdio mode for automated clients.
Typical usage patterns include starting the MCP server, connecting your client, opening a model, running to a target time, querying the current time, and adjusting parameters as needed. You can also evaluate FlexScript, read or modify node values, and export statistics or results for later analysis.
How to install
Prerequisites you need on your system before you begin:
Install a Python 3.12 environment (or use a version specified by your config). Install the UV tooling to manage commands and builds. Ensure a local FlexSim installation or a repo-local mirror is available if you plan real runs.
Follow these concrete steps to set up the MCP server from scratch.
uv sync
uv run python utility/build_automation.py --status
# If you need to force a specific Python version for the FlexSimPy build:
# uv run python utility/build_automation.py --python-version 3.12
uv run mcp_server/flexsim_mcp.py --test-mode
uv run python tests/integration/test_mcp_client.py
Configuration and running modes
Configuration is controlled through a configuration file and environment overrides. The server exposes an HTTP endpoint for MCP access and can also run as a local stdio server for direct client communication.
Environment overrides let you customize paths, Python versions, and logging without editing files directly.
Troubleshooting and notes
If FlexSim cannot be found, adjust the FlexSim install path in the configuration or set the FLEXSIM_INSTALL_PATH environment variable. If FlexSimPy is unavailable, check build status and re-build for your active Python version.
STDIO client issues usually come from running the server in the wrong mode. Use --test-mode only for manual exploration; for stdio clients, run without that flag. Check the log file flexsim_mcp.log for details.
Available tools
flexsim_open_model
Open a FlexSim model from a given path.
flexsim_reset
Reset the current simulation to its initial state.
flexsim_run
Execute the simulation progressively until stopped or a target time is reached.
flexsim_run_to_time
Run the simulation up to a specified target time.
flexsim_stop
Stop the current simulation run.
flexsim_step
Advance the simulation by a single step.
flexsim_get_time
Query the current simulation time.
flexsim_evaluate
Evaluate a FlexScript expression or script.
flexsim_compile
Compile a model or script for execution.
flexsim_save_model
Save the current model state to disk.
flexsim_new_model
Create a new FlexSim model skeleton.
flexsim_get_node_value
Read the value of a specified model node.
flexsim_set_node_value
Set the value of a specified model node.
flexsim_get_statistics
Retrieve runtime statistics for the current model.
flexsim_export_results
Export simulation results to a file.