夜雨聆风学习资料网

ARTICLE · 1185489

如何将 AI 连接到科研绘图软件?

如何将 AI 连接到科研绘图软件?

字数 916,阅读大约需 5 分钟

如何将 AI 连接到科研绘图软件?

我们主要用 MCP 将 AI 连接到各个绘图软件。MCP(Model Context Protocol,模型上下文协议)是由 Anthropic 于 2024 年 11 月推出的一个开放协议,目的是让大语言模型(LLM)能够以统一、标准化的方式连接外部数据源和工具。

各个软件的 MCP 基本都是 python 或者 node.js 写的。因此,我们首先需要配置这些工具链。如下配置均针对 Windows 系统,Linux 系统用户理论上不需要教学。

实际上,我们可以直接让 Agent 完成下列所有步骤(安装工具链和各个软件的 MCP),应该能比较好地完成任务,但我没有试过。作为前 AI 时代的“能工智人”,还是想坚持手搓。但坚持手搓估计很快要成为一种行为艺术了。

前置工具链

Windows 系统自带的 shell 太老了,我们这里下载安装 PowerShell 7,https://github.com/powershell/powershell。

我们需要一个包管理器统一管理后续安装的工具。scoop 是 Windows 系统下最流行的包管理器之一。在 PowerShell 终端执行如下命令即可安装(见官网文档,https://github.com/ScoopInstaller/Scoop),

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-RestMethod
 -Uri https://get.scoop.sh | Invoke-Expression

采用 scoop 安装其他工具,

scoop install git uv nodejs codex

采用 uv 安装 python,这里安装 python3.14。目前最新版本是 3.15,但是刚发布,如果使用 3.15 应该会存在不少依赖问题。

uv python install python3.14

我们还需要一个 Agent,这里使用 Codex,用户自行下载安装。

最后下载安装如下常用的科研绘图软件,

  • • PowerPoint:无需下载,几乎每台电脑都自带。
  • • Inkscape:https://inkscape.org/
  • • Blender:https://www.blender.org/
  • • draw.io:https://github.com/jgraph/drawio-desktop

PowerPoint

这是在 B 站上偶然看到的一个 MCP,https://github.com/changhaozhang663-shaxia/codex-science-figure-mcp。

按文档说明下载、解压到你想放置 MCP 的目录。

双击 setup.cmd 即可安装。

重启 Codex 即可使用。

Inkscape

AI 推荐这个 MCP,https://github.com/sandraschi/inkscape-mcp。

切换到你想安装放置 MCP 的文件夹。clone 整个项目,

git clone https://github.com/sandraschi/inkscape-mcp

进入 inkscape-mcp 目录,同步所需的包,

cd inkscape-mcp
uv sync

很不幸的是,这里我们遇到了一个依赖问题,

hint: `lxml` (v5.4.0) was included because `inkscape-mcp` (v2.7.1) depends on `inkex` (v1.4.1) which depends on `lxml`
hint: Build failures usually indicate a problem with the package or the build environment

询问 AI 后得知,lxml 5.4.0 没有为 Python 3.14 提供预编译的 Wheel 包。解决方案是编辑 inkscape-mcp/pyproject.toml,在末尾添加如下配置,这样可以强行升级库的版本而不用降级 python,

[tool.uv]
override-dependencies = ["lxml>=6.0.1"]

在 Codex 中配置 MCP,设置→插件→添加→添加 MCP 服务器,按如图所示配置,

重启 Codex 即可使用。

Blender

我们使用官方的 MCP,https://www.blender.org/lab/mcp-server/。

打开 blender,按官网教程拖动“Drag and Drop into Blender”按钮到 blender 窗口。这会向 blender 添加插件仓库。如果你理解这一步的原理,我们也可以手动添加插件仓库。

在偏好设置→获取扩展中搜索“MCP”,安装。

切换到你想安装放置 MCP 的文件夹。clone 整个项目,

git clone https://projects.blender.org/lab/blender_mcp.git

在 Codex 中配置 MCP,设置→插件→添加→添加 MCP 服务器,按如图所示配置,

重启 Codex 即可使用。

draw.io

我们使用官方的 MCP,https://github.com/jgraph/drawio-mcp。

利用 codex 命令行执行如下操作即可,

codex plugin marketplace add jgraph/drawio-mcp
codex plugin add drawio@drawio

结语

以上 MCP 我都测试过,可以正常工作。如果发现不能正常工作,可以尝试彻底重启 Codex。

感谢亲爱的 MJ 帮我读稿校对。

相关学习资料