DeepSeek Harness plugin

dsh-origin-plugin

Drive Origin scientific plotting from DeepSeek Harness AI chat via MCP: write data, plot line/scatter/column, export PNG/SVG.

Jump to install

Source facts

Repository
Fantasality/dsh-origin-plugin
Latest update
Aug 18, 2026
Category
Tools & Capabilities
GitHub stars
1

Install

Start with a prompt that asks an agent to read the source. Switch to the command if you want to install it yourself.

Copy this prompt into DSH, Codex, or another agent and ask it to read the page and repository first.

Do not install anything yet. Read this DeepSeek Harness plugin and explain what it does, which files, networks, or credentials it can access, and how to install and remove it.

Plugin page: https://deepseekplugins.org/plugins/Fantasality/dsh-origin-plugin
GitHub: https://github.com/Fantasality/dsh-origin-plugin
Plugin: dsh-origin-plugin
Author: Fantasality
Install command: dsh plugin --profile web add "https://github.com/Fantasality/dsh-origin-plugin/releases/latest/download/dsh-origin-plugin.tgz"

Do not run the install command until I confirm.

Check the source files

Read the README and other files from this plugin directory before installing.

File explorer3 files
README.mdSource · read only

DSH Origin Plugin · DeepSeek Harness × Origin 一键画图

DeepSeek Harness (DSH) 的 AI 对话直接驱动本机 Origin(科学绘图软件)自动画图并导出 PNG / SVG

  • 🤖 对话触发:「用 Origin 画 y=x² 折线图并导出 PNG」 → 模型自动调用工具 → 图片落盘
  • 🔌 官方 MCP 桥接:通过 DSH 内置的 @deepseek-ai/dsh-mcp-client 注册为原生工具 mcp__origin__*
  • 🧪 2D 图:line / scatter / line_symbol / column,多列数据、批量 Y 序列
  • 🧬 进阶:删除/裁剪数据点线性/非线性拟合(拟合曲线上图)、3D 表面图 / 3D 散点图
  • 🔒 多会话并发安全:专用 COM 线程 + 单实例语义,实测 8 线程并发 8/8 通过
  • 🛡 不崩溃:所有错误返回结构化 JSON + 中文排查提示

![示例输出图](docs/example.png) ![3D 表面示例](docs/example_3d.png)

DSH 对话(多会话并发)
   │  mcp__origin__origin_plot_file / origin_write_data / ...
   ▼
@deepseek-ai/dsh-mcp-client(DSH 官方 MCP 桥接)
   │  stdio 子进程
   ▼
origin_mcp_server.py(MCP 服务器,Python mcp SDK)
   │  专用 COM 线程(串行化)
   ▼
origin_engine.py(originpro → OriginExt → comtypes → COM)
   ▼
Origin64.exe(单实例 COM 自动化服务器)

快速开始

> 🚀 模型快速上手:本插件自带 DSH 原生 origin-plotting skill(安装后自动注册, > 见下方「skill 速查」),模型画图前加载 skill 或调用 origin_help 即可秒懂用法, > 无需阅读本 README

