Comsol MCP logo

Comsol MCP

Community
777gegewu

非官方 COMSOL MCP 学习项目:通过 Java Shell 控制已打开的 COMSOL Desktop GUI

Publisher777gegewu
Repositorycomsol-mcp
LanguagePython
Forks
9
Stars
122
Available tools
0
Transport typestdio
LicenseMIT
Links
  • Connect tools to AI workflows

    Comsol MCP exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    122 stars and 9 forks from the linked repository.

COMSOL MCP

中文说明

This repository contains an MCP server for controlling an already-open COMSOL Desktop GUI through the COMSOL Java Shell.

This is an unofficial educational project. It is intended for learning, tutorials, and local automation experiments, not as a COMSOL-supported integration.

The server is designed for GUI-visible edits: Codex pastes COMSOL Java API commands into the Java Shell of the currently open COMSOL Desktop model, then executes them with Ctrl+Enter.

Scope

This repository currently publishes only the GUI Java Shell MCP implementation.

COMSOL can also be controlled through the Python mph package in a background workflow, but that implementation is not included here. If you need the background route, keep it as a separate project with its own source ownership and license review.

Requirements

  • Windows
  • COMSOL Desktop 6.3 or newer
  • COMSOL Desktop and the target model already open
  • Java Shell visible

Automatic ribbon clicking is disabled by default because localized COMSOL ribbon automation can trigger COMSOL UI errors.

Setup

powershell
.\setup_venv.ps1

Optional local settings:

powershell
Copy-Item .\env.local.example .\env.local

Run

powershell
.\start_server.ps1

Codex global config should point mcp_servers.comsol_gui to:

  • E:\AgentCOMSOL\AgentCOMSOL-main\comsol-gui-mcp\.venv\Scripts\python.exe
  • E:\AgentCOMSOL\AgentCOMSOL-main\comsol-gui-mcp\server.py

MCP Tools

  • gui_status() lists COMSOL GUI processes/windows and whether Java Shell is visible.
  • ensure_java_shell() finds Java Shell and returns a manual action if it is not visible.
  • execute_java_shell(code, allow_non_model_code=false, timeout_sec=30) pastes commands and executes them with Ctrl+Enter.
  • set_global_parameter(name, value, description=null) sets a global parameter through Java Shell.
  • get_java_shell_output() tries to read visible Java Shell text through UI Automation.

Safe Command Policy

By default, execute_java_shell only accepts non-empty executable lines that start with model.. Use allow_non_model_code=true only when you intentionally need broader Java Shell commands. execute_java_shell rejects COMSOL save calls such as model.save(...) and ModelUtil.save(...); GUI edits should be verified through the MCP and then saved manually by the user in COMSOL Desktop.

First Validation

  1. Open COMSOL Desktop and a test model.
  2. Open Home > Windows > Java Shell.
  3. Call gui_status().
  4. Call set_global_parameter("codex_gui_mcp_probe", "1").
  5. Confirm the parameter appears in the GUI.
  6. Clean up with execute_java_shell("model.param().remove(\"codex_gui_mcp_probe\");").

Notice

This is not an official COMSOL project and is not affiliated with, endorsed by, or supported by COMSOL AB. COMSOL product names and trademarks belong to their respective owner.

The code is provided for learning and tutorial use under the MIT License. Use it with local test models first, and review generated Java API commands before applying them to important COMSOL models.

Use Comsol MCP MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once Comsol MCP is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. This MCP runs locally through the TypingMind MCP connector on your device.

Setup guide to use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add Comsol MCP as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the Comsol MCP MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "comsol-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the Comsol MCP MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the Comsol MCP MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use Comsol MCP to help me with this task?
Comsol MCP
Sure. I read it.
Here is what I found using Comsol MCP.

Frequently asked questions

What is the Comsol MCP MCP server used for?

Comsol MCP is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use Comsol MCP MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use Comsol MCP with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use Comsol MCP MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With Comsol MCP connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect Comsol MCP MCP to TypingMind?

Comsol MCP runs through the TypingMind local MCP connector. This is best when the MCP server needs access to local files, desktop apps, command-line tools, or private resources on your computer.

What tools does Comsol MCP MCP provide in TypingMind?

Comsol MCP exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use Comsol MCP MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If Comsol MCP requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