TinyPNG的MCP服务器为图像压缩提供了便捷的服务,支持本地和远程图像的压缩,可与Claude Desktop集成使用。
bun或node运行服务器pnpm i
pnpm build
mcp.json文件{
"mcpServers": {
"tinypng": {
"command": "bun", // 或 "node"
"args": ["/path/to/tinypng-mcp-server/src/index.ts"], // 或 "dist/index.js"
"env": {
"TINYPNG_API_KEY": "your-tinypng-api-key"
}
}
}
}
若要通过 Smithery 自动为Claude Desktop安装TinyPNG MCP服务器,可执行以下命令:
npx -y @smithery/cli install @aiyogg/tinypng-mcp-server --client claude
{
name: 'compress_local_image',
description: 'Compress a local image file',
inputSchema: {
type: 'object',
properties: {
imagePath: {
type: 'string',
description: 'The ABSOLUTE path to the image file to compress',
example: '/Users/user/Downloads/image.jpg',
},
outputPath: {
type: 'string',
description: 'The ABSOLUTE path to save the compressed image file',
example: '/Users/user/Downloads/image_compressed.jpg',
},
outputFormat: {
type: 'string',
description: 'The format to save the compressed image file',
enum: SUPPORTED_IMAGE_TYPES,
example: 'image/jpeg',
},
},
required: ['imagePath'],
},
}
{
name: 'compress_remote_image',
description: 'Compress a remote image file by giving the URL of the image',
inputSchema: {
type: 'object',
properties: {
imageUrl: {
type: 'string',
description: 'The URL of the image file to compress',
example: 'https://example.com/image.jpg',
},
outputPath: {
type: 'string',
description: 'The ABSOLUTE path to save the compressed image file',
example: '/Users/user/Downloads/image_compressed.jpg',
},
outputFormat: {
type: 'string',
description: 'The format to save the compressed image file',
enum: SUPPORTED_IMAGE_TYPES,
example: 'image/jpeg',
},
},
required: ['imageUrl'],
},
}