1. 环境要求

  • Windows + 已安装 Origin(实测 OriginPro 2026b;2018+ 一般均可)
  • Python 3.10+(本插件自带独立 venv,不污染系统环境)
  • DeepSeek Harness(DSH Desktop 或 dsh CLI,需含 @deepseek-ai/dsh-mcp-client

2. 安装

git clone https://github.com/Fantasality/dsh-origin-plugin.git "%USERPROFILE%\dsh_origin_plugin"
cd "%USERPROFILE%\dsh_origin_plugin"

:: 创建独立 venv 并安装依赖
python -m venv .venv
.venv\Scripts\python.exe -m pip install mcp originpro pywin32 numpy

:: 冒烟验证 Origin COM 链路(需已安装 Origin;未运行会自动启动)
.venv\Scripts\python.exe -X utf8 smoke\origin_com_smoke_test.py
:: 预期结尾: RESULT: OK  files={'comtest.png': ..., 'comtest.svg': ...}

2.1 以 bundle 方式安装(一键 / 插件市场)

本仓库声明了 DSH 标准的 dsh.bundle 清单(package.jsoncordis.patch.yml), 因此可从 DSH 插件市场(dsh-market / awesome-dsh-plugin)一键收录,也可用命令安装:

dsh plugin --profile web add github:Fantasality/dsh-origin-plugin

装好后 cordis.patch.yml 会注册一个 mcp-origin@deepseek-ai/dsh-mcp-client), 默认用系统 python 启动 origin_mcp_server.py注意:首次使用前仍需按上文「2. 安装」准备好 venv 依赖(本插件是 Windows + Origin 本地进程,无法纯源码免装运行); 若依赖装在独立 venv,请在 profile 的 cordis.patch.yml 里用同一 id mcp-origin 覆盖 command/args(后层覆盖先层),或直接运行 register_to_dsh.ps1 一键写入 本机绝对路径。server 连不上时只记日志、不注册工具,不会导致 DSH 崩溃。

3. 注册到 DSH

powershell -ExecutionPolicy Bypass -File "%USERPROFILE%\dsh_origin_plugin\register_to_dsh.ps1"

脚本会把以下条目追加到 %APPDATA%\dsh-desktop\harness\profiles\web\cordis.patch.yml (自动备份、UTF-8 安全、幂等):

- insert:
    - id: mcp-origin
      name: '@deepseek-ai/dsh-mcp-client'
      config:
        serverName: origin
        transport: stdio
        command: 'C:/Users/<你>/dsh_origin_plugin/.venv/Scripts/python.exe'
        args: ['-X', 'utf8', 'C:/Users/<你>/dsh_origin_plugin/origin_mcp_server.py']
        toolCallTimeoutMs: 120000

然后 重启 Harness(DSH Desktop 菜单 Harness → Restart Harness,或 Ctrl+Shift+R)。 可选校验:dsh --profile web --dump-config 能看到 mcp-origin 条目。

> 机制说明:DSH 的插件生态是 Cordis 插件树 + cordis.patch.yml patch 层;MCP 服务器是官方 > 一等公民——dsh-mcp-client 会自动把外部 MCP 工具桥接为原生工具 > (名称 mcp__<serverName>__<rawName>),无需编写 TypeScript 插件即可接入 Python 能力。

4. 对话触发示例

你说模型会调用
「用 Origin 画 y=x²(x=1..10)的折线图,导出 PNG」mcp__origin__origin_plot_file
「把这两列数据画成散点图导出 SVG:x=[1,2,3,4,5], y=[3.1,4.9,7.2,8.8,11.3]」mcp__origin__origin_plot_file
「先写数据再分步画图、导出」origin_write_dataorigin_plotorigin_export

快速上手(skill + origin_help)

模型在对话中遇到 Origin 画图/分析任务时,有两种秒级上手通道:

1. origin-plotting skill(DSH 原生机制):安装时自动写入 %APPDATA%\dsh-desktop\harness\skills\origin-plotting\SKILL.md~/.dsh\skills\origin-plotting\SKILL.md。模型目录可见该 skill,按需加载后 直接获得:数据格式、16 工具速查表、10 个任务模板——不用再读 README; 2. mcp__origin__origin_help 工具:不连接 Origin、约 1ms 返回同一份速查 (JSON 格式,含 usage/tools/templates/tips),任何时刻可调用。

两者内容一致、互为备份;工具 description 中也已内嵌快速用法提示。

工具清单

