PSD文件检查导出工具

一款基于MCP协议的服务器工具,用于检查和导出Adobe Photoshop(PSD)文件,支持图层树查看、详细图层信息获取及多种格式导出。

  • by signal-slot
  • C++
  • 混合部署
  • 更新于
在 GitHub 查看 signal-slot/mcp-psd2x

使用说明

mcp-psd2x

用于检查和导出Adobe Photoshop(PSD)文件的MCP(模型上下文协议)服务器。内置于 QtMcp 和 QtPsd.

工具

工具 参数 说明
load_psd path 加载PSD文件以供检查和导出
get_layer_tree 获取完整的层层次结构
get_layer_details layerId 获取图层的详细信息(文本运行、形状路径、链接文件、不透明度、导出提示)
get_layer_image layerId 获取特定层的渲染图像(作为MCP图像内容返回)
set_export_hint layerId, type, options 配置导出图层的方式
do_export format, outputDir, options 将PSD导出为目标格式
list_exporters 列出可用的导出器插件
save_hints 将导出提示保留到 .psd_ sidecar文件

set_export_hint

  • 图层ID (int)--要配置的层ID
  • 类型 (字符串)-- embed, merge, custom, native, skip,或 none
  • 选项 (string)--带可选键的JSON对象:
    • visible (bool)--导出时该层是否可见
    • componentName (string)--组件名称 custom 类型
    • baseElement (字符串)-- Container, TouchArea, Button,或 Button_Highlighted 为了 native 类型

do_导出

  • 格式 (string)--导出器插件密钥(例如。 QtQuick, Flutter, SwiftUI)
  • outputDir (string)--输出目录的绝对路径
  • 选项 (string)--带可选键的JSON对象:
    • width (int)--输出宽度(像素)(0或省略=原始)
    • height (int)--输出高度(像素)(0或省略=原始)
    • fontScaleFactor (double)--字体比例因子(默认值:1.0)
    • imageScaling (bool)--启用图像缩放(默认值:false)
    • makeCompact (bool)--启用压缩输出(默认值:false)

构建

需要Qt 6。

使用子模块(推荐)

git clone --recursive https://github.com/signal-slot/mcp-psd2x.git
cd mcp-psd2x
./build.sh

或者,如果已经克隆:

git submodule update --init --recursive
./build.sh

使用外部构建

如果你有 QtMcp 和 QtPsd 单独建造:

cmake -B build -DQT_ADDITIONAL_PACKAGES_PREFIX_PATH="<qtmcp-build>;<qtpsd-build>"
cmake --build build

用法

stdio(默认)

使用子模块构建:

export QT_PLUGIN_PATH="$PWD/build-qtmcp/lib64/qt6/plugins:$PWD/build-qtpsd/lib64/qt6/plugins"
./build/mcp-psd2x

对于外部构建:

export QT_PLUGIN_PATH="<qtmcp-build>/lib64/qt6/plugins:<qtpsd-build>/lib64/qt6/plugins"
./build/mcp-psd2x

上海证券交易所

./build/mcp-psd2x --backend sse --address 127.0.0.1:8000

Claude桌面配置

使用子模块构建:

{
  "mcpServers": {
    "psd2x": {
      "command": "/path/to/mcp-psd2x/build/mcp-psd2x",
      "env": {
        "QT_PLUGIN_PATH": "/path/to/mcp-psd2x/build-qtmcp/lib64/qt6/plugins:/path/to/mcp-psd2x/build-qtpsd/lib64/qt6/plugins",
        "LD_LIBRARY_PATH": "/path/to/mcp-psd2x/build-qtmcp/lib64:/path/to/mcp-psd2x/build-qtpsd/lib64"
      }
    }
  }
}

许可证

BSD-3条款