COMSOL MCP Server
Allows AI agents to automate COMSOL Multiphysics simulations, including model management, geometry building, physics configuration, meshing, solving, and results visualization.
Click on "Deploy 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 MCP Server Create a 3D block 10x5x2 mm"
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 MCP Server
MCP Server for COMSOL Multiphysics simulation automation via AI agents.
English | 中文
Star History
Related MCP server: flex-sensor-agent-mcp
Project Goal
Build a complete COMSOL MCP Server enabling AI agents (like Claude, opencode) to perform multiphysics simulations through the MCP protocol:
Model Management - Create, load, save, version control
Geometry Building - Blocks, cylinders, spheres, boolean operations
Physics Configuration - Heat transfer, fluid flow, electrostatics, solid mechanics
Meshing & Solving - Auto mesh, stationary/time-dependent studies
Results Visualization - Evaluate expressions, export plots
Knowledge Integration - Embedded guides + PDF semantic search
Requirements
COMSOL Multiphysics (version 5.x or 6.x)
Python 3.10+ (NOT Windows Store version)
Java runtime (required by MPh/COMSOL)
Installation
# Clone repository
git clone https://github.com/Zhangyoupeng1996/Codex_MCP_Comsol.git
cd Codex_MCP_Comsol
# Install dependencies
python -m pip install -e .
# Test server
python -m src.serverCOMSOL Server Runtime Check
For Windows workstations where the default COMSOL profile directory is not
writable or has stale credentials, start comsolmphserver with workspace-local
runtime folders while keeping COMSOL authentication enabled.
.\scripts\start_comsol_mphserver.ps1 `
-ComsolBin "D:\Software\Comsol6.3\COMSOL63\Multiphysics\bin\win64" `
-Port 2036 `
-User ROG `
-SyncDefaultLoginNotes:
-SyncDefaultLogincopies the local COMSOLlogin.propertieshash into the workspace runtime directory so the Python client and server use the same authenticated CHAP login data.The script intentionally uses
-login auto, not-login never.It writes local runtime state under
.comsol_runtime/; this directory is ignored by Git.
Validate the same Python client path used by the MCP server:
python scripts/test_comsol_connection.py --host localhost --port 2036You should see the COMSOL version and the list of loaded models. A listening
TCP port alone is not sufficient; this direct mph.Client(...) check catches
authentication problems such as Wrong_username_or_password.
For Codex Desktop workspace configuration, migration notes, and safe cleanup of
stale MCP Python processes, see
docs/CODEX_WORKSPACE.md.
Example: Classic Piezoelectric Cantilever
After the COMSOL server is running and the MCP server dependencies are installed, generate a compact piezoelectric cantilever model:
python examples/piezoelectric_cantilever_classic.pyThe script creates a bonded substrate/piezo layer, electrostatic electrodes, a fixed root, a stationary study, and result plot groups for:
electric potential,
electric field norm,
equivalent piezoelectric bending shape,
true solid displacement norm when COMSOL creates the
PiezoelectricEffectcoupling successfully.
Generated .mph files are written to comsol_outputs/, which is ignored by
Git so simulation artifacts do not clutter the MCP source repository.
Building PDF Knowledge Base
The pdf/ and knowledge_base/ directories are intentionally ignored by Git.
Place your local COMSOL documentation PDFs under pdf/, then build the local
knowledge base with the commands below.
# Install additional dependencies
pip install pymupdf chromadb sentence-transformers
# Build knowledge base
python scripts/build_knowledge_base.py
# Check status
python scripts/build_knowledge_base.py --statusUsage
Option 1: With opencode
Create opencode.json in project root:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"comsol": {
"type": "local",
"command": ["python", "-m", "src.server"],
"enabled": true,
"environment": {
"HF_ENDPOINT": "https://hf-mirror.com"
},
"timeout": 30000
}
}
}Option 2: With Claude Desktop
{
"mcpServers": {
"comsol": {
"command": "python",
"args": ["-m", "src.server"],
"cwd": "/path/to/comsol-mcp"
}
}
}Code Structure
comsol_mcp/
├── opencode.json # MCP server config for opencode
├── pyproject.toml # Python project config
├── README.md # This file
│
├── src/
│ ├── server.py # MCP Server entry point
│ ├── tools/
│ │ ├── session.py # COMSOL session management (start/stop/status)
│ │ ├── model.py # Model CRUD + versioning
│ │ ├── parameters.py # Parameter management + sweeps
│ │ ├── geometry.py # Geometry creation (block/cylinder/sphere)
│ │ ├── physics.py # Physics interfaces + boundary conditions
│ │ ├── mesh.py # Mesh generation
│ │ ├── study.py # Study creation + solving (sync/async)
│ │ └── results.py # Results evaluation + export
│ ├── resources/
│ │ └── model_resources.py # MCP resources (model tree, parameters)
│ ├── knowledge/
│ │ ├── embedded.py # Embedded physics guides + troubleshooting
│ │ ├── retriever.py # PDF vector search retriever
│ │ └── pdf_processor.py # PDF chunking + embedding
│ ├── async_handler/
│ │ └── solver.py # Async solving with progress tracking
│ └── utils/
│ └── versioning.py # Model version path management
│
├── scripts/
│ └── build_knowledge_base.py # Build PDF vector database
│
├── client_script/ # Standalone modeling scripts (examples)
│ ├── create_chip_tsv_final.py # Example: Chip thermal model
│ ├── create_micromixer_auto.py # Example: Fluid flow simulation
│ ├── create_chip_thermal*.py # Various chip thermal variants
│ ├── create_micromixer*.py # Various micromixer variants
│ ├── visualize_*.py # Result visualization scripts
│ ├── add_visualization.py # Add plot groups to model
│ └── test_*.py # Integration tests
│
├── comsol_models/ # Saved models (structured)
│ ├── chip_tsv_thermal/
│ │ ├── chip_tsv_thermal_20260216_*.mph
│ │ └── chip_tsv_thermal_latest.mph
│ └── micromixer/
│ └── micromixer_*.mph
│
└── tests/
└── test_basic.py # Unit testsAvailable Tools (80+ total)
Session (4)
Tool | Description |
| Start local COMSOL client |
| Connect to remote server |
| Clear session |
| Get session info |
Model (9)
Tool | Description |
| Load .mph file |
| Create empty model |
| Save to file |
| Save with timestamp |
| List loaded models |
| Set active model |
| Clone model |
| Remove from memory |
| Get model structure |
Parameters (5)
Tool | Description |
| Get parameter value |
| Set parameter |
| List all parameters |
| Setup parametric sweep |
| Get/set description |
Geometry (14)
Tool | Description |
| List geometry sequences |
| Create geometry sequence |
| Add generic feature |
| Add rectangular block |
| Add cylinder |
| Add sphere |
| Add 2D rectangle |
| Add 2D circle |
| Union objects |
| Subtract objects |
| Import CAD file |
| Build geometry |
| List features |
| Get boundary numbers |
Physics (16)
Tool | Description |
| List physics interfaces |
| Available physics types |
| Add generic physics |
| Add Electrostatics |
| Add Solid Mechanics |
| Add Heat Transfer |
| Add Laminar Flow |
| Configure boundary condition |
| Assign material |
| List physics features |
| Remove physics |
| Add coupling |
| Interactive heat BC setup |
| Configure heat boundaries |
| Interactive flow BC setup |
| Generic boundary setup |
Mesh (3)
Tool | Description |
| List mesh sequences |
| Generate mesh |
| Get mesh statistics |
Study & Solving (8)
Tool | Description |
| List studies |
| Solve synchronously |
| Solve in background |
| Get progress |
| Cancel solving |
| Wait for completion |
| List solutions |
| List datasets |
Results (9)
Tool | Description |
| Evaluate expression |
| Evaluate scalar |
| Get time steps |
| Get sweep values |
| Export data |
| Export plot image |
| List export nodes |
| List plot nodes |
Knowledge (8)
Tool | Description |
| Get documentation |
| List available docs |
| Physics quick guide |
| Troubleshooting help |
| Best practices |
| Search PDF docs |
| PDF search status |
| List PDF modules |
Example Cases
Case 1: Chip Thermal Model with TSV
3D thermal analysis of a silicon chip with Through-Silicon Via (TSV).
Geometry: 60×60×5 µm chip, 5 µm diameter TSV hole, 10×10 µm heat source
# Key steps:
# 1. Create chip block and TSV cylinder
# 2. Boolean difference (subtract TSV from chip)
# 3. Add Silicon material (k=130 W/m·K)
# 4. Add Heat Transfer physics
# 5. Set heat flux on top, temperature on bottom
# 6. Solve and evaluate temperature distributionScript: client_script/create_chip_tsv_final.py
Run:
cd /path/to/comsol-mcp
python client_script/create_chip_tsv_final.pyResults: Temperature rise from ambient with heat flux of 1 MW/m²
Case 2: Micromixer Fluid Flow
3D laminar flow simulation in a microfluidic channel.
Geometry: 600×100×50 µm rectangular channel
# Key steps:
# 1. Create rectangular channel block
# 2. Add water material (ρ=1000 kg/m³, μ=0.001 Pa·s)
# 3. Add Laminar Flow physics
# 4. Set inlet velocity (1 mm/s), outlet pressure
# 5. Add Transport of Diluted Species for mixing
# 6. Solve and evaluate velocity profileScript: client_script/create_micromixer_auto.py
Run:
cd /path/to/comsol-mcp
python client_script/create_micromixer_auto.pyResults: Velocity distribution, concentration mixing profile
Model Versioning
Models are saved with structured paths:
./comsol_models/{model_name}/{model_name}_{timestamp}.mph
./comsol_models/{model_name}/{model_name}_latest.mphExample:
./comsol_models/chip_tsv_thermal/chip_tsv_thermal_20260216_140514.mph
./comsol_models/chip_tsv_thermal/chip_tsv_thermal_latest.mphKey Technical Discoveries
1. mph Library API Patterns
# Access Java model via property (not callable)
jm = model.java # NOT model.java()
# Create component with True flag
comp = jm.component().create('comp1', True)
# Create 3D geometry
geom = comp.geom().create('geom1', 3)
# Create physics with geometry reference
physics = comp.physics().create('spf', 'LaminarFlow', 'geom1')
# Boundary condition with selection
bc = physics.create('inl1', 'InletBoundary')
bc.selection().set([1, 2, 3])
bc.set('U0', '1[mm/s]')2. Boundary Condition Property Names
Physics | Condition | Property |
Heat Transfer | HeatFluxBoundary |
|
Heat Transfer | TemperatureBoundary |
|
Heat Transfer | ConvectiveHeatFlux |
|
Laminar Flow | InletBoundary |
|
Laminar Flow | OutletBoundary |
|
3. Client Session Limitation
The mph library creates a singleton COMSOL client. Only one Client can exist per Python process:
# This is handled in session.py - client is kept alive and models are cleared
client.clear() # Clear models instead of full disconnect4. Offline Embedding Model
PDF search supports offline operation with local HuggingFace cache:
# Set mirror for China
export HF_ENDPOINT=https://hf-mirror.comDevelopment Status
Phase | Description | Status |
1 | Basic framework + Session + Model | Done |
2 | Parameters + Solving + Results | Done |
3 | Geometry + Physics + Mesh | Done |
4 | Embedded knowledge + Tool docs | Done |
5 | PDF vector retrieval | Done |
6 | Integration tests | In Progress |
Next Steps
Complete Phase 6 - Full integration test with proper boundary conditions
Visualization Export - Generate PNG images from plot groups
LSP Warnings - Fix type hints in physics.py
More Examples - Add electrostatics, solid mechanics cases
Error Handling - Improve error messages and recovery
Resources
URI | Description |
| Session information |
| Model tree structure |
| Model parameters |
| Physics interfaces |
License
MIT
Available Tools
78 toolscomsol_connectA
Connect to a remote COMSOL server.
Args: port: Port number the COMSOL server is listening on host: Server hostname or IP address (default: 'localhost')
Returns: Connection info or error message
Inputs: port (required), host.
comsol_disconnectA
Disconnect from COMSOL and clear all models from memory.
Returns: Success status and message
Inputs: no named parameters.
comsol_startA
Start a local COMSOL client session.
Args: cores: Number of processor cores to use (default: all available) version: COMSOL version to use, e.g., '6.0' (default: latest installed)
Returns: Session info including version and core count, or error message
Inputs: cores, version.
comsol_statusA
Get the current COMSOL session status.
Returns: Session information including connection status, version, and loaded models
Inputs: no named parameters.
datasets_listB
List all datasets in a model.
Datasets represent solution data that can be evaluated or visualized.
Args: model_name: Model name (default: current model)
Returns: List of dataset names
Inputs: model_name.
docs_getA
Get documentation on a specific topic.
Available topics:
"mph_api": MPh Python API reference
"physics_guide": Physics interfaces and boundary conditions
"workflow": Step-by-step modeling workflows
Args: topic: Documentation topic to retrieve
Returns: Documentation content for the topic
Inputs: topic (required).
docs_listB
List all available documentation topics.
Returns: List of available documentation topics with descriptions
Inputs: no named parameters.
geometry_add_blockB
Add a block (rectangular cuboid) to the geometry.
Args: position: Base position [x, y, z] in meters (default: origin) size: Dimensions [width, depth, height] in meters (default: 1m cube) geometry_name: Geometry sequence name (default: first geometry) component_name: Component name (default: 'comp1') feature_name: Feature name (auto-generated if None) model_name: Model name (default: current model)
Returns: Created block info
Inputs: position, size, geometry_name, component_name, +2 more.
geometry_add_circleB
Add a circle to a 2D geometry or work plane.
Args: position: Center [x, y] in meters radius: Radius in meters (default: 0.5) geometry_name: Geometry sequence name model_name: Model name (default: current model)
Returns: Created circle info
Inputs: position, radius, geometry_name, model_name.
geometry_add_cylinderC
Add a cylinder to the geometry.
Args: position: Center of base [x, y, z] in meters radius: Radius in meters (default: 0.5) height: Height in meters (default: 1.0) geometry_name: Geometry sequence name (default: first geometry) component_name: Component name (default: 'comp1') feature_name: Feature name (auto-generated if None) model_name: Model name (default: current model)
Returns: Created cylinder info
Inputs: position, radius, height, geometry_name, +3 more.
geometry_add_featureB
Add a geometry feature to a geometry sequence.
Common feature types:
Block: Rectangular block (3D)
Cylinder: Cylinder (3D)
Sphere: Sphere (3D)
Cone: Cone (3D)
WorkPlane: Working plane for 2D geometry
Rectangle: Rectangle (2D)
Circle: Circle (2D)
Polygon: Polygon from points
Import: Import CAD geometry
Union, Intersection, Difference: Boolean operations
Args: feature_type: Type of geometry feature (Block, Cylinder, etc.) geometry_name: Geometry sequence name (default: first geometry) feature_name: Name for the feature (auto-generated if None) model_name: Model name (default: current model) **kwargs: Feature-specific properties (position, size, etc.)
Returns: Created feature info
Inputs: feature_type (required), kwargs (required), geometry_name, feature_name, +1 more.
geometry_add_rectangleB
Add a rectangle to a 2D geometry or work plane.
Args: position: Base position [x, y] in meters size: Dimensions [width, height] in meters geometry_name: Geometry sequence name (default: first geometry) component_name: Component name (default: 'comp1') feature_name: Feature name (auto-generated if None) model_name: Model name (default: current model)
Returns: Created rectangle info
Inputs: position, size, geometry_name, component_name, +2 more.
geometry_add_sphereA
Add a sphere to the geometry.
Args: position: Center [x, y, z] in meters radius: Radius in meters (default: 0.5) geometry_name: Geometry sequence name (default: first geometry) component_name: Component name (default: 'comp1') feature_name: Feature name (auto-generated if None) model_name: Model name (default: current model)
Returns: Created sphere info
Inputs: position, radius, geometry_name, component_name, +2 more.
geometry_boolean_differenceB
Create a boolean difference (subtract objects from another).
Args: input_object: Object to subtract from (e.g., 'blk1') objects_to_subtract: Objects to remove (e.g., ['cyl1']) geometry_name: Geometry sequence name (default: first geometry) component_name: Component name (default: 'comp1') feature_name: Feature name (auto-generated if None) model_name: Model name (default: current model)
Returns: Created difference operation info
Inputs: input_object (required), objects_to_subtract (required), geometry_name, component_name, +2 more.
geometry_boolean_unionB
Create a boolean union of geometry objects.
Args: input_objects: Names of objects to unite geometry_name: Geometry sequence name model_name: Model name (default: current model)
Returns: Created union operation info
Inputs: input_objects (required), geometry_name, model_name.
geometry_buildA
Build the geometry sequence to generate the actual geometry.
This must be called after adding/modifying geometry features.
Args: geometry_name: Geometry sequence name (default: build all) component_name: Component name (default: 'comp1') model_name: Model name (default: current model)
Returns: Build status
Inputs: geometry_name, component_name, model_name.
geometry_createA
Create a new geometry sequence in the model's component.
IMPORTANT: A component must exist first. Use model_create_component if needed.
Args: geometry_name: Name for the geometry sequence (default: 'geom1') space_dimension: Space dimension - 2 for 2D, 3 for 3D (default: 3) component_name: Component name (default: 'comp1') model_name: Model name (default: current model)
Returns: Created geometry info
Inputs: geometry_name, space_dimension, component_name, model_name.
geometry_get_boundariesA
Get all boundaries from a geometry with their properties.
Use this to identify which boundary numbers correspond to which faces before setting boundary conditions.
Args: geometry_name: Geometry sequence name (default: first geometry) model_name: Model name (default: current model)
Returns: List of boundaries with their numbers and areas
Inputs: geometry_name, model_name.
geometry_importA
Import geometry from a CAD file.
Supported formats: STEP, IGES, STL, NASTRAN, etc.
Args: file_path: Path to the CAD file geometry_name: Geometry sequence name import_type: Import type (CAD, mesh, etc.) model_name: Model name (default: current model)
Returns: Import operation info
Inputs: file_path (required), geometry_name, import_type, model_name.
geometry_listA
List all geometry sequences in a model.
Args: model_name: Model name (default: current model)
Returns: List of geometry sequence names
Inputs: model_name.
geometry_list_featuresB
List all features in a geometry sequence.
Args: geometry_name: Geometry sequence name (default: first geometry) model_name: Model name (default: current model)
Returns: List of geometry features with their types
Inputs: geometry_name, model_name.
mesh_createA
Run a mesh sequence to generate the mesh.
This executes the meshing operations defined in the mesh sequence.
Args: mesh_name: Mesh sequence name (default: run all mesh sequences) model_name: Model name (default: current model)
Returns: Mesh generation status
Inputs: mesh_name, model_name.
mesh_infoA
Get information about a mesh.
Args: mesh_name: Mesh sequence name (default: first mesh) model_name: Model name (default: current model)
Returns: Mesh statistics including element counts
Inputs: mesh_name, model_name.
mesh_listA
List all mesh sequences in a model.
Args: model_name: Model name (default: current model)
Returns: List of mesh sequence names
Inputs: model_name.
model_cloneA
Clone a model to create a copy for comparison or modification.
Args: model_name: Name of the model to clone (default: current model) new_name: Name for the cloned model (auto-generated if not provided) set_current: Whether to set the clone as current model (default: False)
Returns: Info about the cloned model, or error message
Inputs: model_name, new_name, set_current.
model_createA
Create a new empty COMSOL model.
Args: name: Optional name for the model (auto-generated if not provided) set_current: Whether to set this as the current active model (default: True)
Returns: Model info including name, or error message
Inputs: name, set_current.
model_create_componentA
Create a component in the model (required before adding geometry/physics).
Components are containers for geometry, physics, materials, and mesh. Must be created before adding geometry or physics.
Args: component_name: Name for the component (default: 'comp1') model_name: Model name (default: current model)
Returns: Created component info
Inputs: component_name, model_name.
modeling_best_practicesB
Get best practices for different modeling categories.
Categories:
"geometry": Geometry creation and import
"mesh": Mesh generation strategies
"physics": Physics interface configuration
"solver": Solver configuration and optimization
"results": Results evaluation and visualization
Args: category: Category to get best practices for
Returns: Best practices for the specified category
Inputs: category (required).
model_inspectA
Get detailed information about a model's structure and contents.
Args: model_name: Name of the model to inspect (default: current model)
Returns: Detailed model structure including parameters, physics, studies, etc.
Inputs: model_name.
model_listA
List all models currently loaded in the COMSOL session.
Returns: List of models with their names, file paths, and status
Inputs: no named parameters.
model_list_componentsA
List all components in a model.
Args: model_name: Model name (default: current model)
Returns: List of component names
Inputs: model_name.
model_loadA
Load a COMSOL model from a .mph file.
Args: file_path: Absolute or relative path to the .mph model file set_current: Whether to set this as the current active model (default: True)
Returns: Model info including name, file path, and version, or error message
Inputs: file_path (required), set_current.
model_removeC
Remove a model from memory.
Args: model_name: Name of the model to remove
Returns: Confirmation or error message
Inputs: model_name (required).
model_saveA
Save a COMSOL model to file.
Args: model_name: Name of the model to save (default: current model) file_path: Path to save to (default: original file path) format: Save format - 'Comsol', 'Java', 'Matlab', or 'VBA' (default: Comsol/.mph)
Returns: Save confirmation with file path, or error message
Inputs: model_name, file_path, format.
model_save_versionA
Save a model with a timestamp version suffix.
Creates a new file with structured path: ./comsol_models/{model_name}/{model_name}_{timestamp}.mph
Also saves a 'latest' copy: ./comsol_models/{model_name}/{model_name}_latest.mph
Useful for version control and design iterations.
Args: model_name: Name of the model to save (default: current model) description: Optional description for this version (stored in metadata)
Returns: Save confirmation with versioned file path, or error message
Inputs: model_name, description.
model_set_currentB
Set the current active model for subsequent operations.
Args: model_name: Name of the model to set as current
Returns: Confirmation or error message
Inputs: model_name (required).
multiphysics_addA
Add a multiphysics coupling between physics interfaces.
Common coupling types:
"ThermalStress": Couples Heat Transfer and Solid Mechanics
"FluidStructureInteraction": Couples Fluid Flow and Solid Mechanics
"ElectromechanicalForces": Couples Electrostatics and Solid Mechanics
"JouleHeating": Couples Electric Currents and Heat Transfer
Args: coupling_type: Type of multiphysics coupling physics_list: Names of physics interfaces to couple model_name: Model name (default: current model)
Returns: Created coupling info
Inputs: coupling_type (required), physics_list (required), model_name.
param_descriptionA
Get or set the description of a parameter.
Args: name: Parameter name text: New description text (if None, returns current description) model_name: Model name (default: current model)
Returns: Parameter description, or confirmation of update
Inputs: name (required), text, model_name.
param_getA
Get the value of a model parameter.
Args: name: Parameter name model_name: Model name (default: current model) evaluate: If True, return evaluated numerical value; if False, return expression string
Returns: Parameter value and description, or error message
Inputs: name (required), model_name, evaluate.
param_listB
List all parameters in a model.
Args: model_name: Model name (default: current model) evaluate: If True, return numerical values; if False, return expressions
Returns: Dictionary of all parameters with values and descriptions
Inputs: model_name, evaluate.
param_setA
Set the value of a model parameter.
Args: name: Parameter name value: Parameter value (can include units, e.g., "5[V]", "1.5[mm]") model_name: Model name (default: current model) description: Optional description for the parameter
Returns: Confirmation with new value, or error message
Inputs: name (required), value (required), model_name, description.
param_sweep_setupC
Set up a parametric sweep for a parameter.
Args: parameter_name: Name of the parameter to sweep values: List of parameter values to sweep through model_name: Model name (default: current model) study_name: Study to attach sweep to (default: first study)
Returns: Sweep configuration confirmation, or error message
Inputs: parameter_name (required), values (required), model_name, study_name.
pdf_list_modulesA
List all available COMSOL documentation modules.
Returns: List of module names with file counts
Inputs: no named parameters.
pdf_searchA
Search COMSOL PDF documentation using semantic search.
This searches through the indexed COMSOL documentation (60+ modules) to find relevant information about physics, modeling, and API usage.
Args: query: Search query describing what you're looking for n_results: Number of results to return (default: 5, max: 20) module: Optional module filter (e.g., "CFD_Module", "Heat_Transfer_Module")
Returns: Search results with relevant documentation snippets
Inputs: query (required), n_results, module.
pdf_search_statusA
Get the status of the PDF documentation search system.
Returns: Status information including whether the knowledge base is built, number of indexed documents, and available modules.
Inputs: no named parameters.
physics_addA
Add a physics interface to the model.
Common physics types:
"Electrostatics" or "es": Electrostatic field analysis
"ElectricCurrents" or "ec": Electric current conduction
"SolidMechanics" or "solid": Structural stress analysis
"HeatTransfer" or "ht": Heat transfer in solids
"LaminarFlow" or "spf": Fluid dynamics
Args: physics_type: Type identifier (e.g., "Electrostatics", "es") component_name: Component to add physics to (default: first component) model_name: Model name (default: current model)
Returns: Created physics interface info
Inputs: physics_type (required), component_name, model_name.
physics_add_electrostaticsB
Add Electrostatics physics interface for electric field analysis.
Args: domain_selection: Selection name for domains (default: all domains) model_name: Model name (default: current model)
Returns: Created physics info
Inputs: domain_selection, model_name.
physics_add_heat_transferB
Add Heat Transfer physics for thermal analysis.
Args: domain_selection: Selection name for domains (default: all domains) model_name: Model name (default: current model)
Returns: Created physics info
Inputs: domain_selection, model_name.
physics_add_laminar_flowB
Add Laminar Flow physics for fluid dynamics.
Args: domain_selection: Selection name for domains (default: all domains) model_name: Model name (default: current model)
Returns: Created physics info
Inputs: domain_selection, model_name.
physics_add_solid_mechanicsB
Add Solid Mechanics physics for structural analysis.
Args: domain_selection: Selection name for domains (default: all domains) model_name: Model name (default: current model)
Returns: Created physics info
Inputs: domain_selection, model_name.
physics_boundary_selectionB
Generic boundary condition setup with boundary selection.
Use this tool to configure any boundary condition by specifying:
The physics interface name
The boundary condition type
The boundary numbers to apply the condition to
Properties specific to the boundary condition
Common boundary condition types by physics:
Heat Transfer (ht):
TemperatureBoundary: Set T0 (temperature)
HeatFluxBoundary: Set q0 (heat flux)
ConvectiveHeatFlux: Set h (coefficient), Text (ambient temp)
Laminar Flow (spf):
InletBoundary: Set U0 (velocity)
OutletBoundary: Set p0 (pressure)
Wall: No-slip wall
Solid Mechanics (solid):
Fixed: Fixed constraint
BoundaryLoad: Set Fx, Fy, Fz or FAx, FAy, FAz
Args: physics_name: Name of the physics interface boundary_condition_type: Type of boundary condition boundary_numbers: List of boundary numbers properties: Dictionary of property names and values model_name: Model name (default: current model)
Returns: Configuration confirmation
Inputs: physics_name (required), boundary_condition_type (required), boundary_numbers (required), properties, +1 more.
physics_configure_boundaryB
Configure a boundary condition for a physics interface.
Common boundary conditions for Electrostatics:
"Ground": Zero potential boundary
"ElectricPotential": Specified voltage
"SurfaceChargeDensity": Surface charge
"ZeroCharge": Zero normal displacement field
Common for Solid Mechanics:
"Fixed": Fixed constraint
"Roller": Roller constraint
"Symmetry": Symmetry plane
"BoundaryLoad": Applied force/pressure
Common for Heat Transfer:
"Temperature": Fixed temperature
"HeatFlux": Heat flux boundary
"ConvectiveHeatFlux": Convection cooling
"Symmetry": Symmetry (adiabatic)
Args: physics_name: Name of the physics interface boundary_condition: Type of boundary condition boundary_selection: Boundary/edge numbers to apply condition to properties: Dictionary of property names and values model_name: Model name (default: current model)
Returns: Created boundary condition info
Inputs: physics_name (required), boundary_condition (required), boundary_selection (required), properties, +1 more.
physics_get_availableA
Get a list of available physics interfaces organized by category.
Returns: Dictionary of physics categories and their interfaces
Inputs: no named parameters.
physics_get_guideA
Get a quick guide for a specific physics type.
Available physics types:
"electrostatics": Electric field and capacitance
"heat_transfer": Thermal analysis
"solid_mechanics": Stress and deformation
"fluid_flow": CFD analysis
Args: physics_type: Type of physics to get guide for
Returns: Quick reference guide for the physics type
Inputs: physics_type (required).
physics_interactive_setup_flowB
Interactive setup wizard for Laminar Flow boundary conditions.
This tool helps identify and configure flow boundary conditions:
Lists all available boundaries
Prompts user to select inlet, outlet, and wall boundaries
Configures appropriate boundary conditions
Args: physics_name: Name of the Laminar Flow physics interface model_name: Model name (default: current model)
Returns: Boundary information and setup instructions
Inputs: physics_name, model_name.
physics_interactive_setup_heatC
Interactive setup wizard for Heat Transfer boundary conditions.
This tool helps identify and configure thermal boundary conditions:
Lists all available boundaries
Shows typical boundary condition types for thermal analysis
Provides setup instructions
Args: physics_name: Name of the Heat Transfer physics interface model_name: Model name (default: current model)
Returns: Boundary information and setup instructions
Inputs: physics_name, model_name.
physics_listA
List all physics interfaces defined in a model.
Args: model_name: Model name (default: current model)
Returns: List of physics interface names
Inputs: model_name.
physics_list_featuresC
List all features (boundary conditions, domain settings) in a physics interface.
Args: physics_name: Name of the physics interface model_name: Model name (default: current model)
Returns: List of physics features
Inputs: physics_name (required), model_name.
physics_removeB
Remove a physics interface from the model.
Args: physics_name: Name of the physics interface to remove model_name: Model name (default: current model)
Returns: Removal confirmation
Inputs: physics_name (required), model_name.
physics_set_materialA
Assign a material to physics domains.
Args: physics_name: Name of the physics interface material_name: Name of the material to assign domain_selection: Domain numbers (default: all domains for this physics) model_name: Model name (default: current model)
Returns: Assignment confirmation
Inputs: physics_name (required), material_name (required), domain_selection, model_name.
physics_setup_flow_boundariesA
Setup Laminar Flow boundary conditions with specified boundaries.
This tool configures inlet velocity and outlet pressure boundary conditions for a fluid flow simulation.
Args: physics_name: Name of the Laminar Flow physics interface inlet_boundaries: List of boundary numbers for inlets outlet_boundaries: List of boundary numbers for outlets inlet_velocity: Inlet velocity expression (default: "1[mm/s]") outlet_pressure: Outlet pressure expression (default: "0") model_name: Model name (default: current model)
Returns: Configuration confirmation
Inputs: physics_name (required), inlet_boundaries (required), outlet_boundaries (required), inlet_velocity, +2 more.
physics_setup_heat_boundariesB
Setup Heat Transfer boundary conditions with specified boundaries.
This tool configures thermal boundary conditions for heat transfer simulation:
Heat flux boundaries (heat sources)
Temperature boundaries (heat sinks)
Convective cooling/heating boundaries
Args: physics_name: Name of the Heat Transfer physics interface heat_flux_boundaries: List of boundary numbers for heat flux temperature_boundaries: List of boundary numbers for fixed temperature convection_boundaries: List of boundary numbers for convection heat_flux_value: Heat flux value (default: "1e6[W/m^2]") temperature_value: Temperature value (default: "293.15[K]" = 20°C) convection_coeff: Convection coefficient (default: "10[W/(m^2*K)]") ambient_temp: Ambient temperature for convection (default: "293.15[K]") model_name: Model name (default: current model)
Returns: Configuration confirmation
Inputs: physics_name (required), heat_flux_boundaries, temperature_boundaries, convection_boundaries, +5 more.
results_evaluateC
Evaluate an expression on a solution dataset.
Args: expression: Expression(s) to evaluate, e.g., "es.normE" or ["x", "y", "es.normE"] unit: Desired unit for result, e.g., "V/m", "pF" dataset: Dataset name (default: uses default dataset) inner: For time-dependent solutions: index, 'first', 'last', or list of indices outer: For parametric sweeps: index or list of indices model_name: Model name (default: current model)
Returns: Evaluated values as lists, or error message
Inputs: expression (required), unit, dataset, inner, +2 more.
results_export_dataA
Export data from an export node.
Args: node_name: Export node name (default: run all exports) file_path: Output file path (overrides node setting) model_name: Model name (default: current model)
Returns: Export confirmation with file path
Inputs: node_name, file_path, model_name.
results_export_imageB
Export a plot as an image.
Args: node_name: Plot export node name file_path: Output image path (e.g., "results.png", "field.png") model_name: Model name (default: current model)
Returns: Export confirmation with file path
Inputs: node_name, file_path, model_name.
results_exports_listA
List all export nodes defined in a model.
Args: model_name: Model name (default: current model)
Returns: List of export node names
Inputs: model_name.
results_global_evaluateB
Evaluate a global expression (returns a single scalar value).
Common global expressions include:
Integration: "intop1(T)" where intop1 is an integration operator
Maximum: "maxop1(T)"
Derived values: "2*es.intWe/U^2" for capacitance
Args: expression: Global expression to evaluate unit: Desired unit for result dataset: Dataset name model_name: Model name (default: current model)
Returns: Single numerical value
Inputs: expression (required), unit, dataset, model_name.
results_inner_valuesA
Get inner solution indices and values (time steps in time-dependent study).
Args: dataset: Dataset name (default: default dataset) model_name: Model name (default: current model)
Returns: Arrays of indices and corresponding values (e.g., time values)
Inputs: dataset, model_name.
results_outer_valuesC
Get outer solution indices and values (parameter values in parametric sweep).
Args: dataset: Dataset name (default: default dataset) model_name: Model name (default: current model)
Returns: Arrays of indices and corresponding parameter values
Inputs: dataset, model_name.
results_plots_listA
List all plot nodes defined in a model.
Args: model_name: Model name (default: current model)
Returns: List of plot node names
Inputs: model_name.
solutions_listB
List all solutions in a model.
Args: model_name: Model name (default: current model)
Returns: List of solution configurations
Inputs: model_name.
study_cancelA
Cancel the current solving operation.
Note: The solver may take a moment to respond to cancellation.
Returns: Cancellation status
Inputs: no named parameters.
study_get_progressA
Get the progress of the current solving operation.
Returns: Progress information including status, percentage, and elapsed time
Inputs: no named parameters.
study_listA
List all studies in a model.
Args: model_name: Model name (default: current model)
Returns: List of study names with their types
Inputs: model_name.
study_solveA
Solve a study (synchronous by default).
Args: study_name: Study to solve (None for all studies) model_name: Model name (default: current model) wait: If True, wait for completion; if False, return immediately timeout: Maximum wait time in seconds (only used if wait=True)
Returns: Solution status, or error message
Inputs: study_name, model_name, wait, timeout.
study_solve_asyncA
Start solving a study in the background (asynchronous).
Use study_get_progress to monitor progress and study_cancel to stop.
Args: study_name: Study to solve (None for all studies) model_name: Model name (default: current model)
Returns: Confirmation that solving started, or error message
Inputs: study_name, model_name.
study_waitA
Wait for the current solving operation to complete.
Args: timeout: Maximum time to wait in seconds (None for indefinite)
Returns: Final progress status
Inputs: timeout.
troubleshootB
Get troubleshooting suggestions for common issues.
Common error types:
"geometry_build_failed": Geometry sequence failed to build
"mesh_failed": Mesh generation failed
"solver_no_convergence": Solver did not converge
"memory_error": Out of memory
"license_error": COMSOL license issues
Args: error_type: Type of error encountered context: Additional context about the error
Returns: Troubleshooting suggestions
Inputs: error_type (required), context.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 78 tools
Tools are well-grouped by prefixes (model_, geometry_, physics_, etc.) with distinct actions, but some overlap exists between generic and specific physics adders (physics_add vs physics_add_electrostatics) and between boundary condition setup tools (physics_boundary_selection vs physics_configure_boundary). These overlaps are partially mitigated by detailed descriptions.
All tools follow a consistent verb_noun pattern using snake_case (e.g., model_create, geometry_add_block, physics_add_heat_transfer). No mixed conventions or unpredictable deviations are observed.
With 78 tools, the count is far beyond the typical well-scoped range of 3-15. While COMSOL is a complex domain, this many tools may overwhelm an agent and increase selection difficulty. A more streamlined set focusing on core operations would be preferable.
The tool set covers the full simulation lifecycle: model creation/manipulation, geometry construction (including boolean operations and import), physics setup (multiple interfaces, boundary conditions, materials), meshing, solving (including async and progress tracking), and results evaluation/export. Minor gaps include lack of independent material definition tools beyond physics assignment.
Maintenance
Related MCP Connectors
MCP server for building and testing AI agents with multi-model experimentation and insights.
MCP server for AI dialogue using various LLM models via AceDataCloud
MCP Server for an Agent Task Marketplace
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
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.93959MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server for COMSOL Multiphysics that enables AI agents to perform flexible pressure sensor simulation, including DXF analysis, contact model building, parameter sweeping, and result export using natural language.1MIT
- 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 gradedqualityDmaintenanceEnables AI agents to automate COMSOL Multiphysics simulations, including model management, geometry building, physics configuration, meshing, solving, and results visualization via the MCP protocol.MIT