convez.ai
MCP ServerAutomaçãoAvançado
youngminsw

Origin Pro MCP Server

youngminsw/Origin-Pro-MCP

Automação de Origin Pro para análise e visualização de dados via IA

Ver no GitHub
BomPluginScore · de 0 a 100

Servidor MCP que permite assistentes de IA controlar OriginLab Origin Pro via automação COM, criando planilhas, gráficos e executando análises de dados em tempo real. Suporta gerenciamento de worksheets, plotagem avançada, curve fitting, estatísticas e exportação de projetos com interface gráfica refletindo todas as operações.

Instalação

$npx convez-ai youngminsw/Origin-Pro-MCP

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
50
Forks
3
Acompanhando
0
Saúde
42%
Último commit
há 4 meses
Versão
—
Issues abertas
0
Contribuidores
1

Casos de uso

  • Criação automatizada de gráficos e visualizações científicas
  • Processamento e análise de dados com curve fitting e estatísticas
  • Automação de workflows de pesquisa e engenharia com IA
  • Exportação programática de projetos e relatórios

Veredito

Ferramenta especializada e robusta para automação de Origin Pro via IA em ambiente Windows. Ideal para pesquisadores e engenheiros que precisam integrar análise de dados complexa com assistentes de IA, mas limitada ao ecossistema Windows com requisito de licença Origin.

README

A tradução para o português deste README ainda está na fila.

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
  • 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

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:

