Skip to content

Feature Request: Log File Size Management and Rotation #2975

Closed as not planned

Description

@AMoorer

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:

  1. Performance degradation: Large log files slow down log viewing and parsing during troubleshooting
  2. Disk space waste: Logs consume unnecessary space without automatic cleanup
  3. Troubleshooting obstruction: Ironically, oversized logs defeat their debugging purpose by becoming unwieldy
  4. 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

  1. Size-based rotation: When log file exceeds LOG_MAX_SIZE, rotate immediately
  2. Time-based rotation: Rotate at fixed intervals (e.g., daily at midnight)
  3. File naming convention: mcp-server-filesystem.log, mcp-server-filesystem.log.1, mcp-server-filesystem.log.2, etc.
  4. Automatic cleanup: Delete oldest log when LOG_MAX_FILES limit reached
  5. Graceful degradation: If rotation fails, log to stderr and continue operation

Describe alternatives you've considered

  1. External log rotation tools:

    • Windows Task Scheduler + batch scripts
    • Linux logrotate
    • Problem: Requires per-user configuration; not portable across installations
  2. Desktop Commander MCP: Includes 10MB auto-rotation but introduces complexity for users only needing basic filesystem access

  3. Manual periodic deletion: Impractical; most users unaware logs exist until problems arise

Additional context

Implementation Notes

Consider using established Node.js logging libraries with built-in rotation:

  • winston with winston-daily-rotate-file
  • pino with pino-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).

Activity

  1. olaservo commented on Nov 11, 2025

    @olaservo
    Member

    Hi @AMoorer , thanks for opening this! I think the preference would be for lightweight custom implementation and env variables for configuration.

  2. added
    server-filesystemReference implementation for the Filesystem MCP server - src/filesystem
    enhancementNew feature or request
    on Nov 11, 2025
  3. cliffhall commented on Oct 19, 2026

    @cliffhall
    Member

    Closing: not about the reference servers.

    Thank you for taking the time to file this, and apologies for the long wait for a response. Those log files are written by the Claude Desktop host from the server's stderr, so rotation belongs to the client, not the server. Since there's nothing to change in this repository, I'm closing it. This is not a judgment on the problem or on you. This is happening as part of the backlog triage in #4875.

    If you hit a problem in one of the reference servers themselves on the v2 release, please open a fresh issue with steps to reproduce; see CONTRIBUTING.md.

  4. added
    closed-out-of-scopeClosed: out of scope here; listings and new servers go to the MCP Registry (#4875)
    on Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed-out-of-scopeClosed: out of scope here; listings and new servers go to the MCP Registry (#4875)enhancementNew feature or requestserver-filesystemReference implementation for the Filesystem MCP server - src/filesystem

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions