originlab-mcp

mcp
Security Audit
Pass
Health Pass
  • License — License: MIT
  • Description — Repository has a description
  • Active repo — Last push 0 days ago
  • Community trust — 10 GitHub stars
Code Pass
  • Code scan — Scanned 12 files during light audit, no dangerous patterns found
Permissions Pass
  • Permissions — No dangerous permissions requested
Purpose
This MCP server acts as a bridge between AI clients and the OriginLab data analysis software. It enables users to control OriginLab's graphing, data analysis, and export features using natural language prompts via the Model Context Protocol.

Security Assessment
The overall risk is rated as Medium. The automated code scan found no dangerous patterns, hardcoded secrets, or requests for dangerous permissions. Additionally, the server communicates via local standard input/output (stdio) rather than exposing an open network port. However, because it directly interfaces with a local Windows application (OriginLab) through its Python API and file system, an AI could theoretically be manipulated into reading local files or executing unintended data operations. It requires a paid OriginLab license to function, limiting its use to existing users.

Quality Assessment
The project has a standard MIT license and has received positive community engagement with 10 GitHub stars. Maintenance is highly active, with the most recent code pushed today. Developers should note, however, that the project is explicitly labeled as an early "v0.1" release. The authors warn that features are subject to change and advise against using it in production environments.

Verdict
Use with caution — the code is safe and actively maintained, but its early developmental stage and direct local file/system access warrant careful supervision.
SUMMARY

MCP Server for OriginLab Control OriginLab with natural language through AI clients via the Model Context Protocol.

README.md

🔬 OriginLab MCP Server

让 AI 成为你的 OriginLab 助手

通过 MCP 协议 将 OriginLab 的数据分析与可视化能力无缝接入 Antigravity、Claude、Cursor 等 AI 客户端

快速开始 · 功能一览 · 使用示例 · 客户端配置

[!WARNING]
v0.1 早期版本 — 本项目仍处于早期开发阶段,功能和 API 可能随时变更,已知问题较多。欢迎试用和反馈,但请勿用于生产环境。


✨ 什么是 OriginLab MCP Server?

OriginLab MCP Server 是一个连接 AI 与 OriginLab 的桥梁。它让你可以用自然语言完成数据导入、图表绘制、样式定制、数据分析和结果导出——无需手动操作 Origin 界面。

你:「把桌面上的 experiment.csv 导入 Origin,用第一列做 X、第二列做 Y,画散点图,
     做个高斯拟合,然后导出为 PNG。」

AI:好的,我来帮你完成。
    ✅ 已导入 experiment.csv → Sheet1(200 行 × 5 列)
    ✅ 已创建散点图 → Graph1
    ✅ 高斯拟合完成 → xc=2.35, w=0.82, A=156.3, R²=0.9987
    ✅ 已导出 → C:\Users\Desktop\Graph1.png

工作原理

AI 客户端 (Antigravity / Claude / Cursor)
       ↓ MCP 协议 (stdio)
OriginLab MCP Server (Python)
       ↓ originpro
OriginLab (COM)

📋 前置条件

条件 要求
操作系统 Windows
OriginLab 2021 或更新版本,持有有效许可证
Python 3.10+

🚀 快速开始

提供两种安装方式,任选其一:

方式 A:使用 uv(推荐,更快)

1. 安装 uv

irm https://astral.sh/uv/install.ps1 | iex

2. 安装依赖

cd C:\path\to\originlab-mcp
uv sync

3. 启动

uv run originlab-mcp
方式 B:使用 pip

1. 创建虚拟环境(可选但推荐)

cd C:\path\to\originlab-mcp
python -m venv .venv
.venv\Scripts\activate

2. 安装项目

pip install -e .

3. 启动

originlab-mcp

Server 启动后通过 stdio 等待客户端连接,首次调用 tool 时自动连接本机 OriginLab。

🧰 功能一览

共提供 53 个工具,覆盖 OriginLab 的数据全流程。

📊 数据管理
15 个工具

导入import_csv · import_excel · import_data_from_text

查看list_worksheets · get_worksheet_info · get_worksheet_data · get_cell_value

编辑set_column_designations · set_column_labels · set_column_formula

管理add_worksheet · sort_worksheet · clear_worksheet · delete_columns

导出export_worksheet_to_csv

📈 绘图
10 个工具

创建create_plot · create_double_y_plot

修改add_plot_to_graph · remove_plot_from_graph · change_plot_data

图层add_graph_layer · group_plots

查看list_graphs · list_graph_templates · get_graph_info

剪贴板copy_graph_to_clipboard

🎨 图表定制
18 个工具

坐标轴set_axis_range · set_axis_scale · set_axis_step · set_axis_title

颜色set_plot_color · set_plot_colormap · set_plot_transparency

符号set_plot_symbols · set_symbol_size · set_symbol_interior

分组递增set_color_increment · set_symbol_increment