MCP 工具作用关键参数
origin_status连接状态 / Origin 进程数 / 环境
origin_write_data多列数据写入工作表(dict 或二维列表)columns, worksheet?
origin_plot画图:line/scatter/line_symbol/column/histogram/box/bar + 误差棒worksheet, plot_type, yerr_column, title
origin_export导出 PNG/SVGgraph, fmt, file_path, width
origin_plot_file一键:写数据→画图→导出columns, plot_type, fmt, file_path, width
origin_filter_data删除/裁剪数据点(按行索引或 x 范围)worksheet, drop_rows, x_min/x_max
origin_fit线性/非线性拟合(Origin 内置函数),拟合曲线上图worksheet, kind(linear/ExpDec1/Gauss/...), plot_curve
origin_plot3d3D 表面图 / 3D 散点图data, plot_type(surface/scatter)
origin_stats描述统计:count/mean/std/min/p25/median/p75/max/skewworksheet, columns
origin_transform平滑/归一化/微分/插值(写回新列)worksheet, op, method, window, new_x
origin_integrate数值积分 AUC(梯形法)worksheet, x_column, y_column
origin_fftFFT 频谱:主频提取 + 频谱图worksheet, plot_spectrum, top
origin_correlatePearson 相关矩阵worksheet, columns
origin_peak_find峰值检测(峰高/间距过滤)worksheet, min_height, min_distance
origin_histogram直方图统计(可画图导出)worksheet, bins, plot
origin_plot_contour等高线 / 填充等高线 / 3D 线框data, plot_type

进阶能力

