shutil-mcp
An MCP server providing asynchronous shell utilities using aioshutil.
This project offers a set of file system tools designed for AI agents, returning structured JSON output instead of raw text. This allows for more precise and direct consumption of file system data by AI models.
Features
- Asynchronous Operations: Leverages
aioshutiland thread executors for non-blocking file system tasks. - JSON Output: All tools return minified JSON, optimized for AI agents.
- Tool Annotations & Hints: Declares
readOnlyHint,destructiveHint,idempotentHint, andopenWorldHinton every tool for agent safety and host warnings. - Jail Support: Restrict file system access to a specific directory tree for security.
- Verification & Integrity:
mvandcpverify destination data before unlinking or finalizing, preventing data loss on partial failures. - Reversible Mutations & Undo:
chmodandchownreturn previous modes and ownership to facilitate immediate undo/redo, with automatic rollback on failure. - Safe Deletion & Recovery:
rmalways soft-deletes into.trash(never permanently deletes) and reports trash size and storage usage;restorerecovers items,gc_trashcollects expired items, andempty_trashpurges the trash. - Zip-Slip Protection:
unpack_archivevalidates all archive member paths against directory traversal / zip-slip attacks. - Detailed Metadata: Tools like
lsandstatprovide comprehensive information (size, mtime, mode, owner, etc.). - HTTP Transport Support: Includes built-in support for SSE and Streamable HTTP transports.
Available Tools
ls: List directory contents with detailed metadata.cp: Copy files or directories recursively with verification and overwrite protection.mv: Move/rename files or directories with safe pre-removal verification.rm: Soft-delete by moving to.trash; never permanently deletes and reports trash statistics.restore: Restore files or directories from trash (defaults to original path).empty_trash: Permanently purge the trash folder (only after explicit user confirmation).gc_trash: Garbage-collect expired trash entries based on age threshold.mkdir: Create a new directory.touch: Create an empty file or update file timestamps.chmod: Change file/directory permissions with rollback and previous mode.chown: Change file/directory ownership with rollback and previous owner.stat: Get detailed file or directory metadata.disk_usage: Get disk usage statistics for a path.which: Find the path to an executable.cat: Read file content, optionally limited to a specific line range.glob: Find files matching glob patterns.grep: Search file contents using regex patterns.tree: Get a recursive directory tree as nested JSON.make_archive: Create archive files (zip, tar, etc.) with overwrite guards.unpack_archive: Unpack archive files safely with zip-slip protection.get_archive_formats: List supported archive formats.
Installation
Using Poetry (Recommended)
# Clone the repository
git clone <repository-url>
cd shutil-mcp
# Install dependencies
poetry install
# Optional: Install with performance enhancements (uvloop / winloop)
poetry install --all-extras
Using pip
# Install from PyPI
pip install shutil-mcp
# Or install in editable mode with speed dependencies
pip install -e ".[speed]"
Usage
Standard Input/Output (stdio) - Default Mode
shutil-mcp --transport stdio
With jail restriction:
shutil-mcp --transport stdio --jail /path/to/projects
HTTP Transports (SSE and/or Streamable HTTP)
For web-based MCP clients (such as llama.cpp WebUI), you can run with HTTP transport:
# SSE only (compatible with llama.cpp WebUI)
shutil-mcp --transport sse --jail /path/to/projects --port 8000
# Streamable HTTP only
shutil-mcp --transport streamable-http --jail /path/to/projects --port 8000
# Both SSE and Streamable HTTP on the same server
shutil-mcp --transport sse streamable-http --jail /path/to/projects --port 8000
Endpoints:
- SSE:
http://localhost:8000/sse - Streamable HTTP:
http://localhost:8000/mcp
Options:
--transport: Transport protocol(s) (stdio,sse,streamable-http, default:stdio)--port: Port to listen on (default: 8000)--host: Host to bind to (default: 0.0.0.0)--jail: Required for HTTP transports. Restrict file system operations to this directory tree for security.--api-key: Optional. Enable mandatory API key authentication (X-API-KeyorAPI-Keyheader).
Development
See DEVELOPMENT.md for detailed development instructions.
Running Tests
poetry run pytest -n auto
Code Quality
# Run linting and auto-fix issues
./scripts/lint-check-and-fix.sh
# Run static type checking (strict mode)
./scripts/type-check.sh
# Run code formatter and trailing whitespace cleanup (cross-platform Linux & macOS)
./scripts/code-format.sh
License
MIT
Metadata
Release files for shutil-mcp 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| shutil_mcp-1.0.0.tar.gz | 23.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| shutil_mcp-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 50.9 kB
Release files / shutil_mcp-1.0.0.tar.gz
| Download URL | shutil_mcp-1.0.0.tar.gz |
|---|---|
| Size | 23.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
78bcdf08c0ffa73458880f0eca42f34b3dfa9685f5b31409dd8444ee0fa9b615
|
|
BLAKE2b-256 checksum How to use checksums |
d0928329e3bc02df15c523a6f984f1bf3ea24bc1ad2509777f3addc8ea41ce44
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.14.7 Darwin/27.0.0
|
Release files / shutil_mcp-1.0.0-py3-none-any.whl
| Download URL | shutil_mcp-1.0.0-py3-none-any.whl |
|---|---|
| Size | 27.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1b96bf332f9d4750a5dd37d7dba76471f80e7efd41d0e781c6956c8f45c16b27
|
|
BLAKE2b-256 checksum How to use checksums |
3e4703d79b4bd6752dcf70706aed987e324b59025db47227add1b9cbc6b00df2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.14.7 Darwin/27.0.0
|