填充set_fill_area

标注set_graph_title · add_text_label · add_line_to_graph · remove_graph_label

查看get_graph_info

📐 数据分析
3 个工具

拟合linear_fit · nonlinear_fit

查询list_fit_functions

支持 Gauss、Lorentz、ExpDec1、Boltzmann 等常用拟合函数,可固定参数、设置初始值、带误差棒拟合

💾 导出与项目
5 个工具

export_graph · export_worksheet_to_csv · save_project · open_project · new_project

🔧 系统状态
1 个工具

get_origin_info

⚡ 高级
1 个工具

execute_labtalk — 执行任意 LabTalk 命令(逃生舱)

💬 使用示例

配置好客户端后,在 AI 对话中直接用自然语言操作:

你说的话 AI 调用的 tool
「把 data.csv 导入 Origin」 import_csv
「这个表有几列?列头是什么?」 get_worksheet_info
「第一列设 X,第二三列设 Y」 set_column_designations
「画个散点图」 create_plot
「再加一条第三列的曲线」 add_plot_to_graph
「X 轴标题改成 Time (s),曲线改红色」 set_axis_title + set_plot_color
「做个高斯拟合」 nonlinear_fit
「把 Y 轴改成对数刻度」 set_axis_scale
「导出 PNG 到桌面」 export_graph
「复制到剪贴板,我要粘贴到 PPT」 copy_graph_to_clipboard

典型的完整工作流:

导入数据 → 查看结构 → 设置列角色 → 创建图表 → 定制外观 → 数据分析 → 导出结果

🔌 客户端配置

你不需要手动启动 MCP Server。 配置好后,AI 客户端会在需要 OriginLab 工具时自动在后台拉起子进程,通过 stdin/stdout 通信,整个过程对用户无感知。

路径请替换为你的实际项目路径。

Antigravity (Gemini) — 推荐

在项目根目录创建 .gemini/settings.json

使用 uv:

{
  "mcpServers": {
    "originlab": {
      "command": "uv",
      "args": ["--directory", "C:\\path\\to\\originlab-mcp", "run", "originlab-mcp"]
    }
  }
}

使用 pip:

{
  "mcpServers": {
    "originlab": {
      "command": "C:\\path\\to\\originlab-mcp\\.venv\\Scripts\\originlab-mcp.exe"
    }
  }
}
Claude Desktop

编辑 %APPDATA%\Claude\claude_desktop_config.json,内容格式同上(选择对应安装方式的配置)。

Cursor

在项目根目录创建 .cursor/mcp.json,内容格式同上。

Codex (OpenAI)

在项目根目录创建 .codex/config.json,内容格式同上。

🧪 测试

# uv
uv run pytest tests/ -v

# pip(激活虚拟环境后)
pytest tests/ -v

基础测试不依赖 Origin 安装,可在任何环境运行。

📁 项目结构

originlab-mcp/
├── pyproject.toml                # 项目配置与依赖
├── src/originlab_mcp/
│   ├── server.py                 # MCP Server 入口
│   ├── origin_manager.py         # Origin COM 连接管理(单例 + 线程安全)
│   ├── exceptions.py             # 自定义异常类
│   ├── types.py                  # Protocol 类型定义
│   ├── tools/
│   │   ├── data.py               # 📊 数据导入与工作表管理(15 tools)
│   │   ├── plot.py               # 📈 图表创建与管理(10 tools)
│   │   ├── customize.py          # 🎨 图表外观定制(18 tools)
│   │   ├── analysis.py           # 📐 数据分析 — 线性/非线性拟合(3 tools)
│   │   ├── export.py             # 💾 导出与项目管理(5 tools)
│   │   ├── system.py             # 🔧 系统状态(1 tool)
│   │   └── advanced.py           # ⚡ LabTalk 逃生舱(1 tool)
│   └── utils/
│       ├── constants.py          # 枚举、默认值、拟合函数定义
│       ├── helpers.py            # 工作表/图表解析、错误处理装饰器
│       └── validators.py         # 参数校验与统一返回结构
└── tests/
    └── test_tools.py             # 单元测试

❓ 常见问题

Origin 连接失败

请确认:

  • OriginLab 2021+ 已安装在本机
  • 持有有效许可证
  • 当前用户有权限启动 Origin
  • 没有其他程序占用 Origin COM 接口
MCP 客户端看不到 tools
  1. 确认配置文件路径正确
  2. 确认依赖已安装(uv syncpip install -e .
  3. 重启 MCP 客户端
拟合结果不准确
  1. 检查数据是否有异常值(可用 get_worksheet_data 预览)
  2. 尝试通过 initial_params 提供更好的初始参数
  3. 使用 fixed_params 固定已知参数
  4. 确认选择了正确的拟合函数(list_fit_functions 可查看可用函数)

📜 许可证

MIT © 2025 garethbeaumo

Reviews (0)

No results found