删除/裁剪数据点(origin_filter_data

# 删除第 2/5/9 行(0 起始索引)
origin_filter_data(worksheet="[Book1]Sheet1", drop_rows=[2, 5, 9])
# 只保留 x ∈ [0, 15] 的数据(x 列自动裁剪,NaN 填充尾部,图上不显示)
origin_filter_data(worksheet="[Book1]Sheet1", x_min=0, x_max=15)

拟合(origin_fit

  • kind="linear":线性拟合,返回 slope / intercept 及误差;
  • kind="ExpDec1" / "Gauss" / "Polynomial" / "Lorentz" / "Sigmoid" 等:

Origin 内置拟合函数名(非线性最小二乘,返回全部参数 + cod/R² 等统计量);

  • plot_curve=True:自动生成「原始散点 + 拟合曲线」图。

实测参数还原精度:线性 slope=2.035(真值 2.0);ExpDec1 A1=5.08(真值 5.0)、k=0.518(真值 0.5)、cod=0.997。

3D 图(origin_plot3d

# 3D 表面:z 为 2D 网格(自动生成 X/Y 索引网格,或提供 x/y 向量)
origin_plot3d(data={"z": [[1, 2, 3], [4, 5, 6], [7, 8, 9]]}, plot_type="surface")
# 3D 散点:x/y/z 三个等长列表
origin_plot3d(data={"x": [...], "y": [...], "z": [...]}, plot_type="scatter")

表面图走 Origin 原生 GLparafunc 模板(matrix Z/X/Y 三对象),散点走 plotxy plot:=310

科学分析(origin_stats / origin_transform / origin_fft 等)

能力工具说明
描述统计origin_statscount/mean/std/min/p25/median/p75/max/skew
平滑origin_transform(op="smooth")移动平均 / 中值滤波,窗口可调
归一化origin_transform(op="normalize")minmax / zscore / sum
数值微分origin_transform(op="derivative")基于 x 步长的梯度
插值origin_transform(op="interpolate")任意新 x 网格线性插值
积分/AUCorigin_integrate梯形法曲线下面积
频谱分析origin_fft幅度谱 + 主频提取 + 频谱图
相关性origin_correlatePearson 相关矩阵
峰值检测origin_peak_find局部极大值 + 峰高/间距过滤
直方图origin_histogrambin 频数 + 柱状图

实测:FFT 对 2Hz 正弦(256 点、0.05s 采样)主频检出 2.031Hz;AUC 梯形法精度良好; 峰值检测对高斯峰(σ=0.5)在 x=6.0 处检出多个候选峰(配合 min_height/min_distance 收敛)。

画图类型速查(origin_plot

plot_type实现说明
line / scatter / line_symbol / columnadd_plot基础 2D
histogramnumpy 分箱 + 柱状图稳定可控
boxOrigin 原生 box 模板箱线图
barplotxy 215条形图
+ yerr_columnadd_plot colyerr误差棒

> 排坑记录:LabTalk plotxy 的列范围必须用 [Book]1!B 短名形式((n) 索引形式对 > 部分图型静默失败);box chart 无可靠 plotxy 代码,改用 Origin box 模板。

并发 / 多会话稳定性设计

Origin 是单实例 COM 自动化服务器,且 comtypes 的 COM 接口指针有线程亲和性 (实测跨线程调用报「对象没有连接到服务器」)。本插件的对策:

1. 专用 COM 线程:所有 Origin 操作投递到唯一工作线程串行执行(任务队列), 同时解决线程亲和性与并发互踩; 2. 单实例语义:连接前强制 OriginExt.ApplicationSI(复用已运行主实例), 杜绝多 Origin 进程导致的 COM 连错实例(实测多实例会让 LT_execute 报异常); 3. 唯一命名空间:每次调用新建 DSH_<8hex> 工作表/图,互不覆盖; 4. 多进程加固:设置环境变量 ORIGIN_IPC_LOCK=1 可启用 Windows 命名互斥体, 覆盖多 DSH 实例同时操作同一 Origin 的极端场景; 5. 实测:8 线程并发各画一张图 8/8 通过,单张耗时约 1~2 秒。

目录结构

dsh-origin-plugin/
├── origin_engine.py          # 核心引擎:连接/写数/画图/导出/锁/错误处理
├── origin_mcp_server.py      # MCP 服务器(DSH 对话入口),自带自测模式
├── demo_call.py              # 最小可运行示例(不依赖 MCP)
├── register_to_dsh.ps1       # 注册脚本(幂等/UTF-8 安全/自动备份)
├── unregister_from_dsh.ps1   # 卸载脚本
├── smoke/
│   ├── origin_com_smoke_test.py   # COM 链路冒烟测试
│   └── mcp_handshake_test.mjs     # 用 DSH 同款 Node SDK 验证 MCP 握手
└── docs/example.png          # 示例输出图

自测

:: 引擎级全链路(写数→画图→PNG→SVG)
.venv\Scripts\python.exe -X utf8 origin_mcp_server.py --selftest

:: 8 线程并发稳定性
.venv\Scripts\python.exe -X utf8 origin_mcp_server.py --concurrency-test

:: MCP 协议级(模拟 DSH 客户端,验证 8 个工具)
.venv\Scripts\python.exe -X utf8 origin_mcp_server.py --mcp-test

:: 进阶能力(删点/拟合/3D)
.venv\Scripts\python.exe -X utf8 smoke\advanced_test.py

:: 用 DSH 自带 Node MCP SDK 握手(与 dsh-mcp-client 同款)
node smoke\mcp_handshake_test.mjs

:: 最小调用示例
.venv\Scripts\python.exe -X utf8 demo_call.py

端到端验证清单

  • [ ] smoke 测试输出 RESULT: OKoutput\comtest.png 存在
  • [ ] --selftest 输出 SELFTEST OK
  • [ ] --concurrency-test 输出 CONCURRENCY-TEST OK(8/8)
  • [ ] --mcp-test 输出 MCP-TEST OK(5 个工具可见)
  • [ ] mcp_handshake_test.mjs 输出 HANDSHAKE-TEST OK
  • [ ] register_to_dsh.ps1 执行成功,dsh --profile web --dump-config 可见 mcp-origin
  • [ ] 重启 Harness 后新对话触发画图,返回 PNG 路径且图片内容正确
  • [ ] 同时开 2~3 个对话各画不同图,互不干扰

常见问题

现象处理
对话里没有 mcp__origin__* 工具Harness 未重启;或 --dump-config 无 mcp-origin(检查 patch 编码/语法)
origin_status 报 LT_execute 异常存在多个 Origin64 进程:关闭多余 Origin 窗口只保留主实例后重试
Origin 弹模态对话框导致调用卡住自动化期间不要手动操作 Origin;关闭对话框重试
中文乱码不要用 Add-Content 等 ANSI 方式追加 YAML;脚本已内置 UTF-8 写入
换机器register_to_dsh.ps1 中的路径或直接编辑 patch 条目

License

MIT © Fantasality