MCP 服务器,用于管理桌面图片、查看详情、压缩、移动等(完全让Trae实现)
What is zhixiaoqiang desktop image manager mcp
Desktop Image Manager MCP Server
基于 Model Context Protocol (MCP) 开发的桌面图片管理服务器,提供图片文件统计、查看和压缩功能。
操作示例:
https://claude.ai/share/0ffbad1e-502e-4188-b008-0bb966acf06d
功能特性
- 统计桌面图片数量:快速获取桌面上的图片文件总数
- 获取图片列表:列出桌面上所有图片文件的名称
- 图片压缩:支持压缩 JPG、PNG、WebP 等格式的图片文件,可自定义压缩质量
实现提示
让 Trae 引用 ./demand.md
进行功能代码生成,简化版如下
... (这里是已经引入的 domain knowledge)
打造一个 MCP 服务器,它能够:
- 功能:
- 统计当前桌面上的图片文件数量
- 获取对应文件的名称
- 支持压缩图片
要求:
- 不需要给出 prompt 和 resource 相关代码。
- 你可以假设我的桌面路径为 /Users/{username}/Desktop
支持的图片格式
- JPG/JPEG
- PNG
- GIF
- BMP
- WebP
- TIFF
- SVG
环境要求
- Node.js >= 16
- pnpm >= 8
安装
# 克隆项目
git clone <repository-url>
cd desktop-image-manager
# 安装依赖
pnpm install
开发
# 启动开发服务器
pnpm dev
构建和运行
# 构建项目
pnpm build
# 运行服务器
pnpm start
调试
# 调试 MCP 服务
pnpm inspector
MCP 工具使用说明
1. 统计桌面图片数量
# 构建项目
pnpm build
# 运行服务器
pnpm start
2. 获取图片列表
// 工具名称: list-desktop-images
// 参数: 无
await client.callTool({
name: "list-desktop-images"
});
3. 压缩图片
// 工具名称: compress-image
// 参数:
// - fileName: 要压缩的图片文件名
// - quality: 压缩质量 (1-100),默认 80
// - outputName: 输出文件名(可选)
await client.callTool({
name: "compress-image",
arguments: {
fileName: "example.jpg",
quality: 75,
outputName: "example-compressed.jpg"
}
});
开发
# 启动开发服务器
pnpm dev
安装
使用 Claude Desktop 添加如下配置 config:
MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"desktop-image-manager": {
"command": "npx",
"args": [
"-y",
"@jzone-mcp/desktop-image-manager-mcp"
]
}
}
注意事项
- 确保有足够的桌面访问权限
- 大文件压缩可能需要较长时间
- 压缩后的文件默认保存在桌面,文件名会添加 "-compressed" 后缀
技术栈
- TypeScript
- MCP SDK
- Sharp (图片处理)
- fs-extra (文件操作)
- zod (参数验证)
许可证
MIT License
这个 README 文件包含了项目的主要信息、安装说明、使用方法和注意事项。如果您需要添加或修改任何内容,请告诉我。
Leave a Comment
Frequently Asked Questions
What is MCP?
MCP (Model Context Protocol) is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications, providing a standardized way to connect AI models to different data sources and tools.
What are MCP Servers?
MCP Servers are lightweight programs that expose specific capabilities through the standardized Model Context Protocol. They act as bridges between LLMs like Claude and various data sources or services, allowing secure access to files, databases, APIs, and other resources.
How do MCP Servers work?
MCP Servers follow a client-server architecture where a host application (like Claude Desktop) connects to multiple servers. Each server provides specific functionality through standardized endpoints and protocols, enabling Claude to access data and perform actions through the standardized protocol.
Are MCP Servers secure?
Yes, MCP Servers are designed with security in mind. They run locally with explicit configuration and permissions, require user approval for actions, and include built-in security features to prevent unauthorized access and ensure data privacy.
Related MCP Servers
chrisdoc hevy mcp
sylphlab pdf reader mcp
An MCP server built with Node.js/TypeScript that allows AI agents to securely read PDF files (local or URL) and extract text, metadata, or page counts. Uses pdf-parse.
aashari mcp server atlassian bitbucket
Node.js/TypeScript MCP server for Atlassian Bitbucket. Enables AI systems (LLMs) to interact with workspaces, repositories, and pull requests via tools (list, get, comment, search). Connects AI directly to version control workflows through the standard MCP interface.
aashari mcp server atlassian confluence
Node.js/TypeScript MCP server for Atlassian Confluence. Provides tools enabling AI systems (LLMs) to list/get spaces & pages (content formatted as Markdown) and search via CQL. Connects AI seamlessly to Confluence knowledge bases using the standard MCP interface.
prisma prisma
Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB
Zzzccs123 mcp sentry
mcp sentry for typescript sdk
zhuzhoulin dify mcp server
zhongmingyuan mcp my mac
zhixiaoqiang antd components mcp
An MCP service for Ant Design components query | 一个减少 Ant Design 组件代码生成幻觉的 MCP 服务,包含系统提示词、组件文档、API 文档、代码示例和更新日志查询
yeonupark mcp soccer data
An MCP server that provides real-time football data based on the SoccerDataAPI.
Submit Your MCP Server
Share your MCP server with the community
Submit Now