# filesystem-edit-mcp

An MCP (Model Context Protocol) server for filesystem operations with encoding support and umlaut fixing for C++ code.

## Features

- **read_text_file**: Read files with configurable encoding per file extension
- **edit_file**: Edit files with pattern matching and automatic umlaut fixing
- **Path validation**: Security boundary enforcement via `ALLOWED_DIRS`
- **Encoding support**: Configure encodings per file pattern (e.g., latin-1 for `.cpp`)
- **Umlaut fixing**: Transform German umlauts in C++ string literals, comments, and character constants

## Installation

```bash
uvx filesystem-edit-mcp
```

## Configuration

Add to your MCP client config:

```json
{
  "filesystem-edit-mcp": {
    "command": "uvx",
    "args": ["filesystem-edit-mcp"],
    "env": {
      "ALLOWED_DIRS": "/path/to/allowed/dir1:/path/to/dir2",
      "SERVER_CONFIG": "/path/to/server_config.json"
    }
  }
}
```

### Environment Variables

- `ALLOWED_DIRS`: Colon-separated list of directories the server can access
- `SERVER_CONFIG`: Path to the server configuration file (default: `server_config.json`)

### Server Config

```json
{
  "umlaut_config": {
    "string_mapping": { "Ä": "CAE_UMLT", "ä": "AE_UMLT" },
    "comment_mapping": { "Ä": "Ae", "ä": "ae" },
    "char_mapping": { "Ä": "CAE_UMLT_CHAR" }
  },
  "encoding_config": {
    "default": "utf-8",
    "mapping": { "*.cpp": "latin-1", "*.h": "latin-1" }
  }
}
```

## License

MIT
