comsol-mph-mcp
Drives COMSOL Multiphysics through MPh, enabling model loading and saving, parameter and study inspection, parameter updates, parametric sweeps with convergence tracking, convergence checks, and result export to CSV or JSON.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
comsol-mph-mcp
An MCP server that lets an AI assistant drive COMSOL Multiphysics through the MPh Python library. Aimed at COMSOL 6.2 and 6.4 on Windows, but nothing in the code is Windows-only.
What it solves
Repeating a transient heat-transfer study over several materials, thicknesses
and loads means a lot of clicking, or a pile of one-off scripts. This project
puts the common steps behind a small set of tools: load a model, change
parameters, solve, check whether the solver converged, evaluate expressions,
export data, and run a whole parameter grid with a manifest that records what
happened. It also has helpers for the usual comsolmphserver problems
(port not open, missing login file, memory or convergence errors in the log).
It has no runtime dependencies besides mph, which is optional: an offline
mock backend ships with the package so tests and CI run without a license.
Related MCP server: COMSOL MCP Server
Architecture
MCP client (Claude Desktop, ...) --stdio JSON-RPC--> server.py (ToolRegistry)
|
sweep.py diagnostics.py |
\ | /
backend.py: ComsolBackend
|-- MphBackend (real COMSOL via mph)
`-- MockComsolBackend (offline, deterministic)The server speaks MCP's JSON-RPC 2.0 over stdio directly, so it does not
depend on a particular version of the mcp SDK.
Installation
git clone https://github.com/ai55798-oss/comsol-mph-mcp.git
cd comsol-mph-mcp
python -m venv .venv && . .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e ".[comsol]" # add ,dev for pytestTry it without COMSOL: comsol-mph-mcp --backend mock.
Claude Desktop configuration
{
"mcpServers": {
"comsol": {
"command": "C:\\path\\to\\comsol-mph-mcp\\.venv\\Scripts\\comsol-mph-mcp.exe",
"args": []
}
}
}Use "args": ["--backend", "mock"] to test the wiring first.
Windows setup for COMSOL 6.2 / 6.4
Install COMSOL with a license that allows client-server mode, and install
mph(pip install "mph>=1.2") in the same environment as this package.Run
comsolmphserveronce by hand so it creates your login credentials (%USERPROFILE%\.comsol\v62orv64\login.properties).Either let the tools start a local session (
comsol_connectwithout a host), or start a server and connect to it:.\scripts\start_comsol_mphserver.ps1 -Port 2036 .\scripts\start_comsol_mphserver.ps1 -Port 2036 -TestOnlyThe script keeps preferences, temp files and logs in
.comsol_runtime\inside the repo (git-ignored). Then callcomsol_connectwithhost: "localhost",port: 2036.comsol_statuswithcheck_runtime: truereports whether the port is open and the login file looks sane.
Tools
Tool | Purpose |
| Backend, connection and model state; optional runtime check |
| Start a local session or connect to |
| Close the session |
| Load a |
| Parameters, studies, datasets (and physics/materials on the real backend) |
| Save, optionally to a new path |
| Set global parameters, e.g. |
| Grid sweep with convergence tracking; writes |
| Solve a study and report status, and/or parse a solver log |
| Evaluate expressions to CSV or JSON |
A sweep config looks like examples/heat_transfer_sweep.json: variants
(for example materials), a parameters grid, and outputs expressions.
The offline example needs no license:
python examples/run_example_sweep.py sweep_outputThe mock backend uses a closed-form semi-infinite-solid heat estimate. It is there to exercise the plumbing, not to produce engineering numbers.
Running tests
pip install -e ".[dev]"
pytestRoadmap
Verify
MphBackendagainst more 6.2 and 6.4 models and report what breaks.Mesh-convergence study tool (refine, re-solve, compare an output).
Plot export and selection-based evaluation.
Optional adapter for the official
mcpSDK once its API settles.
License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Inspect, edit, and simulate an open Modeloop control-system model from your coding agent.
Run FDS, OpenFOAM, CalculiX and other engineering simulations on cloudHPC from your AI assistant.
AI-callable calculators and engineering models with real formulas. No hallucinated math.
Build, check, and export parametric CAD models in your ForgeCAD Projects from your AI agent.
Related MCP Servers
- AlicenseBqualityBmaintenanceEnables AI agents to automate multiphysics simulations in COMSOL Multiphysics, covering model management, geometry building, physics configuration, and results visualization. It supports complex simulation workflows through the MCP protocol and includes integrated knowledge retrieval for documentation and troubleshooting.931,036MIT
- AlicenseBqualityCmaintenanceEnables AI agents to automate COMSOL Multiphysics simulations, including model management, geometry building, physics configuration, meshing, solving, and results visualization through the MCP protocol.78MIT
- AlicenseNot gradedqualityNot gradedmaintenanceEnables AI agents to automate COMSOL Multiphysics simulations, including model management, geometry building, physics configuration, meshing, solving, and results visualization via the MCP protocol.MIT
- AlicenseCqualityDmaintenanceEnables AI agents to read and write .mph model files, control the COMSOL desktop GUI in real time, and run complete modeling, meshing, solving, and post-processing workflows.231MIT