本项目仓库包含一个用于管理 Printful 应用程序产品的 MCP(中心控制面板)服务器。借助该服务器,用户可通过 API 对产品进行创建、读取、更新和删除等操作。
要运行这个项目,需要满足以下条件:
git clone https://github.com/username/printify-mcp.git
cd printify-mcp
npm install
docker-compose up --build
npm run dev
以下是一个使用此 MCP 创建产品的简单示例:
import { createProduct } from './printify-api';
const main = async () => {
try {
const product = await createProduct({
title: 'My New Product',
description: 'This is a test product.',
images: ['path/to/image1.jpg', 'path/to/image2.jpg']
});
console.log('Product created successfully:', product);
} catch (error) {
console.error('Error creating product:', error.message);
}
};
main();
如需了解代码的详细信息,请参考以下文档文件:
项目源代码位于 src 文件夹中,以下是关键文件的简要说明:
项目使用以下 npm 包:
@types/node:Node.js 类型定义express:Web 框架typescript:静态类型支持@types/express:Express 类型定义dotenv:环境变量管理multer:文件上传处理若遇到错误信息“Printful API client is not initialized”,请检查以下内容:
.env 文件中的 PRINTFUL_API_KEY 环境变量是否正确设置。若遇到错误信息“Replicate client is not initialized”,请检查以下内容:
.env 文件中的 REPLICATE_API_TOKEN 是否正确设置。若在创建产品过程中出现错误,请检查以下内容:
如需帮助或报告问题,请联系项目维护人员:support@printify.com
printify-mcp/
├── src/ # 源代码文件夹
│ ├── index.ts # 项目入口点
│ ├── printify-api.ts # Printful API 实现模块
│ └── replicate-client.ts # 图片上传处理模块
├── docs/ # 文档文件夹
│ ├── index.ts.md # index.ts 的详细文档
│ └── ...
├── package.json # 项目依赖和脚本信息
├── docker-compose.yml # Docker 容器配置文件
└── .env.example # 环境变量示例文件
如果希望为这个项目做贡献,请遵循以下步骤:
git clone https://github.com/username/printify-mcp.gitgit checkout -b feature/new-featuregit add . && git commit -m 'Add new feature'git push origin feature/new-feature项目使用 MIT 许可证,具体内容如下:
MIT License
docker build -t printify-mcp .
docker run -p 3000:3000 --env-file .env printify-mcp
在 .env 文件中,至少需要设置以下环境变量:
PRINTFUL_API_KEY=your_api_key_here
REPLICATE_API_TOKEN=your_token_here
NODE_ENV=development
PORT=3000
Printful 支持的图片格式包括 JPG、PNG 和 GIF。图片的最大尺寸为 5000px × 5000px,文件大小不超过 20MB。
感谢您对 Printify 的支持!如果有任何问题,请随时联系我们的支持团队。