MathCAD Prime MCP server

Integrates with PTC MathCAD Prime through the MathcadPy library, enabling worksheet management, input/output manipulation, and calculation control for engineering and scientific workflows.
Back to servers
Setup instructions
Provider
hvkshetry
Release date
Mar 26, 2025
Language
Python
Stats
1 star

This MCP server provides integration with PTC MathCAD Prime, allowing AI assistants like Claude to interact with MathCAD worksheets through a standardized interface. Using this server, you can open, manipulate, and extract data from MathCAD worksheets directly through your AI assistant.

Requirements

  • Windows operating system (required for MathCAD COM automation)
  • Python 3.10 or higher
  • PTC MathCAD Prime 3.0 or higher installed
  • Dependencies: MathcadPy, pywin32, and MCP Python SDK (see requirements.txt)

Installation

Quick Installation with Claude Desktop

  1. Install the required dependencies:

    pip install -r requirements.txt
    
  2. Run the installation script:

    python install_standalone.py
    

    Options:

    • Use --hide flag to hide the MathCAD window when running:
      python install_standalone.py --hide
      
  3. Restart Claude Desktop for the changes to take effect.

Manual Configuration

Edit your Claude Desktop configuration file:

  • Mac: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "mathcad": {
      "command": "python",
      "args": [
        "path/to/mathcad-mcp/standalone.py"
      ],
      "env": {
        "MATHCAD_VISIBLE": "true"
      }
    }
  }
}

Using the MCP Server

Available Tools

The server provides these tools for interacting with MathCAD:

Worksheet Management

  • list_mathcad_version: Get the running MathCAD version
  • open_worksheet: Open a MathCAD worksheet from a file path
  • close_worksheet: Close a specific worksheet
  • close_all_worksheets: Close all open worksheets
  • quit_mathcad: Quit the MathCAD application entirely
  • save_worksheet: Save a worksheet to a specified path and format
  • save_worksheet_inplace: Save the worksheet in place
  • activate_worksheet: Bring a worksheet to the front

Input Management

  • set_real_input: Set a numerical input with optional units
  • set_string_input: Set a string input
  • set_matrix_input: Set a matrix input with optional units
  • get_input: Retrieve the current value of a designated input
  • get_matrix_input: Retrieve the current value of a designated matrix input

Calculation Control

  • calculate_worksheet: Recalculate a worksheet
  • sync_worksheet: Alias for calculating the worksheet
  • pause_calculation: Pause worksheet calculation
  • resume_calculation: Resume worksheet calculation

Output Access

  • get_output: Get a designated output value (real, string, or matrix)
  • get_real_output: Get a numerical output value from a worksheet
  • get_real_output_with_units: Get a numerical output with conversion to specified units
  • get_matrix_output: Get a matrix output from a worksheet
  • get_matrix_output_with_units: Get a matrix output with unit conversion

Export Functionality

  • save_as_pdf: Save the worksheet as a PDF file (Mathcad Prime 5+ only)
  • save_as_rtf: Save the worksheet as an RTF file
  • save_as_xps: Save the worksheet as an XPS file

Status Checks

  • is_worksheet_readonly: Check if a worksheet is read-only
  • is_worksheet_modified: Check if a worksheet has unsaved changes
  • set_worksheet_modified: Force-set the 'modified' status of a worksheet

Available Resources

The server exposes these resources to query worksheet information:

  • mathcad://worksheets: List all open worksheets
  • mathcad://worksheets/paths: List worksheets with full file paths
  • mathcad://worksheet/{worksheet_name}/inputs: List inputs in a worksheet
  • mathcad://worksheet/{worksheet_name}/outputs: List outputs in a worksheet
  • mathcad://worksheet/{worksheet_name}/output/{output_name}: Get a specific output value
  • mathcad://worksheet/{worksheet_name}/output/{output_name}/matrix: Get a matrix output
  • mathcad://worksheet/{worksheet_name}/output/{output_name}/with_units/{units}: Get an output with units conversion
  • mathcad://worksheet/{worksheet_name}/info: Get information about a worksheet
  • mathcad://worksheet/{worksheet_name}/status: Get the status of a worksheet

Example Workflows

Physics Problem Solving

1. Open an existing MathCAD worksheet:
   "Can you open my physics worksheet at C:\Users\username\Documents\Physics\projectile_motion.mcdx?"

2. Set input parameters:
   "Set the initial velocity to 50 m/s and the launch angle to 30 degrees."

3. Calculate the results:
   "Now calculate the trajectory and show me the maximum height and distance."

4. Extract output values:
   "What's the maximum height reached by the projectile?"

Engineering Analysis

1. Open or create a worksheet for analysis:
   "I need to analyze a beam deflection problem. Can you open the structural_analysis.mcdx worksheet?"

2. Configure the worksheet:
   "Set the load P to 5000 N, beam length L to 2 m, Young's modulus E to 200 GPa, and moment of inertia I to 4×10⁻⁶ m⁴."

3. Run the calculation:
   "Calculate the worksheet and tell me the maximum deflection."

4. Export the results:
   "Save the worksheet as a PDF so I can include it in my report."

Configuration Options

Environment Variables

  • MATHCAD_VISIBLE: Set to "true" to show the MathCAD application window (default), or "false" to hide it.

Troubleshooting

COM Automation Errors

If you encounter COM automation errors:

  • Ensure MathCAD is installed and properly licensed
  • Check that you're running on Windows
  • Try restarting MathCAD and the MCP server

Worksheet Not Found

If worksheets can't be found:

  • Use absolute paths, not relative paths
  • Ensure file paths are correctly escaped
  • Verify the file exists and is a valid .mcdx file

Unit Conversion Issues

If unit conversion fails:

  • Check for compatibility between units (e.g., length can't convert to mass)
  • Ensure that the right unit symbols are used (e.g., 'm' for meters)
  • Try using standard unit formats (e.g., 'm/s' instead of 'm*s^(-1)')

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "mathcad" '{"command":"python","args":["path/to/mathcad-mcp/standalone.py"],"env":{"MATHCAD_VISIBLE":"true"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "mathcad": {
            "command": "python",
            "args": [
                "path/to/mathcad-mcp/standalone.py"
            ],
            "env": {
                "MATHCAD_VISIBLE": "true"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "mathcad": {
            "command": "python",
            "args": [
                "path/to/mathcad-mcp/standalone.py"
            ],
            "env": {
                "MATHCAD_VISIBLE": "true"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later