{
  "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:

{
  "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:

{
  "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.

Option B: pip install from PyPI

pip install origin-pro-mcp

Then configure Claude Code:

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

Option C: Clone and run directly

git clone https://github.com/youngminsw/Origin-Pro-MCP.git
cd Origin-Pro-MCP
pip install -e .
{
  "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, and the server connects to Origin through Origin.ApplicationSI. If Origin is already open, the server uses it; otherwise COM launches Origin and the server makes it visible.

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.

Architecture

Claude Code (WSL or Windows)
    |  stdio (MCP protocol)
    v
MCP Server (Windows Python + win32com)
    |  COM automation
    v
Origin Pro (GUI visible in real-time)

Direct CLI (no MCP client)

Every MCP tool is also a plain command, so the repo alone can drive Origin — no MCP client, no per-task scripts. Same Windows-runtime rule applies (Windows Python + pywin32 + Origin).

# List all tools with their arguments
python -m origin_pro_mcp.cli list

# Call any tool: simple flags...
python -m origin_pro_mcp.cli list_worksheets
python -m origin_pro_mcp.cli apply_publication_style --graph_name Fig1

# ...or --json for values with spaces/paths (recommended for scripting)
python -m origin_pro_mcp.cli apply_publication_style --json '{"graph_name": "Fig1", "x_label": "Temperature (K)"}'
python -m origin_pro_mcp.cli export_graph --json '{"graph_name": "Fig1", "file_path": "/mnt/c/Users/me/fig1.png"}'

After pip install (or via uvx) the same is available as the origin-pro-cli command, e.g. origin-pro-cli list_worksheets.

Running a WSL agent? Invoke Windows Python with the package on the path, for example from the repo's src/ directory:

cd src && /mnt/c/.../python.exe -m origin_pro_mcp.cli list_worksheets

The CLI reflects over the same tool registry as the MCP server, so it always exposes exactly the tools listed below.

Available Tools (56 total)

Project Management

ToolDescription
new_projectCreate new empty Origin project
save_graph_templateSave a graph as a reusable .otpu/.otp template
save_projectSave project to .opju file
load_projectOpen existing .opj/.opju file

Worksheet Data

ToolDescription
create_worksheetCreate new workbook
set_worksheet_dataWrite column data (JSON arrays)
get_worksheet_dataRead worksheet data as JSON
import_csv_to_worksheetImport CSV/text file
import_excelImport an .xls/.xlsx file
export_worksheetExport a worksheet to CSV/text
list_worksheetsList open workbooks, graphs, and matrices
set_column_formulaFill a column from a formula of other columns
set_column_propertiesSet long name, units, comment, designation
sort_worksheetSort rows by a column (asc/desc)
add_columns / delete_columnsAdd or remove columns
transpose_worksheetTranspose rows and columns

Matrix

ToolDescription
create_matrixCreate a matrix book
set_matrix_data / get_matrix_dataWrite / read a 2D grid
worksheet_to_matrixGrid scattered XYZ into a matrix (xyz2mat)
create_matrix_plotSurface (3D), contour, heatmap, or image from a matrix (with a data-linked color scale)

Graphing

ToolDescription
create_graphCreate graph (scatter, line, line+symbol, column, bar, area, pie, histogram, box, contour, 3d_scatter)
add_plot_to_graphAdd another dataset to an existing graph
add_second_y_axisAdd a right-Y layer and plot on it
add_layerAdd a panel/axis layer (right-y, top-x, inset)
set_axis_labelsSet X/Y axis labels and title
set_axis_rangeSet axis min/max values
set_axis_scaleLinear / log10 / ln / log2 scale
add_reference_lineHorizontal/vertical line at a value
add_lineStraight line between two data points
add_arrowSingle/double-headed arrow between two points
apply_color_mapApply a colormap; bundles viridis/cividis/plasma/inferno/magma (colorblind-safe) plus Origin built-ins
set_colormap_levelsSet the Z color-scale range
add_text_annotationPlace a text label at data coordinates
export_graphExport via clipboard (page size)
export_graph_sizedExport at a chosen pixel width/height
export_all_graphsExport every graph in the project

export_graph uses Origin's clipboard copy (size follows the page setup). export_graph_sized uses expGraph for direct pixel control.

Styling

ToolDescription
apply_publication_styleOne-call publication formatting (recommended)
set_plot_styleSet color, symbol, line width per plot
set_graph_fontSet font family and size
set_legendConfigure legend text and position
set_tick_styleSet tick direction and length

Analysis

ToolDescription
curve_fitCurve fitting: parameters ± std errors, R², SSR, reduced χ²; optional plot_on_graph
list_fitting_functionsShow available fit functions
integrateArea under the curve
differentiateDerivative dY/dX into a new column
smoothSavitzky-Golay / adjacent / binomial smoothing
interpolateResample onto evenly spaced X (linear/spline/bspline/akima)
fftForward FFT + dominant frequency
find_peaksPeak positions and heights

Statistics

ToolDescription
column_statisticsmean, sd, se, variance, median, min, max, sum, n
compare_meansTwo-sample t-test (t, df, p, means)
frequency_countBinned histogram counts

Advanced

ToolDescription
run_labtalkExecute LabTalk with destructive/file-writing commands blocked
get_labtalk_variableRead a LabTalk variable value

Example: Publication-Quality Figure

# 1. Start fresh
new_project()

# 2. Create data
create_worksheet(book_name="Data")
set_worksheet_data(
    book_name="Data", sheet_name="Sheet1",
    columns="[[300,350,400,450,500,550,600],[0.12,0.35,0.89,1.62,1.95,1.92,1.25],[0.08,0.22,0.62,1.35,1.88,1.90,1.12]]",
    column_names="Temperature,Pristine,Annealed"
)

# 3. Create line+symbol graph
create_graph(graph_name="Fig1", data_book="Data", data_sheet="Sheet1",
             x_col=1, y_col=2, plot_type="line+symbol")
add_plot_to_graph(graph_name="Fig1", data_book="Data", data_sheet="Sheet1",
                  x_col=1, y_col=3, plot_type="line+symbol")

# 4. One call does everything: colors, fonts, ticks, frame, legend
apply_publication_style(
    graph_name="Fig1",
    x_label="Temperature (K)",
    y_label="Absorbance (a.u.)",
    x_min=280, x_max=620, y_min=0, y_max=2.2,
    legend_entries="Pristine,Annealed",
    legend_position="top-right"
)

# 5. Export
export_graph(graph_name="Fig1", file_path="C:\\Users\\me\\fig1.png")

Result: A publication-ready figure with bold Arial labels, colorblind-safe colors (blue circles + red triangles), filled symbols, solid lines, inward ticks, closed frame, and positioned legend.

Claude Code Skill: Publication Figure

This repo includes a skill file (skills/publication-figure.md) that teaches Claude how to create journal-quality figures step by step. To use it:

  1. Copy skills/publication-figure.md to your Claude Code skills directory
  2. When you ask Claude to "make a publication figure", it will automatically follow the skill's workflow:
    • Ask about data source, figure type, target journal
    • Use colorblind-safe color palette (blue → red → green → orange → purple → cyan)
    • Apply proper typography (Arial, bold, correct sizes)
    • Follow a pre-export checklist

The skill also documents COM quirks observed while testing on Origin Pro 2020 — what works, what doesn't, and tested workarounds. This is invaluable if you need to customize beyond apply_publication_style.

Customizing the Skill for Your Style

The included skill is a generic starting template for paper-grade Origin figures. You should copy and customize it to match your lab's habits, target journals, and visual taste:

  • Font: Change from Arial to your journal's preferred font (e.g., Helvetica, Times New Roman)
  • Font sizes: Adjust axis title/tick label/legend sizes to match your journal's figure guidelines
  • Color palette: Replace the default colorblind-safe palette with your group's standard colors
  • Default export path: Set to your working directory
  • Figure recipes: Add templates for your common figure types (XRD patterns, IV curves, etc.)
  • Journal presets: Add specific formatting rules for your target journals (Nature, ACS, RSC, etc.)

Copy skills/publication-figure.md to your project and edit freely — it's meant to be a starting point, not a rigid template.

Key Origin Pro 2020 COM Quirks (documented in skill)

IssueWorkaround
Bold axis titles (xb.bold) doesn't existUse \b(text) markup in xb.text$
legend.text$ doesn't support multiline via COMSet column Long Names, then legend -r
legend.x/y uses data coordinates, not %Calculate from layer.x.from/to
%C notation fails via COMUse actual plot names from DataPlots
expGraph doesn't produce files via COMUse CopyPage + Pillow clipboard
nlr.r2 returns 0 after nlendRead statistics BEFORE nlend
Plot styling commands can conflictAdd 0.2s delay between set commands
[Book]Sheet!col(n).type = ... silently ignoredActivate the sheet, then use wks.col(n).type
set <plot> fails when the graph isn't activeRun win -a <graph> before set commands
Typed LabTalk locals (int x = ...) unreadable laterUse untyped assignment to read values back via COM

Supported Plot Types

TypeDescriptionData
scatterScatter plot (symbols only)X, Y
lineLine plot (no symbols)X, Y
line+symbolLine with symbols (recommended for publications)X, Y
columnVertical bar chartX, Y
barHorizontal bar chartX, Y
areaArea plotX, Y
piePie chartX, Y
histogramHistogramsingle Y column
boxBox chartsingle Y column
contourFilled contour mapX, Y, Z (pass z_col)
3d_scatter3D scatter (OpenGL)X, Y, Z (pass z_col)

Matrix plots (surface, contour, heatmap, image) come from a matrix via create_matrix_plot.

Supported Fitting Functions

CategoryFunctions
Linearline
Polynomialpoly2, poly3, poly4, poly5
Exponentialexp1, exp2, expgrow1, expdecay1
Peakgauss, lorentz, voigt
Growth/Sigmoidalboltzmann, hill, logistic, lognormal
Otherpower, sine

curve_fit returns the fitted parameter values with standard errors plus R², SSR, reduced χ², and DoF. Exception: power fits and draws the curve, but Origin 2020 does not expose its parameter values over COM, so only the statistics are returned. Use list_fitting_functions to see the parameter names for each function.

Color Palette

apply_publication_style uses a muted pastel palette (no pure primaries — easier on the eyes, survives grayscale printing, colorblind-distinguishable):

OrderColorRGB
1stSoft steel blue(93, 143, 179)
2ndMuted rose(204, 102, 119)
3rdMuted teal(68, 170, 153)
4thSoft amber(221, 170, 102)
5thSoft purple(153, 136, 187)
6thGray cyan(119, 170, 187)

Error bars automatically match their data series color. The fit curve drawn by curve_fit(plot_on_graph=...) uses a muted brick red (170, 68, 80).

Tip: Never use red + green as the only two colors — colorblind users cannot distinguish them.

Troubleshooting

ProblemSolution
"Could not connect to Origin via COM"Check that Origin/OriginPro is installed and licensed; if it is, run Origin once as administrator to re-register the Automation Server
Tools timeoutOrigin may be showing a dialog — check the Origin window
Export fails with a clipboard errorThe server already polls the clipboard for up to 5 s; check that the Origin window is not minimized and no other app holds the clipboard
"Window 'X' not found" errorsThe error lists every open workbook/graph — use one of those names (Origin may have renamed the window if the name was taken)
Legend missing after stylingLegend uses data coordinates — verify axis range is set before positioning
Symbols appear hollowDo NOT use set -d flag (it's for dash patterns, not fill)

License

MIT

Ver o original no GitHub

Bom para

Relacionados