Token导航 LogoToken导航TokenDH.com
inkMCP (Franciscoparrao) logo
运维云端stdio官方级别未说明来源级核验

inkMCP (Franciscoparrao)

MCP Server

一个通过自然语言指令实时控制Inkscape的MCP服务器,支持AI助手直接操作矢量图形。

工具数

1

提示词数

0

GitHub Stars

1

资源数

0
PythonClaude自然语言处理Claude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

franciscoparrao

提供方

franciscoparrao

最后核验

2026/5/17 20:22

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

python inkmcpcli.py execute-hybrid -f script.py

详细介绍

Inkscape MCP服务器

一种模型上下文协议(MCP)服务器,通过自然语言指令实现对Inkscape的实时控制。这使得像克劳德这样的人工智能助手能够实时直接操纵矢量图形。

特性

  • 🎯 实时实例控制 -直接操作正在运行的Inkscape文档
  • D-Bus集成 -实时通信
  • 🚀 通用元素创建 -使用统一语法创建任何SVG元素
  • 🏗️ 分层场景管理 -具有自动ID冲突处理的语义组织
  • 📐 Python代码执行 -在实时上下文中运行任意inkex代码
  • 🖼️ 屏幕截图支持 -视口捕捉的视觉反馈

平台支持

  • ⚠️ 目前仅限Linux -使用特定于Linux的D-Bus
  • 🔮 未来:可通过TCP套接字/命名管道实现跨平台支持

快速开始

1.安装(仅限Linux)

  1. 发布页面
  2. 下载 inkmcp-extension.zip 从最新版本
  3. 将其解压缩到Inkscape扩展目录:
   cd ~/.config/inkscape/extensions/
   unzip ~/Downloads/inkmcp-extension.zip

2.使脚本可执行

cd ~/.config/inkscape/extensions/inkmcp
chmod +x run_inkscape_mcp.sh inkmcpcli.py inkscape_mcp_server.py main.py

3.启动Inkscape

正常启动Inkscape-扩展程序在菜单中隐藏,只能通过D-Bus访问。

4.连接AI工具

自动设置:AI客户端第一次连接时,它将自动:

  • 在中创建Python虚拟环境 ~/.config/inkscape/extensions/inkmcp/venv/
  • 从安装所有必需的依赖项 requirements.txt
  • 启动MCP服务器

无需手动设置!

克劳德代码

编辑您的Claude配置文件:

# ~/.claude/claude-config.json
{
  "mcpServers": {
    "inkscape": {
      "command": "/home/USERNAME/.config/inkscape/extensions/inkmcp/run_inkscape_mcp.sh"
    }
  }
}

拟人克劳德桌面

更新Claude桌面应用程序设置:

{
  "mcpServers": {
    "inkscape": {
      "command": "/home/USERNAME/.config/inkscape/extensions/inkmcp/run_inkscape_mcp.sh"
    }
  }
}

谷歌双子座/Codex

对于Gemini,编辑设置文件:

# ~/.gemini/settings.json
{
  "mcpServers": {
    "inkscape-mcp": {
      "command": "/home/USERNAME/.config/inkscape/extensions/inkmcp/run_inkscape_mcp.sh"
    }
  }
}

对于Codex,编辑配置:

# ~/.codex/config.toml
[mcp_servers.inkscape-mcp]
command = "/home/USERNAME/.config/inkscape/extensions/inkmcp/run_inkscape_mcp.sh"

使用示例

使用AI助手(Claude Code/GGemini等)-需要运行Inkscape

"In Inkscape, draw a smooth sine wave starting at the left edge in the middle of the document and apply power stroke path effect to it"
"In Inkscape, create a beautiful logo with a radial gradient circle and elegant typography"
"In Inkscape, draw a mathematical spiral using varying circle sizes with golden ratio"
"In Inkscape, create a house illustration with gable roof, wooden door, and flower garden"
"In Inkscape, design a data visualization chart with bars with hatch fill and labels using current document size"
"In Inkscape, export the current document as high-resolution PNG for presentation"

可用的MCP工具

inkscape操作 -适用于所有Inkscape操作的通用工具:

  • 创建任何SVG元素(圆形、矩形、文本、路径、渐变等)
  • 在实时上下文中执行Python/inkex代码
  • 获取文档/选择信息
  • 导出视口屏幕截图
  • 使用组创建分层元素
  • 自动ID冲突处理

混合执行

通过自动变量共享在多个Python上下文中无缝执行代码!

执行混合CLI命令

使用魔术注释将本地Python执行与Inkscape操作交错:

