modelcontextprotocol / modelcontextprotocol/servers
Feature Request: Log File Size Management and Rotation
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 90.5k
- Forks
- 11.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 5
Description
Is your feature request related to a problem?
Yes. The @modelcontextprotocol/server-filesystem MCP server generates unbounded log files in %APPDATA%\Claude\logs\mcp-server-filesystem*.log (Windows) / ~/Library/Logs/Claude/ (macOS) that can grow to excessive sizes (17+ MB observed), creating several issues:
- Performance degradation: Large log files slow down log viewing and parsing during troubleshooting
- Disk space waste: Logs consume unnecessary space without automatic cleanup
- Troubleshooting obstruction: Ironically, oversized logs defeat their debugging purpose by becoming unwieldy
- User maintenance burden: Manual cleanup required, which most users won't perform regularly
Describe the solution you'd like
Add configurable log rotation with size-based and/or time-based triggers:
Proposed Configuration Options
Environment Variables:
MCP_FILESYSTEM_LOG_MAX_SIZE=10485760 # Max log size in bytes (default: 10MB)
MCP_FILESYSTEM_LOG_MAX_FILES=5 # Number of rotated logs to retain (default: 5)
MCP_FILESYSTEM_LOG_ROTATION=size # Rotation strategy: 'size', 'time', or 'both' (default: size)
MCP_FILESYSTEM_LOG_INTERVAL=86400 # Rotation interval in seconds (default: daily)
Alternative: Command-line Arguments:
npx @modelcontextprotocol/server-filesystem \
--log-max-size 10M \
--log-max-files 5 \
--log-rotation size \
/path/to/allowed/dir
Rotation Behavior
- Size-based rotation: When log file exceeds
LOG_MAX_SIZE, rotate immediately - Time-based rotation: Rotate at fixed intervals (e.g., daily at midnight)
- File naming convention:
mcp-server-filesystem.log,mcp-server-filesystem.log.1,mcp-server-filesystem.log.2, etc. - Automatic cleanup: Delete oldest log when
LOG_MAX_FILESlimit reached - Graceful degradation: If rotation fails, log to stderr and continue operation
Describe alternatives you've considered
-
External log rotation tools:
- Windows Task Scheduler + batch scripts
- Linux
logrotate - Problem: Requires per-user configuration; not portable across installations
-
Desktop Commander MCP: Includes 10MB auto-rotation but introduces complexity for users only needing basic filesystem access
-
Manual periodic deletion: Impractical; most users unaware logs exist until problems arise
Additional context
- Related discussion: Issue #1879 proposes environment variable configuration; log management would complement that effort
- Community need: Multiple users report log bloat issues in Discord/support channels
- Reference implementation: Desktop Commander MCP successfully implements 10MB rotation
Implementation Notes
Consider using established Node.js logging libraries with built-in rotation:
winstonwithwinston-daily-rotate-filepinowithpino-roll- Or lightweight custom implementation (~50 LOC)
Default to conservative settings (10MB max, 5 file retention) to balance disk usage against debugging needs.
Would you be willing to submit a PR?
Potentially, depending on maintainer guidance regarding preferred implementation approach (library vs. custom, env vars vs. CLI args).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the @modelcontextprotocol/server-filesystem logging entry point and checking how its Windows and macOS log paths are configured. Compare the proposed environment-variable and command-line options, then define rotation behavior, retention limits, failure handling, and tests that demonstrate bounded log files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- backend, observability-sre
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100