This repository includes an MCP (Model Context Protocol) server that allows you to generate libEnsemble scripts directly from Cursor IDE (or any MCP client) using AI assistance.
This enables an AI to call the script creator providing fields it has inferred from your discussion.
Node.js is required to run the MCP server. For Example.
Linux (Ubuntu/Debian):
sudo apt install nodejsOther platforms: Download and install from https://nodejs.org/
git clone https://github.com/Libensemble/script-creator.git
cd script-creator
npm installCreate or edit ~/.cursor/mcp.json and add the path to the mcp_server.mjs file:
{
"mcpServers": {
"script-creator": {
"command": "node",
"args": ["</absolute/path/to/script-creator>/mcp_server.mjs"]
}
}
}Important: Replace /absolute/path/to/script-creator/ with the correct path.
Close and reopen Cursor IDE. The MCP server will start automatically.
Once set up, you can ask Cursor's AI assistant to "create libEnsemble scripts" with your parameters. For example:
- "Create libEnsemble scripts using APOSMM generator optimizing two parameters. The executable for each simulation to run is /my/path/test.x and the input file is input.txt. The variables to alter in that file are called dim_x and dim_y. They both have upper and lower bounds of -1 to 1. Create the scripts is a sub-directory called my_run."
The AI will use the CreateLibEnsembleScripts tool to generate libEnsemble scripts including run_libe.py and simf.py. A SLURM or PBS script will be supplied if requested.
See example interactions at #3
- Tool not appearing? Check that the path in
mcp.jsonis absolute and correct - Server errors? Make sure you ran
npm installto install dependencies - Still not working? Go to Cursor Setting and section Tools and MCP for error messages
mcp_server.mjs- The MCP server implementation - in the script_creator root directory.package.json- Node.js dependencies (includes@modelcontextprotocol/sdkandmustache)