GI

grumpydevorg/inkscape-mcps

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

59 stars 26 forks 质量 67 趋势 0MIT

grumpydevorg/inkscape-mcps 是从 https://github.com/grumpydevorg/inkscape-mcps. 导入的 MCP 服务器候选

概览

grumpydevorg/inkscape-mcps 是从 https://github.com/grumpydevorg/inkscape-mcps. 导入的 MCP 服务器候选

概述(AI 翻译)

一个安全、强化的MCP(模型上下文协议)服务器,用于Inkscape操作,既提供CLI操作,也提供DOM操作功能。

特色

  • CLI 操作:执行 Inkscape 命令行操作(导出、转换、路径操作)
  • DOM 操作:直接使用 CSS 选择器编辑 SVG DOM
  • 安全加固:工作区范围路径、大小限制、动作允许列表
  • 异步支持:带速率限制的非阻塞操作
  • 原子操作:安全写入文件和进程清理

安装

来自PyPI(发布时)

来自源头

用途

作为个人服务器

启动CLI服务器:

启动DOM服务器:

启动合并服务器(包括CLI和DOM工具):

配置

通过环境变量配置:

MCP 客户端集成

添加到你的MCP客户端配置(例如,Claude Desktop):

可用工具

CLI 工具 (inkscape-mcp-cli)

  • action_list - 列出所有可用的 Inkscape 动作
  • action_run - 对文档执行 Inkscape 操作

DOM 工具 (inkscape-mcp-dom)

  • dom_validate - 验证SVG文档结构
  • dom_set - 使用 CSS 选择器设置属性/样式

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Inkscape MCP Server

A secure, hardened MCP (Model Context Protocol) server for Inkscape operations, providing both CLI actions and DOM manipulation capabilities.

Features

  • CLI Actions: Execute Inkscape command-line actions (export, transforms, path operations)
  • DOM Manipulation: Direct SVG DOM editing with CSS selectors
  • Security Hardened: Workspace-scoped paths, size limits, action allowlists
  • Async Support: Non-blocking operations with rate limiting
  • Atomic Operations: Safe file writes and process cleanup

Installation

From PyPI (when published)

# Using uv (recommended)
uv add inkscape-mcp

# Using pip
pip install inkscape-mcp

From Source

git clone https://github.com/yourusername/inkscape-mcp
cd inkscape-mcp

# Quick development setup
./scripts/dev-setup

# Or manual setup
uv sync --dev         # Install with dev dependencies
uv build              # Build distribution packages

Usage

As Individual Servers

Start the CLI server:

inkscape-mcp-cli

Start the DOM server:

inkscape-mcp-dom  

Start combined server (both CLI and DOM tools):

inkscape-mcp

Configuration

Configure via environment variables:

export INKS_WORKSPACE="./my-workspace"  # Default: ./inkspace
export INKS_MAX_FILE="104857600"        # Default: 50MB
export INKS_TIMEOUT="120"               # Default: 60s
export INKS_MAX_CONC="8"                # Default: 4

MCP Client Integration

Add to your MCP client configuration (e.g., Claude Desktop):

{
  "mcpServers": {
    "inkscape-mcp": {
      "command": "inkscape-mcp",
      "env": {
        "INKS_WORKSPACE": "/path/to/workspace",
        "INKS_MAX_FILE": "52428800"
      }
    }
  }
}

Available Tools

CLI Tools (inkscape-mcp-cli)

  • action_list - List all available Inkscape actions
  • action_run - Execute Inkscape actions on documents

DOM Tools (inkscape-mcp-dom)

  • dom_validate - Validate SVG document structure
  • dom_set - Set attributes/styles using CSS selectors
  • dom_clean - Clean/optimize SVG using scour

Examples

Export SVG to PNG

# Via MCP client
await action_run({
    "doc": {"type": "file", "path": "input.svg"},
    "export": {"type": "png", "out": "output.png", "dpi": 300}
})

Modify SVG Elements

# Change fill color of all circles
await dom_set({
    "doc": {"type": "file", "path": "input.svg"},
    "ops": [{
        "selector": {"type": "css", "value": "circle"},
        "set": {"style.fill": "#ff6600"}
    }],
    "save_as": "modified.svg"
})

Path Operations

# Union selected paths
await action_run({
    "doc": {"type": "file", "path": "input.svg"},
    "actions": ["select-all", "path-union"]
})

Security Features

  • Workspace Scoping: All file operations restricted to configured workspace
  • Size Limits: Configurable file size caps prevent resource exhaustion
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "inkscape-mcp": { "command": "inkscape-mcp", "env": { "INKS_WORKSPACE": "/path/to/workspace", "INKS_MAX_FILE": "52428800" } } } }