🐳 PenPot MCP服务器-Docker化
容器化版本 PenPot MCP服务器 通过Docker容器实现AI驱动的设计工作流自动化。
🚀 特性
- 容器化部署:使用Docker和Docker Compose轻松部署
- 多架构支持:适用于AMD64和ARM64架构
- 生产就绪:通过健康检查和监控进行生产优化
- 自动重启:容器在出现故障时会自动重新启动
- 体积持久性:缓存和数据的可选持久存储
- Redis集成:可选的Redis服务,用于改进缓存
- 注重安全:使用非root用户运行以增强安全性
📋 先决条件
- Docker引擎20.10+
- Docker Compose 2.0+
- Penpot帐户(免费注册)
🛠️ 快速开始
1.克隆存储库
git clone https://github.com/ajeetraina/penpot-mcp-docker.git
cd penpot-mcp-docker2.配置环境变量
# Copy the example environment file
cp .env.example .env
# Edit the .env file with your Penpot credentials
nano .env所需配置:
PENPOT_USERNAME=your_penpot_username
PENPOT_PASSWORD=your_penpot_password
PENPOT_API_URL=https://design.penpot.app/api3.使用Docker Compose进行部署
# Build and start the services
docker-compose up -d
# View logs
docker-compose logs -f penpot-mcp
# Check service status
docker-compose ps4.验证安装
# Check if the service is healthy
curl http://localhost:5000/health
# Test MCP server functionality
docker-compose exec penpot-mcp penpot-client🏗️ 替代部署方法
方法一:Docker运行(简单)
# Build the image
docker build -t penpot-mcp:latest .
# Run the container
docker run -d \
--name penpot-mcp-server \
--restart unless-stopped \
-p 5000:5000 \
-e PENPOT_USERNAME=your_username \
-e PENPOT_PASSWORD=your_password \
-e PENPOT_API_URL=https://design.penpot.app/api \
penpot-mcp:latest方法2:使用预构建图像(即将推出)
# Pull and run from Docker Hub (when available)
docker run -d \
--name penpot-mcp-server \
--restart unless-stopped \
-p 5000:5000 \
--env-file .env \
ajeetraina/penpot-mcp:latest⚙️ 配置
环境变量
| 变量 | 描述 | 默认值 | 必填 |
|---|---|---|---|
PENPOT_USERNAME | 您的Penpot用户名 | - | ✅ |
PENPOT_PASSWORD | 您的Penpot密码 | - | ✅ |
PENPOT_API_URL | Penpot API终点 | https://design.penpot.app/api | ✅ |
PORT | 服务器端口 | 5000 | ❌ |
DEBUG | 启用调试模式 | false | ❌ |
LOG_LEVEL | 日志记录级别 | INFO | ❌ |
MAX_CACHE_SIZE | 最大缓存文件数 | 100 | ❌ |
CACHE_EXPIRATION | 缓存过期时间(秒) | 3600 | ❌ |
卷
penpot_cache:/app/.cache-持久缓存存储redis_data:/data-Redis数据持久化(如果使用Redis)
健康检查
该容器内置了健康检查功能,用于监控:
- 端口5000上的服务器响应能力
- API与Penpot的连接
- 每30秒服务可用性
🔧 发展
在当地建设
# Clone the original source
git clone https://github.com/montevive/penpot-mcp.git source/
# Build with custom tag
docker build -t penpot-mcp:dev .
# Run in development mode
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up调试
# Access container shell
docker-compose exec penpot-mcp bash
# View detailed logs
docker-compose logs -f --tail=100 penpot-mcp
# Test API connection
docker-compose exec penpot-mcp python -c "import requests; print(requests.get('http://localhost:5000/health').json())"🔍 监控与维护
服务管理
# Start services
docker-compose up -d
# Stop services
docker-compose down
# Restart specific service
docker-compose restart penpot-mcp
# View resource usage
docker stats penpot-mcp-server日志和调试
# Follow logs in real-time
docker-compose logs -f penpot-mcp
# Export logs to file
docker-compose logs penpot-mcp > penpot-mcp.log
# Check container health
docker inspect --format='{{.State.Health.Status}}' penpot-mcp-server更新
# Pull latest changes
git pull origin main
# Rebuild and restart
docker-compose down
docker-compose build --no-cache
docker-compose up -d🔌 与AI工具集成
Claude桌面配置
添加到您的Claude Desktop配置中:
{
"mcpServers": {
"penpot": {
"command": "docker",
"args": ["exec", "penpot-mcp-server", "penpot-mcp"],
"env": {
"PENPOT_API_URL": "https://design.penpot.app/api",
"PENPOT_USERNAME": "your_username",
"PENPOT_PASSWORD": "your_password"
}
}
}
}游标IDE集成
使用容器化的MCP服务器配置Cursor:
{
"mcpServers": {
"penpot": {
"command": "docker",
"args": ["exec", "penpot-mcp-server", "penpot-mcp"]
}
}
}🚨 故障排除
常见问题
容器无法启动:
# Check logs for errors
docker-compose logs penpot-mcp
# Verify environment variables
docker-compose exec penpot-mcp env | grep PENPOT连接被拒绝:
# Check if port is available
netstat -tlnp | grep 5000
# Test internal connectivity
docker-compose exec penpot-mcp curl localhost:5000/health身份验证错误:
# Verify credentials
docker-compose exec penpot-mcp python -m penpot_mcp.api.penpot_api --debug list-projects性能调整
对于生产部署:
# Add to docker-compose.yml
services:
penpot-mcp:
deploy:
resources:
limits:
cpus: '2.0'
memory: 2G
reservations:
cpus: '0.5'
memory: 512M📚 API文档
运行后,MCP服务器提供以下端点:
GET /health-健康检查端点GET /server://info-服务器状态和信息GET /penpot://schema-Penpot API模式为JSONGET /penpot://tree-schema-Penpot对象树架构
可用的MCP工具:
list_projects-列出所有Penpot项目get_project_files-获取特定项目的文件get_file-按ID检索Penpot文件export_object-将Penpot对象导出为图像get_object_tree-获取对象树结构search_object-在文件中搜索对象
om/ajeetaina)| Docker队长兼ARM创新者
