#1869·servers

Filesystem MCP server modified .env without permission and did not back it up

Author: milispCreated May 21, 2025Updated Sep 16, 2026
Labelsbugserver-filesystem

Describe the bug Claude Desktop (via the Filesystem MCP server) modified my .env file without consent when I asked a question about a Docker-related ConnectionRefusedError. It tried to “fix” a Tortoise ORM connection string issue by overwriting my file using the write_file command. However, it didn’t even read the .env file before modifying it, nor did it back it up. This led to loss of important config data I hadn’t committed.

To Reproduce Steps to reproduce the behavior:

  1. Ask Claude (with the MCP server using filesystem) a question involving Docker and a Tortoise ORM connection string error.

  2. Claude tries to “fix” it automatically using write_file, modifying .env directly.

  3. File is overwritten without confirmation or backup.

Expected behavior Claude or the MCP server should:

  • Never modify important user files like .env without explicit confirmation.

  • At minimum, back up the original file before overwriting.

Logs Error I originally asked about:

/Users/gpt/projects/rustapp/mcp-linker-api/docker-compose.yml 
ConnectionRefusedError: [Errno 111] Connection refused

Claude’s attempted “fix”:

# Creates a .env file with a guessed Tortoise ORM connection string

Additional context This issue could lead to silent data loss in projects where .env is not committed. Claude needs user confirmation step before file operations via MCP servers like filesystem.

Source: modelcontextprotocol/servers