comsol-codex-mcp
Allows AI agents to interact with COMSOL Multiphysics for reproducible batch workflows, including discovering local installations, compiling Java API model scripts, running batch simulations, inspecting logs, searching Java API feature/property names, and collecting lightweight result packages.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@comsol-codex-mcpfind my COMSOL installation"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
COMSOL Codex MCP
An MCP server and agent toolkit for reproducible COMSOL Multiphysics batch workflows.
This project is intentionally generic. It does not encode one specific COMSOL model. Instead, it gives AI agents a safe, auditable way to:
discover a local COMSOL installation;
compile Java API model scripts with
comsolcompile;run compiled classes with
comsolbatch;monitor and diagnose logs;
search COMSOL completion XML for Java API feature/property names;
collect lightweight result packages while excluding
.mph, raw dumps, logs, and generated classes;expose reusable COMSOL automation recipes to Codex/Claude-style agents through MCP tools.
Why This Exists
Several COMSOL MCP projects focus on GUI automation or Python MPh/mphserver workflows. This project focuses on the engineering loop that coding agents often need:
write Java API model -> compile -> batch run -> inspect log -> parse output -> package resultsThat loop is useful for long-running, reproducible simulation jobs where opening COMSOL Desktop is undesirable or impossible.
Related MCP server: comsol-mcp
Install
python -m pip install -e .To run as an MCP server:
python -m pip install -e ".[mcp]"
comsol-mcp-serverTo use the standalone CLI:
comsol-tool find-install
comsol-tool search-feature ThermalContact
comsol-tool inspect-log path/to/batch.logDocumentation
MCP Tools
The server exposes:
Tool | Purpose |
| Locate |
| Compile a COMSOL Java API model |
| Run a compiled class with |
| Read the tail of a log/output file |
| Detect common COMSOL errors and progress markers |
| Search |
| Zip lightweight scripts/summaries/CSV outputs |
| List or remove generated class/status/recovery files |
| List built-in workflow recipes |
| Read a built-in workflow recipe |
Example Agent Workflow
Call
comsol_find_install.Ask the model to generate or modify a Java API script.
Call
comsol_compile.If compilation fails, use the compiler output and
comsol_search_feature.Call
comsol_batchwith a bounded timeout.If the run is slow or fails, call
comsol_inspect_log.Parse model stdout with a project-specific parser.
Call
comsol_collect_outputsto create an uploadable result bundle.
COMSOL Setup
The install finder checks:
COMSOL_HOMECOMSOL_ROOTPATHcommon Windows locations such as
C:\Program Files\COMSOLandE:\Program Files\COMSOLcommon Linux locations such as
/usr/local/comsoland/opt/comsol
If discovery fails, set:
COMSOL_HOME=/path/to/COMSOL63On Windows PowerShell:
$env:COMSOL_HOME = "E:\Program Files\COMSOL\COMSOL63"Safety Model
This toolkit is deliberately conservative:
it uses
subprocess.run([...], shell=False);it keeps compile/run operations explicit;
it separates stdout, stderr, and batch logs;
it excludes heavy/generated files from packages by default;
it provides diagnostics rather than hiding COMSOL failures.
You should still run it only on trusted COMSOL Java scripts. A COMSOL Java class can create, solve, and save models on your machine.
What This Is Not
It is not a replacement for COMSOL Desktop.
It is not a universal physics model generator.
It does not ship COMSOL, licenses, or proprietary documentation.
It does not guarantee that a generated Java API script is physically valid.
Related Work
Existing public projects include GUI-driven COMSOL MCP servers, MPh/mphserver-based MCP servers, and Pythonic COMSOL scripting interfaces. This project aims to complement them with a batch-first, Codex-friendly, reproducible Java API workflow.
Trademark Notice
COMSOL and COMSOL Multiphysics are trademarks or registered trademarks of COMSOL AB. This project is independent and unofficial. See NOTICE.md.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/XiaoSe532/comsol-codex-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server