mcp-local-sandbox-cleaner
It's an MCP server for finding and cleaning up the leftover junk coding agents create in a workspace — scratch files, test caches — and for checking whether dev ports are still occupied.
Scan for artifacts (
scan_sandbox_artifacts): lists known junk names (.scratch,.agent-tmp,tmp_test_output,.pytest_cache,.coverage,coverage,.turbo,.tsbuildinfo) directly under a workspace root, non-recursively, with each path's last-modified age; optionally skip anything newer thanminAgeMinutes.Delete artifacts (
clean_sandbox_artifacts): removes exactly what the scan would list, with adryRunflag to preview andminAgeMinutesas a guard against wiping directories an agent is still writing to. Note it ignores git, so tracked files inside matched directories are deleted too.Check dev ports (
inspect_dangling_dev_ports): reports which of the given ports (default 3000, 3001, 5173, 5174, 8000, 8080, 8888) are occupied. It does not identify the owning process and does not kill anything — a live dev server and a zombie look identical.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-local-sandbox-cleaner scan my workspace for leftover AI scratch files and show what a dry run would delete"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-local-sandbox-cleaner
An MCP server that finds the junk coding agents leave behind in a workspace: scratch directories, test caches, and dev ports that may no longer be serving anything. It can delete the files; it only reports the ports.
Not published to npm — build it from source.
Install
pnpm install
pnpm buildPoint your MCP client at dist/index.js:
{
"mcpServers": {
"sandbox-cleaner": {
"command": "node",
"args": ["/absolute/path/to/mcp-local-sandbox-cleaner/dist/index.js"]
}
}
}Related MCP server: DevGuard-MCP
Tools
scan_sandbox_artifacts
Lists matching paths and how long ago each was modified.
Argument | Type | Meaning |
| string | Workspace root. |
| number | Skip anything modified more recently than this. Defaults to 0. |
Looks for these names directly under the workspace root, no recursion:
.scratch, .agent-tmp, tmp_test_output, .pytest_cache, .coverage,
coverage, .turbo, .tsbuildinfo.
.tsbuildinfo is matched as that exact filename, so it will not catch the
tsconfig.tsbuildinfo files the TypeScript compiler actually writes. The list
is a plain array at the top of src/index.ts; edit it to suit your workspace.
clean_sandbox_artifacts
Deletes what scan_sandbox_artifacts would list.
Argument | Type | Meaning |
| string | Workspace root. |
| boolean | Report without deleting. Defaults to false. |
| number | Skip recently modified paths. Defaults to 0. |
Two things to know before running this without dryRun:
It does not consult git. A tracked file inside
.scratch/is deleted like anything else. Run withdryRun: truefirst if that matters.coverageis matched by name at the workspace root. If you keep real source in a directory calledcoverage, it goes.
minAgeMinutes is the guard against deleting a directory an agent is still
writing to. Set it to something like 15 to leave in-flight work alone.
inspect_dangling_dev_ports
Reports which of the given ports are in use. Defaults to
3000, 3001, 5173, 5174, 8000, 8080, 8888.
It does not identify the owning process and does not kill anything. Despite the name, the check is just "is this port occupied" — a healthy dev server and a zombie one look the same.
On Windows the match goes through findstr, which is a substring test: probing
3000 also reports listeners on 13000 and 30000. On Linux it uses
lsof -i, which matches the port exactly.
License
MIT. See LICENSE.
Available Tools
3 toolsclean_sandbox_artifactsC
Safely sweep verified transient files and directories to recover disk space and maintain repository cleanliness.
Inputs: workspacePath (required), dryRun, minAgeMinutes.
inspect_dangling_dev_portsA
Detect orphaned local development ports (e.g. 3000, 5173, 8000, 8080) left behind by stopped agent runs.
Inputs: ports.
scan_sandbox_artifactsC
Scan a target workspace for dangling temporary test outputs, agent scratches, and bloated caches, with optional file age threshold.
Inputs: workspacePath (required), minAgeMinutes.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool has a clearly distinct role: scan detects artifacts, clean removes them, and inspect targets orphaned development ports. There is no meaningful overlap between artifact detection, artifact cleanup, and port inspection.
All tool names follow a consistent snake_case verb_noun pattern: scan_sandbox_artifacts, clean_sandbox_artifacts, and inspect_dangling_dev_ports. The convention is predictable and readable.
Three tools are well-scoped for a focused sandbox cleaner, with each operation earning its place. The surface covers detection, cleanup, and a related diagnostics check without bloat.
The core artifact lifecycle is covered by scan and clean, and port inspection adds useful diagnostics. However, dangling ports can only be detected, not terminated or reclaimed, leaving a minor operational gap.
Maintenance
Related MCP Connectors
Checks AI-written code for leaked keys and made-up packages, on your machine. Never uploads code.
Lets coding agents check their own code for leaked secrets, risky dependencies and AI-code mistakes
Scores your code across 12 areas, with findings, fix prompts, and re-assessment in your AI agent
Lints + auto-fixes how AI coding agents discover any new product. 24 rules, 6 tools, score 0-100.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables LLM agents to safely reclaim disk space by deleting build artifact directories like node_modules, .venv, and target, with strong guardrails to prevent accidental or malicious deletion.70 PyPIMIT
- AlicenseAqualityBmaintenanceEnables AI assistants to audit and clean development workspaces safely by detecting reclaimable artifacts, exposed .env files, and potential secret leaks.6MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to scan a developer machine for disk space hogs, audit git worktrees for stale or orphaned ones, re-check individual findings, and run allowlisted cleanup actions as dry runs unless explicitly confirmed. Risky items are reported with warnings and refused by default.1,042 npm2MIT
- AlicenseNot gradedqualityBmaintenanceFind the disk clutter and leftover processes coding agents leave behind (worktrees, crash dumps, old sessions) and safely clean only what's SAFE.1MIT