MCP Server for OriginLab Control OriginLab with natural language through AI clients via the Model Context Protocol.
OriginLab MCP Server
Use AI as your OriginLab assistant
Connect OriginLab data analysis and visualization to Antigravity, Claude, Cursor, and other AI clients through the Model Context Protocol.
Quick Start ยท Features ยท Examples ยท Client Configuration
็ฎไฝไธญๆ ยท English
[!WARNING]
Early v0.2 release - this project is still under active development. Features and APIs may change. It is suitable for testing and feedback, but not recommended for production use yet.
What Is OriginLab MCP Server?
OriginLab MCP Server is a bridge between AI clients and OriginLab. It lets you import data, create plots, customize figures, run analysis, and export results through natural-language requests instead of manually operating the Origin UI.
User: Import experiment.csv from my desktop into Origin, use the first column as X
and the second column as Y, create a scatter plot, run a Gaussian fit,
then export the graph as PNG.
AI: Done. Imported experiment.csv -> Sheet1 (200 rows x 5 columns) Created scatter plot -> Graph1 Gaussian fit completed -> xc=2.35, w=0.82, A=156.3, Rยฒ=0.9987 Exported -> C:\Users\Desktop\Graph1.png
How It Works
AI Client (Antigravity / Claude / Cursor)
โ MCP over stdio
OriginLab MCP Server (Python)
โ originpro + COM
OriginLab
Requirements
| Requirement | Details | | :--- | :--- | | Operating system | Windows | | OriginLab | OriginLab 2021 or later with a valid license | | Python | 3.10+ |
Quick Start
For AI assistants or one-command local setup, run this from the repository root:
powershell -ExecutionPolicy Bypass -File .\scripts\install-and-open.ps1
The script installs uv if needed, runs uv sync, starts the local status panel, and opens http://127.0.0.1:8765/ automatically. From that page you can test Origin and write MCP client configs.
Choose one installation method.
Option A: uv (recommended)
1. Install uv
irm https://astral.sh/uv/install.ps1 | iex
2. Install dependencies
cd C:\path\to\originlab-mcp
uv sync
3. Start the server
uv run originlab-mcp
Option B: pip
1. Create a virtual environment (optional but recommended)
cd C:\path\to\originlab-mcp
python -m venv .venv
.venv\Scripts\activate
2. Install the project
pip install -e .
3. Start the server
originlab-mcp
After startup, the server waits for MCP client requests over stdio. The first tool call automatically connects to the local OriginLab installation.
Optional: Local Status Panel
To check whether the MCP server can start, whether Origin can be reached, and whether common client config files exist, start the local UI:
uv run originlab-mcp-ui
Then open http://127.0.0.1:8765/. This page can start/stop a debug MCP server subprocess, test the Origin connection, and write the originlab MCP configuration for Antigravity / Gemini, Cursor, Codex, Trae, and Claude Desktop. For normal use, the AI client should still start the server automatically from its configuration.
When updating an existing config file, the UI creates a .bak-timestamp backup first. To prevent the browser from opening automatically:
$env:ORIGINLABMCPUINOBROWSER = "1"
uv run originlab-mcp-ui
Features
The server provides 65 tools covering the OriginLab data workflow.
Data Management (14 Tools)
| Category | Tools | | :--- | :--- | | Import | importcsv ยท importexcel ยท importdatafrom_text | | Inspect | listworksheets ยท getworksheetinfo ยท getworksheetdata ยท getcell_value | | Edit | setcolumndesignations ยท setcolumnlabels ยท setcolumnformula | | Manage | addworksheet ยท sortworksheet ยท clearworksheet ยท deletecolumns |
Plotting (11 Tools)
| Category | Tools | | :--- | :--- | | Create | createplot ยท createdoubleyplot | | Modify | addplottograph ยท removeplotfromgraph ยท changeplotdata ยท changeplottype | | Layers | addgraphlayer ยท group_plots | | Inspect | listgraphs ยท listgraphtemplates ยท getgraph_info |
Graph Customization (25 Tools)
| Category | Tools | | :--- | :--- | | Axes | setaxisrange ยท setaxisscale ยท setaxisstep ยท setaxistitle | | Lines | setplotlinestyle ยท setplotlinewidth | | Fonts and ticks | setgraphfont ยท settickstyle | | Colors | setplotcolor ยท setplotcolormap ยท setplottransparency | | Symbols | setplotsymbols ยท setsymbolsize ยท setsymbolinterior | | Group increments | setcolorincrement ยท setsymbolincrement | | Error bars | seterrorbar_style | | Fill | setfillarea | | Legend | set_legend | | Preset styling | applypublicationstyle | | Annotations | setgraphtitle ยท addtextlabel ยท addlinetograph ยท removegraph_label |
Analysis (3 Tools)
linearfit ยท nonlinearfit ยท listfitfunctions
Common Origin fit functions such as Gauss, Lorentz, ExpDec1, and Boltzmann are supported. You can provide initial parameters, fix parameters, and fit with error bars.
Export and Project Management (6 Tools)
exportgraph ยท exportallgraphs ยท exportworksheettocsv ยท saveproject ยท openproject ยท new_project
System Management (4 Tools)
getorigininfo ยท releaseorigin ยท reconnectorigin ยท close_origin
Advanced (2 Tools)
executelabtalk ยท getlabtalk_variable
executelabtalk is an escape hatch for operations not covered by standard tools. getlabtalk_variable safely reads LabTalk variable values.
Examples
| Request | Typical tool call | | :--- | :--- | | Import data.csv into Origin | import_csv | | Show worksheet columns and metadata | getworksheetinfo | | Set the first column as X and the next two columns as Y | setcolumndesignations | | Create a scatter plot | create_plot | | Add another curve from the third column | addplotto_graph | | Change the X-axis title and set the curve color to red | setaxistitle + setplotcolor | | Apply a publication-style preset | applypublicationstyle | | Apply publication styling to layer 2 with line width 3 and symbol size 12 | applypublicationstyle | | Run a Gaussian fit | nonlinear_fit | | Set the Y axis to logarithmic scale | setaxisscale | | Export a graph as PNG | export_graph | | Export all project graphs as SVG | exportallgraphs | | Release Origin so I can use it manually | release_origin |
applypublicationstyle supports layer_index, axis-title font size, tick-label font size, legend font size, major tick length, minor tick count, line width, symbol size, and other common publication-figure settings.
Typical workflow:
Import data -> inspect structure -> set column designations -> create plot -> customize graph -> run analysis -> export results
Client Configuration
[!NOTE]
You do not need to start the MCP server manually. Once configured, the AI client starts the server process when needed and communicates with it over stdin/stdout.
Replace paths with your actual project path.
You can also run uv run originlab-mcp-ui, choose a client in the local status panel, and let it write the config automatically. Manual examples are shown below.
Antigravity (Gemini) - Recommended
Create .gemini/settings.json in the project root.
Using uv:
{
"mcpServers": {
"originlab": {
"command": "uv",
"args": ["--directory", "C:\\path\\to\\originlab-mcp", "run", "originlab-mcp"]
}
}
}
Using pip:
{
"mcpServers": {
"originlab": {
"command": "C:\\path\\to\\originlab-mcp\\.venv\\Scripts\\originlab-mcp.exe"
}
}
}
Claude Desktop
Edit %APPDATA%\Claude\claudedesktopconfig.json using the same format as above.
Cursor
Create .cursor/mcp.json in the project root using the same format as above.
Trae
Create .trae/mcp.json in the project root using the same format as above.
Codex (OpenAI)
Create .codex/config.json in the project root using the same format as above.
Testing
# uv
uv run python -m pytest tests/ -v
pip, after activating the virtual environment
pytest tests/ -v
The basic test suite does not require OriginLab to be installed.
Project Structure
originlab-mcp/
โโโ pyproject.toml # Project configuration and dependencies
โโโ CHANGELOG.md # Release notes
โโโ scripts/
โ โโโ install-and-open.ps1 # One-command setup and UI launcher
โโโ src/originlab_mcp/
โ โโโ server.py # MCP server entry point and dependency injection
โ โโโ ui.py # Local status panel
โ โโโ origin_manager.py # Thread-safe Origin COM connection manager
โ โโโ exceptions.py # Custom exceptions
โ โโโ types.py # Protocol type definitions
โ โโโ tools/
โ โ โโโ data.py # Data import and worksheet management (14)
โ โ โโโ plot.py # Plot creation and graph management (11)
โ โ โโโ customize.py # Graph customization (25)
โ โ โโโ analysis.py # Linear and nonlinear fitting (3)
โ โ โโโ export.py # Export and project management (6)
โ โ โโโ system.py # System and connection management (4)
โ โ โโโ advanced.py # LabTalk escape hatch (2)
โ โโโ utils/
โ โโโ constants.py # Enums, defaults, and fit-function metadata
โ โโโ helpers.py # Graph/sheet resolution and error handling helpers
โ โโโ validators.py # Input validation and standard response builders
โโโ tests/
โโโ test_helpers.py # Helper tests
โโโ test_phase3.py # LabTalk safety and resolve-pattern tests
โโโ test_tools.py # Tool registration and integration tests
โโโ test_ui.py # Local status panel config tests
FAQ
Origin connection failed
Check that:
- OriginLab 2021 or later is installed locally
- You have a valid OriginLab license
- The current user can start Origin
- No other program is blocking the Origin COM interface
The MCP client cannot see the tools
- Confirm the client configuration path is correct.
- Confirm dependencies are installed with
uv syncorpip install -e .. - Restart the MCP client.
Fit results look inaccurate
- Check for outliers with
getworksheetdata. - Provide better initial values through
initial_params. - Fix known parameters with
fixed_params. - Confirm that the fit function is appropriate. Use
listfitfunctionsto inspect common options.
License
MIT ยฉ 2025 garethbeaumo