CorelDRAW MCP Connector
Controls a local CorelDRAW installation via COM to create and edit documents, add rectangles, ellipses, text, and images, export PNG/JPEG/TIFF/PDF/CDR files, save editable CDR files, list fonts, and render complete layouts from a JSON specification.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
CorelDRAW MCP Connector · 豆包 × CorelDRAW 设计连接器
把本机的 CorelDRAW 变成一个 MCP(Model Context Protocol)服务,让豆包、Claude 等任意支持 MCP 的 AI 客户端可以直接操刀排版、画图、排字、置入图片、导出成品。
豆包说一句「做一张 80×180cm 的油茶麻花展架」,本机 CorelDRAW 就真的把稿子画出来、导出 PNG/PDF/可编辑 CDR。
仓库地址
平台 | 地址 |
GitHub(主仓) | |
Gitee(镜像) |
两仓内容保持一致;本地开发时各加一个远端,git push origin main && git push gitee main 即可同步。
Related MCP server: CorelDRAW Live MCP
特性
MCP Streamable HTTP 传输:标准协议,任何 MCP 客户端可接,不需要私有 SDK。
10 个原子工具:新建文档、矩形、椭圆、美术字、置入图片、导出、保存、查字体、看状态、整版渲染。
一次成稿:
cdr_render_ad吃一份 JSON 版式,一次渲染整张海报/展架/主图,直接出 PNG + PDF + CDR 三件套。COM 串行化:所有 CorelDRAW 调用跑在同一个 STA 线程队列里,并发请求排队执行,不会抢 COM 把 CDR 搞崩。
稳定导出:印刷级 PDF、300dpi/任意 dpi 的位图、可继续编辑的
.cdr源文件。令牌鉴权:Bearer Token 保护,服务只绑
127.0.0.1,公网必须过反代 + 令牌。崩溃自愈:附带守护脚本,服务进程挂了 5 秒自动拉起;配合 Windows 计划任务开机自启。
实测可用:已在 CorelDRAW Graphics Suite 2024(
CorelDRAW.Application.25,25.0.0.230)上跑通全流程并出过真实展架。
架构
AI 客户端(豆包 / Claude / 任意 MCP Client)
│ HTTPS + Authorization: Bearer <token>
▼
反向代理(Apache / Nginx / FRP,可选,用于公网访问)
│ http://127.0.0.1:18500
▼
server.py(FastMCP + 鉴权中间件 + /health)
│ 任务队列(单 STA 线程串行)
▼
cdr_core.py(pywin32 COM)
▼
CorelDRAW(本机桌面程序)环境要求
项 | 要求 |
操作系统 | Windows 10/11(CorelDRAW 只有 Windows 版) |
CorelDRAW | 2024(ProgID |
Python | 3.10+,64 位(必须与 CorelDRAW 位数一致) |
依赖 |
|
重要:CorelDRAW 必须至少手动启动过一次并完成登录/激活,COM 才能被自动化调用。
快速开始
# 1. 装依赖
pip install -r requirements.txt
# 2. 准备配置
copy config.example.json config.json
# 打开 config.json,把 token 换成你自己生成的长随机串
# 3. 启动服务
python server.py启动后:
健康检查:
http://127.0.0.1:18500/healthMCP 端点:
http://127.0.0.1:18500/mcp(需带Authorization: Bearer <token>)
接入 MCP 客户端
通用配置片段(Streamable HTTP)
{
"mcpServers": {
"coreldraw": {
"type": "streamable-http",
"url": "http://127.0.0.1:18500/mcp",
"headers": { "Authorization": "Bearer 你的令牌" }
}
}
}豆包 / 支持自定义连接器的客户端
填两项:
服务地址:
https://你的域名/mcp(或内网http://127.0.0.1:18500/mcp)请求头:
Authorization: Bearer 你的令牌
工具清单
工具 | 作用 | 关键参数 |
| 服务与当前文档状态 | 无 |
| 新建版面 |
|
| 矩形(支持圆角/描边) |
|
| 椭圆/正圆 |
|
| 美术字 |
|
| 置入本地图片 |
|
| 导出成品 |
|
| 另存 CDR |
|
| 查本机字体 |
|
| 整版渲染出稿 |
|
坐标与颜色约定
坐标原点:版面左上角,y 轴向下,单位默认毫米。
颜色:
#RRGGBB或cmyk(c,m,y,k);cmyk(0,80,100,0)这种可直接给印刷用。
版式 JSON 示例(cdr_render_ad)
{
"page": {"width": 800, "height": 1800, "unit": "mm", "dpi": 100},
"background": "#241209",
"elements": [
{"type": "rect", "x": 0, "y": 0, "w": 800, "h": 16, "fill": "#D99A2B"},
{"type": "text", "text": "油茶麻花", "x": 56, "y": 112, "size": 400, "font": "微软雅黑", "color": "#FFFFFF", "bold": true},
{"type": "image", "path": "C:/assets/hero.jpg", "x": 30, "y": 440, "w": 740, "h": 555},
{"type": "ellipse", "x": 600, "y": 200, "w": 90, "h": 90, "fill": "cmyk(0,80,100,0)"}
],
"export": {"formats": ["png", "pdf", "cdr"], "dpi": 100, "name": "展架"}
}完整示例见 jobs/展架示例-80x180.json。
命令行辅助脚本
脚本 | 用途 |
| 按 JSON 直接出稿 |
| 调任意工具,调试用 |
| 握手 + 列工具 + 查状态,验证服务可用 |
python scripts\verify.py
python scripts\render.py jobs\展架示例-80x180.json
python scripts\call.py cdr_list_fonts "{\"keyword\":\"雅黑\"}"部署成常驻服务(Windows)
1. 守护脚本:run_guard.py 用无窗口方式常驻,子进程退出 5 秒自动重启,日志写入 logs/。
2. 计划任务(管理员 PowerShell):
$动作 = New-ScheduledTaskAction -Execute 'D:\tools\py312\Python312\pythonw.exe' `
-Argument '"C:\cdr-connector\run_guard.py"' -WorkingDirectory 'C:\cdr-connector'
$触发 = @((New-ScheduledTaskTrigger -AtLogOn), (New-ScheduledTaskTrigger -AtStartup))
$设置 = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries `
-ExecutionTimeLimit ([TimeSpan]::Zero) -RestartCount 3 -RestartInterval (New-TimeSpan -Minutes 1) -MultipleInstances IgnoreNew
$主体 = New-ScheduledTaskPrincipal -UserId "$env:USERDOMAIN\$env:USERNAME" -LogonType Interactive -RunLevel Highest
Register-ScheduledTask -TaskName 'CDRConnector' -Action $动作 -Trigger $触发 -Settings $设置 -Principal $主体用
Interactive登录类型是必须的:CorelDRAW 是桌面程序,没有桌面会话就跑不起来。
3. 公网访问(可选):用 FRP/Nginx/Apache 把 127.0.0.1:18500 映射到 HTTPS 域名,注意:
关闭 gzip、开启
proxy-sendchunked,否则 SSE 会被缓冲导致 MCP 握手卡住;server.py里的allowed_hosts要加上你的域名,否则会被 DNS 重绑定保护拦成Invalid Host header。
踩坑备忘(都是实测踩出来的)
必须
gencache.EnsureDispatch("CorelDRAW.Application"):动态Dispatch拿不到Layer/Page的绘图方法。doc.Export(路径, 过滤器号, 1, None, None):Options/PaletteOptions是 VT_DISPATCH,必须显式传None,否则报 The Python instance can not be converted to a COM object。导出过滤器号:PNG=
802、JPEG=774、TIFF=713、BMP=764、GIF=766。别把 774 当 PNG。doc.SaveAs(路径, None):第二个参数同样不能省略。Layer.Import(路径, 0, None):省略 Filter/Options 会报 COM 转换错误;而且导入成功时返回值也可能是None,要用doc.ActivePage.Shapes.Item(1)取回刚导入的图形。CreateArtisticText的 FontName 参数不生效:中文一律回退成宋体。必须创建后设置形.Text.Story.Font = "字体名",粗体用形.Text.Story.Bold = True。Shape.PositionY是对象上边界(左下原点坐标系),定位要传「页高 − 目标 y」。SetSize对锁定比例的图片无效:改用形.SizeWidth = w/形.SizeHeight = h分别赋值。单位枚举:
in=1, mm=3, cm=4, px=5, pt=14, m=7。去描边:
形.Outline.Type = 0(cdrNoOutline)。
目录结构
.
├─ server.py # MCP 服务(工具定义 + 鉴权 + /health)
├─ cdr_core.py # CorelDRAW COM 内核(STA 串行)
├─ run_guard.py # 无窗口守护 + 崩溃自愈
├─ config.example.json # 配置模板
├─ requirements.txt
├─ scripts/
│ ├─ call.py # 通用工具调用器
│ ├─ render.py # 按版式 JSON 出稿
│ └─ verify.py # 连通性自检
├─ jobs/
│ └─ 展架示例-80x180.json # 80×180cm 展架完整版式
├─ assets/ # 图片素材放这里(默认不入库)
└─ docs/
└─ 安装部署.md安全提醒
config.json里的token等同于你电脑的控制权,不要提交到仓库、不要发群。仓库里只放config.example.json。服务默认只监听
127.0.0.1,不要把 18500 端口直接暴露到公网。公网暴露时务必:HTTPS + 强随机令牌 + 仅自己使用。
License
MIT © 2026 Lichong
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Direct AI video, image, music and storyboard production from any MCP client.
Brand-safe MCP for AI agents to create editable, on-brand graphics and automate variants.
OCR, transcription, file extraction, and image generation for AI agents via MCP.
The Canva MCP server connects AI assistants (like Claude, ChatGPT, and Cursor) to Canva's API, enabling them to create and manage designs directly within chat conversations. Key capabilities include generating new designs from prompts, autofilling templates, searching and resizing existing designs, importing files from URLs, exporting designs as PDFs or images, and managing folders and comments without switching between tools.
Related MCP Servers
- FlicenseNot gradedqualityCmaintenanceThis MCP server exposes CorelDRAW as a tool server, enabling AI agents to create documents, replace text, manipulate shapes, run preflight checks, and batch-export production files from natural language instructions via COM API.42-
- FlicenseNot gradedqualityDmaintenanceEnables control of an already open CorelDRAW document via MCP, with live editing, atomic undo, and safe coordinate-based operations. Supports Windows-only COM automation and integrates with desktop AI clients like Claude Desktop.12-
- FlicenseNot gradedqualityBmaintenanceEnables AI agents to drive CorelDRAW via COM API, creating and editing documents, replacing text, manipulating shapes, running preflight checks, and batch-exporting production files from natural language instructions.3-
- FlicenseNot gradedqualityBmaintenanceEnables AI clients such as Claude Desktop, Claude Code, Cursor, and VS Code to drive a local CorelDRAW instance through natural language via its COM API, covering batch image search and PowerClip placement, batch data/sign board production, org-chart generation, shape and bitmap import, and export. All edits run through session and version-checked atomic operations that roll back on error and can be undone in one step.2-