# @local
import random
points = [(random.randint(10, 200), random.randint(10, 200)) for _ in range(5)]

# @inkscape
for x, y in points:
    circle = Circle()
    circle.set("cx", str(x))
    circle.set("cy", str(y))
    svg.append(circle)

特征:

  • 🔄 全双向可变流量(局部↔ Inkscape)
  • 🎯 get_element_by_id() 用于可靠元素查找的辅助函数
  • ⚠️ 具有快速失败行为的完整错误跟踪

用途:

python inkmcpcli.py execute-hybrid -f script.py

Blender Inkscape插件

将曲线和数据从Blender实时传输到Inkscape!

安装:

  1. Blender>编辑>首选项>附加组件>安装
  2. 选择 blender_addon_inkscape_hybrid.py
  3. 启用“脚本:Inkscape混合执行”
  4. 将INKMPC_CLI_PATH设置为 /path/to/inkmcp/inkmcpcli.py

用途:

# @local - Runs in Blender
import bpy
curve = bpy.context.object
segs = [list(pt.co[:2]) for spline in curve.data.splines 
        for pt in spline.bezier_points]

# @inkscape - Runs in Inkscape via D-Bus
for x, y in segs:
    circle = Circle()
    circle.set("cx", str(x * 100))
    svg.append(circle)

运行方式: 文本>运行混合代码 (或Ctrl+Shift+H)

特征:

  • ✨ 从Blender文本编辑器一键执行
  • 🔄 自动变量序列化
  • ⚠️ 非序列化Blender对象的有用警告
  • 🎨 实时贝塞尔曲线到Inkscape的转换

例子: blender_paste_example.py -完整的贝塞尔曲线可视化

注: Blender对象(矢量等)必须转换为列表以进行JSON序列化。

BLENDER_HYBRID_README.md 详细文档。

技术细节

建筑

  • 扩展: inkscape_mcp.py -通过D-Bus触发Inkscape扩展
  • MCP服务器: inkscape_mcp_server.py -FastMCP服务器处理AI请求
  • CLI客户端: inkmcpcli.py -用于测试的直接命令行界面
  • 运营: inkmcpops/ -模块化操作处理器

沟通流程

AI Assistant → MCP Server → CLI Client → D-Bus → Inkscape Extension → Live Document

高级用法

直接CLI使用(用于测试/开发)

# In the inkmcp directory - bypasses AI assistant for direct control

# Basic shapes
python inkmcpcli.py circle "cx=100 cy=100 r=50 fill=red"
python inkmcpcli.py rect "x=0 y=0 width=200 height=100 stroke=blue"

# Gradients
python inkmcpcli.py linearGradient "x1=0 y1=0 x2=200 y2=200 stops='[[\"0%\",\"green\"],[\"50%\",\"yellow\"],[\"100%\",\"red\"]]'"

# Code execution
python inkmcpcli.py execute-code "code='circle = inkex.Circle(); circle.set(\"cx\", \"150\"); circle.set(\"cy\", \"100\"); circle.set(\"r\", \"25\"); svg.append(circle)'"

# Document info
python inkmcpcli.py get-info

# Selection info
python inkmcpcli.py get-selection

# Export screenshot
python inkmcpcli.py export-document-image "format=png max_size=800"

任意代码执行

在实时Inkscape上下文中执行任何Python/inkex代码:

# Create complex shapes programmatically
code = '''
rect = Rectangle()
rect.set('x', '10')
rect.set('y', '20')
rect.set('width', '100')
rect.set('height', '50')
rect.set('style', 'fill:blue;stroke:red;stroke-width:2')
svg.append(rect)
'''

故障排除

常见问题

  1. 未找到D-Bus:确保您在运行D-Bus会话的Linux上
  2. 扩展未触发:检查Inkscape是否正在运行以及是否安装了扩展
  3. Python环境:确保虚拟环境已激活并具有依赖关系
  4. 权限:确保脚本可执行(chmod +x *.sh *.py)

调试模式

# Check D-Bus connection
gdbus introspect --session --dest org.inkscape.Inkscape --object-path /org/inkscape/Inkscape

# Structured JSON output
python inkmcpcli.py get-info --parse-out --pretty

发展

添加新操作

  1. 在中创建新文件 inkmcpops/
  2. 实施 execute(svg, params) 函数
  3. 在中添加相应的MCP工具 inkscape_mcp_server.py

许可证

GPL-3.0

目录标签

目录标签

PythonClaude自然语言处理矢量图形控制本地部署AI集成实时操作D-Bus通信

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

session

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

1

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiosession部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP