Mathcad 15 MCP Server
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.
Mathcad 15 MCP Server
An MCP server (stdio transport) for driving Mathcad 15 from an LLM: set input variables, recalculate, read results, inspect regions, diagnose errors, save/export worksheets. Windows + Python 3.10+ (developed and verified on 64-bit Python 3.14.3).
Quick start (Windows)
cd C:\Users\Nighty\Desktop\MathCadMCP
.\.venv\Scripts\pip.exe install -r requirements.txt
.\.venv\Scripts\pip.exe install -e .
# Check without the MCP protocol (COM thread + live Mathcad):
.\.venv\Scripts\python.exe scripts\test_manager.py
# Unit + protocol:
.\.venv\Scripts\python.exe -m pytest tests\test_converters.py tests\test_schemas.py tests\test_protocol_smoke.py -q
# Live (requires a running Mathcad 15):
.\.venv\Scripts\python.exe -m pytest tests\test_live.py -q -m liveManual server start: scripts\smoke.ps1 (it will hang waiting on stdio — that is expected).
Related MCP server: root-ext-cad
Client configuration
opencode (opencode.json, already in the repo root)
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"mathcad15": {
"type": "local",
"command": ["C:\\Users\\Nighty\\Desktop\\MathCadMCP\\.venv\\Scripts\\python.exe", "-m", "mathcad_mcp.server"],
"cwd": "C:\\Users\\Nighty\\Desktop\\MathCadMCP",
"environment": {
"PYTHONPATH": "C:\\Users\\Nighty\\Desktop\\MathCadMCP\\src",
"MATHCAD_ATTACH_ONLY": "1",
"MATHCAD_MCP_LOG": "INFO"
},
"timeout": 310000,
"enabled": true
}
}
}Restart opencode after editing the config (it is loaded once at startup).
timeout: 310000 matters: recalculate may run for up to 300 s.
Claude Desktop / other MCP clients (mcp.json)
{
"mcpServers": {
"mathcad15": {
"command": "C:\\Users\\Nighty\\Desktop\\MathCadMCP\\.venv\\Scripts\\python.exe",
"args": ["-m", "mathcad_mcp.server"],
"cwd": "C:\\Users\\Nighty\\Desktop\\MathCadMCP",
"env": {
"PYTHONPATH": "C:\\Users\\Nighty\\Desktop\\MathCadMCP\\src",
"MATHCAD_ATTACH_ONLY": "1",
"MATHCAD_MCP_LOG": "INFO"
}
}
}
}Environment variables
Variable | Default | Description |
|
|
|
| (untouched) |
|
|
|
|
|
| connect timeout |
| — | base for relative paths |
| — |
|
|
| cap + |
|
| scan cap |
|
| connect at server startup |
|
| (reserved; |
|
| dangerous: bypasses |
|
|
|
| — | path to 32-bit Python for complex input (see below) |
|
| bridge call timeout |
CLI flags (--attach-only/--no-attach-only, --visible/--no-visible,
--timeout-s, --log-level, --auto-connect/--no-auto-connect)
override the environment. Booleans accept 1/0, true/false, yes/no, on/off.
Example session
status() -> connected, Mathcad 14.1.5.594
open_worksheet(path="C:/docs/calc.xmcd") -> {name, fullname, ...}
set_value(name="F", value=10) -> {name: "F"}
recalculate() -> {recalculated: ...}
get_value(name="Smax") -> {type: "real", real: 25.0, as_string: "25"}
batch_compute(inputs={"F": 15}, outputs=["Smax"]) -> {applied_inputs, outputs, recalculated}See also examples/demo_script.py (cleans up after itself via VT_NULL).
Listing variables and units
list_variables() parses math-region XML (<define> per Math10.xsd) and
returns defined names with kind (variable/function) and region index.
get_value() additionally reports unit (e.g. "m*s^-1") rendered from the
defining region's UnitsXML — null when the region has no interface or units
(old/protected sheets).
Complex input via the 32-bit bridge (optional)
64-bit Python cannot construct Mathcad.NumericValue, so
set_value(name="z", value={"real": 3, "imag": 4}) needs a helper:
Install a 32-bit Python (e.g. 3.12 32-bit) and
pywin32into it.Set
MATHCAD_BRIDGE_PYTHON=C:\Python312-32\python.exe.Complex scalars and complex matrices are then written through
scripts/com_bridge_main.py(own process, same live Mathcad viaGetActiveObject); results read back normally withReal/Imag.
Without the bridge, complex input returns UNSUPPORTED_OPERATION.
Demo sheet for full live checks (create manually, 2 minutes)
The Automation API cannot create math regions, so this file is created once
by hand in Mathcad 15 and saved as examples\beamdef_demo.xmcd:
F := 10Smax := F * 2.5M := [[1, 2], [3, 4]](2×2 matrix via the matrix operator)Save as
examples\beamdef_demo.xmcd.
Without it, live tests run in round-trip mode on a copy of the stock
Handbook\datapack\basics.xmcd; with it, they additionally verify the
computation F=10 → Smax=25.
Known limitations (empirically confirmed)
Complex INPUT from 64-bit Python needs the bridge (
UNSUPPORTED_OPERATIONwithout it):Mathcad.NumericValue/MatrixValue/StringValueare 32-bit in-proc objects (automation.dll→CLASS_E_CLASSNOTAVAILABLE). WithMATHCAD_BRIDGE_PYTHONset, complex scalars/matrices work. Reading complex values (Real/Imag) always works.Top/bottom binding:
SetValuebinds at the top of the sheet,GetValuereads the bottommost definition; redefinitions in the sheet shadow the input.Units cannot be passed via Automation (per the VB sample notes in DevRef);
AsStringmay carry units and locale formatting (,vs.) — it is never parsed as a number.Editing formulas/regions is impossible via the Automation API.
Sheets with protected/scripted regions (e.g. DiffTool fixtures) may reject
GetValueforSetValuebindings — use ordinary sheets.Variable listing (
list_variables) only sees regions exposingMathInterface(fresh math regions); old/protected sheets yield[].Collections and matrices are 0-based (empirical + DevRef
GetElement); the outer API is 0-based everywhere.No UI: format pickers (
mcPromptUser=1is forbidden), interactive handbooks, modal dialogs — the server never triggers them.MCP SDK: uses the installed
mcp==2.2.0(MCPServer,run_stdio_async). The separate PyPI packagefastmcpis NOT required and NOT installed (different project, would conflict withmcpv2).
Safety
save_optiononly0/2;1(prompt) is rejected by validation.Closing an unsaved sheet without
confirm_discard=trueis refused; nothing is closed.Quit()on a foreign process only withforce=true.Overwrite via
save_as/export: existing file →.bak-<timestamp>, then size > 0 is verified.Paths: absolute,
~expanded,MATHCAD_ALLOWED_DIRSjail, open restricted to.xmcd/.mcd/.xmcdz/.xmct; handbooks are refused by Mathcad itself.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
Related MCP Connectors
Use your Mac, Windows or Linux computer from ChatGPT, Claude or Codex: files, commands, documents.
Your own computer's files from ChatGPT or Claude: folder rules, confirmations and undo.
Unofficial Math.js MCP — wraps the mathjs.org API (free, no auth)
Manage SysML2 projects; check, evaluate, verify, query, document and diagram models.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to automate SolidWorks (open/save parts, modify dimensions, export STEP) via COM, and optionally generate geometry using build123d code-CAD with PNG previews.MIT
- FlicenseAqualityBmaintenanceCAD-engineering MCP tool server for parametric modeling, DFM validation, mechanical calculations, and more. Enables code-CAD builds (build123d/CadQuery), model inspection, meshing, and mechanical calculators via MCP stdio.11-
- AlicenseAqualityDmaintenanceA stdio MCP server that gives LLMs a safe scientific calculator with infix math, complex numbers, matrices, statistics, unit conversions, and more via tools that return JSON.331MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI hosts to interact with a browser CAD workbench through model-neutral local stdio or authenticated remote MCP tools, supporting command discovery, design-health analysis, and scoped previews while never reading local files or taking over open sessions.MIT