zip-mcp
An MCP tool that provides AI with the ability to compress and decompress local files.
Documentation
ZIP MCP Server
中文 | English
Project Introduction
ZIP MCP Server is a compression server based on fastMCP and zip.js, implementing the Model Context Protocol (MCP). This project provides fully parameter-controlled ZIP compression, decompression, and query compression package information functions.
Features
- Supports compression and decompression of files and data
- Supports multi-file packaging compression
- Provides compression level control (0-9)
- Supports password protection and encryption strength settings
- Provides query function for compressed package metadata
- Validates ZIP entry paths on decompression to prevent path traversal writes
Security
Versions 1.0.6 and later fix an arbitrary file write issue in the `decompress` tool: malicious ZIP entry names (for example `../outside.txt`) could previously be joined with the output directory and written outside the intended extraction root. Extraction now resolves the output root once, validates each entry path, and rejects absolute paths, drive-letter paths, `..` segments, and any path that would escape the output directory.
Thanks to Ryan (vonbrubeck@gmail.com) for responsibly reporting this issue.
Project Structure
zip-mcp
├── src
│ ├── index.ts # Application entry point
│ ├── utils
│ │ ├── compression.ts # Compression and decompression implementation
│ │ └── safePath.ts # Safe ZIP entry path validation
├── tsconfig.json # TypeScript configuration file
├── package.json # npm configuration file
└── README.md # Project documentationInstallation
You can install ZIP MCP Server globally using npm:
npm install -g zip-mcpMCP Configuration
After installation, you can configure ZIP MCP in your MCP JSON configuration:
{
"mcpServers": {
"zip-mcp": {
"command": "zip-mcp",
"args": []
}
}
}Configure the MCP JSON in the AI Client
- Claude Client: https://modelcontextprotocol.io/quickstart/user
- Raycast: requires installing the MCP plugin
- Cursor: https://docs.cursor.com/context/model-context-protocol#configuring-mcp-servers
MCP Tool Description
ZIP MCP Server provides the following tools, which can be called through the MCP protocol:
Compression Tool (compress)
Compress local files or directories into a ZIP file.
Parameters:
- `input`: Path of the file or directory to be compressed (string or string array)
- `output`: Path of the output ZIP file
- `options`: Compression options (optional)
- `level`: Compression level (0-9, default is 5)
- `password`: Password protection
- `encryptionStrength`: Encryption strength (1-3)
- `overwrite`: Whether to overwrite existing files (boolean)
Returns:
- Success: Text content containing success information
- Failure: Text content containing error information
Decompression Tool (decompress)
Decompress local ZIP files to the specified directory. Entry paths are validated before writing so files cannot be extracted outside `output` via `..` or absolute paths.
Parameters:
- `input`: Path of the ZIP file
- `output`: Path of the output directory
- `options`: Decompression options (optional)
- `password`: Decompression password
- `overwrite`: Whether to overwrite existing files (boolean)
- `createDirectories`: Whether to create non-existent directories (boolean)
Returns:
- Success: Text content containing decompression result information
- Failure: Text content containing error information
ZIP Info Tool (getZipInfo)
Get metadata information of local ZIP files.
Parameters:
- `input`: Path of the ZIP file
- `options`: Options (optional)
- `password`: Decompression password
Returns:
- Success: Text content containing detailed information of the ZIP file, including:
- Total number of files
- Total size
- Compressed size
- Compression ratio
- Detailed information of each file
- Failure: Text content containing error information
Test Tool (echo)
Returns the input message to test if the service is running normally.
Parameters:
- `message`: Message to be returned
Returns:
- Text content containing the input message and current timestamp
Examples
Examples of calling tools using the MCP client:
// Compress files
await client.executeTool("compress", {
input: "/path/to/files/or/directory",
output: "/path/to/output.zip",
options: {
level: 9,
comment: "Test compression",
password: "secret",
overwrite: true,
},
});
// Decompress files
await client.executeTool("decompress", {
input: "/path/to/archive.zip",
output: "/path/to/extract/directory",
options: {
password: "secret",
overwrite: true,
createDirectories: true,
},
});
// Get ZIP info
await client.executeTool("getZipInfo", {
input: "/path/to/archive.zip",
options: {
password: "secret",
},
});
// Test service
await client.executeTool("echo", {
message: "Hello, ZIP MCP Server!",
});Contact
- Email: gz7gugu@qq.com
- Blog: https://7gugu.com
Frequently asked questions
What is zip-mcp?
zip-mcp is An MCP tool that provides AI with the ability to compress and decompress local files.
How do I install zip-mcp?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is zip-mcp open source?
Yes — it is hosted on GitHub at https://github.com/7gugu/zip-mcp and has 16 stars.
Related MCP tools
Browser MCP is a Model Context Provider (MCP) server that allows AI applications to control your browser
The go-to web for your AI coding agent — local-first search, fetch, crawl & research over MCP. No API keys, no cloud, $0/query. Public beta.
Universal AI context generator. Saves thousands of tokens per conversation in Claude Code, Cursor, Copilot, Codex, and more.
Open-source cross-agent memory layer for coding agents via MCP. Compatible with Claude Code, Codex, Cursor, Windsurf, Gemini CLI, Antigravity, OpenClaw, Hermes Agent, Oh-my-Pi, Pi, Copilot, Kiro, OpenCode, and Trae.
AI Skills, MCP Tools, and CLI for Unity Engine. Full AI develop and test loop. Use cli for quick setup. Efficient token usage, advanced tools. Any C# method may be turned into a tool by a single line. Works with Claude Code, Gemini, Copilot, Cursor and any other absolutely for free.
Cut AI token costs 95%+ on code exploration. The leading MCP server for precise, symbol-level GitHub code retrieval via tree-sitter AST. Works with Claude Code, Cursor & any MCP client. 313B+ tokens saved.
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP