# Origin Pro MCP

> MCP server for controlling OriginLab Origin Pro via COM automation — enables AI assistants to create worksheets, plot graphs, style figures, and run curve fitting

- **Type:** MCP server
- **Install:** `agentstack add mcp-youngminsw-origin-pro-mcp`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [youngminsw](https://agentstack.voostack.com/s/youngminsw)
- **Installs:** 0
- **Category:** [Integrations](https://agentstack.voostack.com/c/integrations)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [youngminsw](https://github.com/youngminsw)
- **Source:** https://github.com/youngminsw/Origin-Pro-MCP

## Install

```sh
agentstack add mcp-youngminsw-origin-pro-mcp
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Origin Pro MCP Server

An MCP (Model Context Protocol) server that enables AI assistants like Claude to control **OriginLab Origin Pro** via COM automation. All operations are reflected in Origin's GUI in real-time — you watch as the AI creates worksheets, plots graphs, and styles figures.

## What Can It Do?

- **Worksheet Management** — Create workbooks, read/write data, import CSV/Excel, export CSV, column formulas, sort, transpose
- **Matrices & 3D** — Matrix books, XYZ gridding, 3D surface/scatter, contour, heatmap, image plots
- **Graph Creation** — Scatter, line, line+symbol, column, bar, area, pie, histogram, contour plots
- **Graph Layers & Axes** — Log scales, dual Y axis, panels, reference lines, text annotations
- **Plot Styling** — Colors, symbols, line width, publication-ready formatting in one call
- **Analysis** — Curve fitting, FFT, smoothing, integration, differentiation, interpolation, peak finding
- **Statistics** — Descriptive stats, two-sample t-test, frequency counts (via the `stats` and `transform` tools)
- **Project Management** — New/save/load projects, export all graphs (with pixel-size control)
- **LabTalk Scripting** — Direct LabTalk execution with destructive/file-overwrite commands blocked

This MCP server is intentionally **Windows-runtime-only**. The AI agent or MCP client can run from Windows or WSL, but the MCP server process that talks to Origin must be launched with Windows Python and `pywin32`. WSL/Linux can edit the project and run non-COM unit tests, but cannot directly control Origin COM.

## Quick Start

### Agentic Setup (read this if you are an AI agent configuring this server)

Copy-paste rules to self-configure the `origin-pro` MCP with zero human steps:

1. **Environment requirement.** This server only works on **Windows** with a licensed **Origin/OriginPro** install and **Windows Python with `pywin32`**. COM automation cannot run from WSL or Linux Python. If the agent runs in WSL, it must launch the **Windows** executable (`uvx.exe` / Windows `origin-pro-mcp`), never WSL Python.
2. **Preferred install path.** Use `uvx` (zero setup) or `pip install origin-pro-mcp`. Both install to a Windows-local location and "just work":
   ```json
   { "mcpServers": { "origin-pro": { "command": "uvx", "args": ["--quiet", "origin-pro-mcp"] } } }
   ```
   From WSL, call `uvx.exe` instead of `uvx` (see Option A below).
3. **Critical UNC rule.** If you point at a **local checkout** from WSL, the repo MUST live under a **Windows drive** (e.g. `C:\Users\YOU\Origin-Pro-MCP`). **Never** reference it through a `\\wsl.localhost\...` UNC path: the background daemon (`python -m origin_pro_mcp.daemon`) cannot resolve a `-m` module or a working directory over UNC, so it fails silently (Origin never opens). `uvx`/`pip install` avoid this entirely.
4. **Discover skills first.** After connecting, call the **`list_skills`** tool to see bundled skills (e.g. `publication-figure`) and when to use each, then **`get_skill(name)`** to load the full step-by-step instructions before producing figures/plots/analysis. No file copying is needed — skills ship inside the package and are exposed by the server.

### 1. Prerequisites

- **Windows** with a licensed Origin/OriginPro installation that exposes the Automation Server
- **Python 3.10+** (Windows Python, not WSL)

Tested environment: **Origin Pro 2020**. Other Origin/OriginPro versions may work if they expose compatible COM Automation Server and LabTalk behavior, but they are not verified by this project yet.

### 2. Install & Configure

**Option A: uvx (recommended — zero setup)**

No manual install needed. The MCP client launches the server for you. Just add this to your Claude Code MCP settings when Claude Code is running on Windows:

```json
{
  "mcpServers": {
    "origin-pro": {
      "command": "uvx",
      "args": ["--quiet", "origin-pro-mcp"]
    }
  }
}
```

`uvx` automatically downloads and runs the server in an isolated environment. Nothing else to install. The `--quiet` flag keeps first-run dependency messages out of your MCP client logs.

If Claude Code or another MCP client is running inside WSL, launch the same Windows server by calling Windows `uvx.exe` directly:

```json
{
  "mcpServers": {
    "origin-pro": {
      "command": "uvx.exe",
      "args": ["--quiet", "origin-pro-mcp"]
    }
  }
}
```

For a local checkout before publishing/installing, point Windows `uvx` at the Windows path of the repo:

```json
{
  "mcpServers": {
    "origin-pro": {
      "command": "uvx.exe",
      "args": ["--quiet", "--refresh", "--from", "D:\\04.Agent OS\\Origin-Pro-MCP", "origin-pro-mcp"]
    }
  }
}
```

Keep the command and args as separate JSON array entries. That avoids quoting problems when a Windows path contains spaces. If WSL cannot find `uvx.exe`, set `command` to the full WSL path for the Windows executable, for example `/mnt/c/Users/YOU/.local/bin/uvx.exe`.

> **WSL users — the package must live on a Windows-local path, not a `\\wsl.localhost\...` (UNC) path.** The server runs a background daemon (`python -m origin_pro_mcp.daemon`); Windows cannot resolve a `-m` module or use a working directory over a UNC path, so launching it from a WSL-filesystem checkout fails silently (Origin never opens and a console window flashes). `uvx`/`pip install` already install to a Windows-local location, so they are unaffected. If you point at a local checkout, **clone it under a Windows drive** (e.g. `C:\Users\YOU\Origin-Pro-MCP`) and reference that path — do not point the MCP config at a repo inside the WSL filesystem.

**Option B: pip install from PyPI**

```bash
pip install origin-pro-mcp
```

Then configure Claude Code:

```json
{
  "mcpServers": {
    "origin-pro": {
      "command": "origin-pro-mcp"
    }
  }
}
```

**Option C: Clone and run directly**

```bash
git clone https://github.com/youngminsw/Origin-Pro-MCP.git
cd Origin-Pro-MCP
pip install -e .
```

```json
{
  "mcpServers": {
    "origin-pro": {
      "command": "origin-pro-mcp"
    }
  }
}
```

> **Note**: If Claude Code runs in WSL, make sure the `uvx` or `python` command points to your **Windows** Python, not WSL Python. Origin COM only works from Windows.

### 3. Origin Startup

You do not need to start Python or Origin manually. The MCP client starts `origin-pro-mcp`, which launches an isolated Origin instance for the session. By default the Origin window is **visible**, so you watch the agent create worksheets and plot graphs in real time.

**Display mode** — set the `ORIGIN_PRO_MCP_VISIBLE` environment variable in your MCP config:

| Value | Mode | Use for |
| :--- | :--- | :--- |
| `1` (default) | **Visible** — Origin window shown | Watching the agent work interactively |
| `0` | **Invisible** — Origin runs hidden | Headless/batch runs, many concurrent agents, no window pop-ups |

```json
{ "mcpServers": { "origin-pro": {
  "command": "origin-pro-mcp",
  "env": { "ORIGIN_PRO_MCP_VISIBLE": "0" }
} } }
```

#### Reliability & recovery (advanced env vars)

The background daemon runs one isolated Origin instance per session. These
environment variables harden it against a wedged Origin COM call (a synchronous
operation that never returns) and against destructive mistakes.
Some default **off**; the wedge/data-safety ones now default **on** because they
are safe (see each row). Set any to `off` to opt out.

| Variable | Default | Effect |
| :--- | :--- | :--- |
| `ORIGIN_PRO_MCP_DISPATCH_TIMEOUT` | `90` | Soft budget (seconds) for each tool dispatch. If Origin doesn't respond within it, a persistent per-session watchdog is polled for the modal dialog that is blocking it: when one is found, the error **names its exact title** and says whether it was already auto-dismissed (retry the call) or is waiting for you to close it by hand; if none is found it falls back to the generic "most likely a modal dialog" message. NOTHING is killed at this stage. Set `off`/`0` to disable. |
| `ORIGIN_PRO_MCP_DISPATCH_KILL_GRACE` | `90` | Grace (seconds) AFTER the soft warning before Origin is **force-killed** as a last resort (so a wedged session can never permanently hold a pool slot). Total time to a hard reset = timeout + grace (default 180s). Set `off`/`0` for no warning phase (legacy: force-kill straight at the soft budget). |
| `ORIGIN_PRO_MCP_DIALOG_AUTODISMISS` | `on` | Every session runs a persistent watchdog that polls (~2s) for modal dialogs owned by its Origin process and records their titles. By **default** it also auto-dismisses (closes) each one it finds, so a startup or mid-session dialog no longer freezes the session. Set to `0`/`off`/`false`/`no` to keep detection and reporting (dispatch-timeout errors still name the dialog) without the daemon closing it — you then close it by hand in the Origin window. |
| `ORIGIN_PRO_MCP_AUTOSAVE` | `on` | Save the project **in place** (its own file, same name — like pressing Save) **before** a destructive op (delete graph/plot, column deletion, project load/new, overwriting a populated sheet, or a `confirm`ed destructive `run_labtalk`), so a bad edit is recoverable by reloading. It never writes a differently-named copy, and never overwrites a real file with an empty/blanked project (N5-safe). Only saves a project that already has a file on disk. Set `off` to disable autosave entirely. |
| `ORIGIN_PRO_MCP_AUTOSAVE_INTERVAL` | `300` | Also save the project **in place** every N seconds (proactive autosave), not just before destructive ops. Applies to agent-isolated sessions with a saved project; the Origin you `ATTACH` to is left to you. `off`/`0` disables periodic autosave (preflight still runs). |
| `ORIGIN_PRO_MCP_AUTOSAVE_REQUIRED` | `1` | When autosave is on and a required *preflight* in-place save fails, the destructive op is **not** run and an error is returned. Set `0` to proceed without saving. |
| `ORIGIN_PRO_MCP_REAP_CLOSE` | `off` | Session lifecycle: by **default** a session ending gracefully (idle / client disconnect) is **detached** — the session's worker thread stops but *your Origin window is left exactly as it was (original save path and unsaved edits intact) so you keep the project*. Set `1` to restore the old save-a-recovery-copy-and-close behavior. (A *wedged* session's Origin is still force-killed — the only way to free a worker stuck in a synchronous COM call.) |
| `ORIGIN_PRO_MCP_SWEEP_ORPHANS` | `off` | By **default** a restarting daemon does **not** kill leftover Origin windows (so a restart never destroys a project you kept open). Set `1` to have startup reclaim leftover Origins (orphan cleanup, at the cost of closing kept windows). |
| `ORIGIN_PRO_MCP_NO_SPAWN` | `off` | Set `1` to stop the shim from auto-respawning the daemon. Use it to shut the daemon down from the process manager and keep it stopped — tool calls then return a clear "daemon not running" error instead of relaunching it. |
| `ORIGIN_PRO_MCP_ATTACH` | `off` | Set `1` so this session **attaches to the Origin you already have open** (the shared `ApplicationSI` instance) instead of spawning a fresh isolated one — the agent then works on your currently-open project. Only **one** session can attach (a second falls back to an isolated instance); other agents keep their own isolated Origins. The attached instance is never force-killed by the daemon (it's yours). |

Per-call override: `run_labtalk(script, confirm=True, timeout=120)` bounds that
one call even when a longer/shorter budget than `ORIGIN_PRO_MCP_DISPATCH_TIMEOUT`
is needed (and works even when the timeout is `off`).

**Rollback:** unset any of these (or set the timeout to `off`) to return to the
prior behavior — no code change or redeploy required.

#### Session lifecycle & restarts

Each MCP client process gets its own daemon session (its own isolated Origin).
Because sessions and the daemon can restart independently, the daemon keeps a
small ledger sidecar (`sessions.json`, next to the private lockfile) recording
each session's last Origin PID and project path. When a **new** session starts,
the daemon reads that ledger once and, on the first successful tool response,
piggybacks a short one-time **`[origin-mcp]` notice** telling the agent what
happened — so it continues the work instead of silently rebuilding into an empty
window. What you may see:

- **Your MCP client restarted (new session).** Your previous Origin window was
  **detached, not closed** (see `ORIGIN_PRO_MCP_REAP_CLOSE`): the notice says it
  is still open with your project and to save/close it in the GUI before
  reloading, or just work in the fresh instance.
- **The daemon restarted and your old Origin is gone.** The notice says your
  project is not loaded and to reopen it with `load_project`.
- **Ghost windows.** Leftover Origins from earlier sessions are preserved by
  default, so they can accumulate. The notice summarizes how many are still open;
  close them in the GUI once saved, or set `ORIGIN_PRO_MCP_SWEEP_ORPHANS=1` so a
  restarting daemon reclaims them.
- **Attach (`ORIGIN_PRO_MCP_ATTACH=1`).** If you got the user's open Origin, the
  notice reminds you that autosave and force-recovery are **disabled** there —
  save explicitly and avoid destructive ops. If another session already holds the
  single attach slot, the notice says you got an isolated Origin instead.

Separately, `load_project` appends a one-line **collision warning** to its result
when the ledger shows another live Origin still holding the same project file
(saving from both would clobber it — close the other first). The notice and the
warning are advisory strings only; they never block a call, and a
missing/corrupt ledger is treated as empty.

### 4. Use It

Just ask Claude to work with Origin:

```
"Create a scatter plot from this data: x=[1,2,3,4,5], y=[2.1,4.0,5.9,8.1,10.0]"
"Apply publication styling to Fig1 with axis labels Temperature (K) and Absorbance (a.u.)"
"Fit a Gaussian to the data in Book1"
"Export all graphs to C:\Users\me\figures\"
```

File paths can be Windows style (`C:\Users\me\fig.png`) or WSL style (`/mnt/c/Users/me/fig.png`) — the server converts WSL paths automatically, so agents running in WSL can pass their native paths.

### Agent Location vs Server Runtime

The agent does not have to run on Windows. These setups are valid:

- Windows agent -> Windows `origin-pro-mcp` server -> Origin Pro
- WSL agent -> Windows `origin-pro-mcp` server -> Origin Pro

The unsupported setup is WSL/Linux `origin-pro-mcp` server -> Origin Pro, because COM is a Windows API.

## Version Support

This project is currently verified only with **Origin Pro 2020**. The implementation uses Origin's COM Automation Server and LabTalk, which exist across multiple Origin releases, so other versions may work. Treat them as unverified until someone runs the test suite and a real graph/export smoke test on that version.

## Direct LabTalk Safety

The `run_labtalk` tool is available by default for styling, analysis, graph tweaks, and other advanced Origin operations. It blocks common destructive or file-writing LabTalk commands such as project reset, delete, save/open, file dialogs, external script execution, and graph export. Use the typed tools for saving, loading, importing, and exporting.

This is an accident-prevention guard, not a security sandbox for untrusted code.

### LabTalk Gotchas (Origin 2020, styling-report fixes)

- **One flag per `set` call.** `set  -c color(255,0,0) -cf color(255,0,0);`
  (combining flags in ONE command) silently wipes the plot to black; the same
  applies to `-k`/`-kf`/`-z` combined (can blank the symbol). Send each flag
  as its own `set  -flag val;` call.
- **Tick-label offset is `layer..label.offsetV` / `.offsetH`** (vertical for
  the x axis, horizontal for y), in % of the tick-label font size, positive =
  toward the axis. The plausible-looking names `.offset`, `.voff`, `.hoff`,
  `.offsetX`/`.offsetY`, `.xOffset`/`.yOffset` are all silent no-ops (they "read
  back" a value but never move the labels). Use `set_t

…

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [youngminsw](https://github.com/youngminsw)
- **Source:** [youngminsw/Origin-Pro-MCP](https://github.com/youngminsw/Origin-Pro-MCP)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-youngminsw-origin-pro-mcp
- Seller: https://agentstack.voostack.com/s/youngminsw
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
