Claude-MCP

adriancs2/Claude-MCP

3.2

If you are the rightful owner of Claude-MCP and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

Enhanced FileSystem MCP Server is a robust Model Context Protocol server designed to enhance Claude Desktop's capabilities in file editing, database operations, and document processing.

Tools
4
Resources
0
Prompts
0

Enhanced FileSystem MCP Server

A powerful Model Context Protocol (MCP) server built in C# that gives Claude Desktop surgical precision for file editing, database operations, and document processing.

.NET Framework C# License Tools

Article: Building a Self-Improving MCP Server Tool for Claude Desktop in C# (Console App)


Why This Exists

Claude Desktop's built-in file tools are limited. You can't:

  • Edit a specific line by number
  • Target the 3rd occurrence of a pattern when there are 10 matches
  • Make multiple edits to a file without line numbers shifting
  • Read Excel or Word documents directly
  • Execute MySQL queries

This MCP server solves all of that.


Features

📁 Surgical File Editing

  • Line-number precision — Edit line 47, not "find and replace"
  • Nth occurrence targeting — Edit the 3rd match, leave others untouched
  • Batch editing — Multiple edits to same file with automatic bottom-up sorting
  • Automatic backups — Every edit creates a backup, one-click undo

📊 Document Reading

  • Excel — Read sheets, ranges, search across cells
  • Word — Extract paragraphs, tables, search content

🗄️ MySQL Database

  • Execute queries — SELECT, INSERT, UPDATE, DELETE
  • Schema exploration — List databases, tables, columns
  • Batch queries — Multiple queries in one transaction
  • Variable passing — Use LAST_INSERT_ID() across queries

🌐 HTTP Requests

  • GET/POST/PUT/DELETE — Full REST API support
  • File downloads — Save responses to disk
  • Custom headers — Authentication, content-type, etc.

🛡️ Safety First

  • Allowed directories — Restrict access to specific paths
  • Caller validation — Only Claude Desktop can invoke tools
  • Automatic backups — Created before every edit
  • Undo support — Restore from any backup

Quick Start

1. Download

Download the latest EnhancedFileSystemMCP.zip from the releases page.

2. Extract

Extract the zip file to a folder of your choice, for example:

D:\Claude Files\EnhancedFileSystemMCP

3. Configure Allowed Directories

Create allowed_directories.txt in the same folder as the .exe:

D:\Projects
D:\Documents
C:\Users\YourName\Code

4. Configure Claude Desktop

Edit %APPDATA%\Claude\claude_desktop_config.json:

If the file contains only {}, replace it with:

{
  "mcpServers": {
    "enhanced-filesystem": {
      "command": "D:\\Claude Files\\EnhancedFileSystemMCP\\EnhancedFileSystemMCP.exe",
      "args": []
    }
  }
}

Important: Replace D:\\Claude Files\\EnhancedFileSystemMCP\\EnhancedFileSystemMCP.exe with your actual installation path. Use double backslashes (\\) in the path.

5. Restart Claude Desktop

The tools are now available. Ask Claude to list_allowed_directories to verify.


Tool Categories

CategoryToolsExamples
File Reading6read_file_lines, find_pattern, find_all_occurrences
File Editing5replace, insert_at, insert_after, delete, edit_nth_occurrence
Batch Editing1batch_edit (auto-sorts for safe multi-edit)
Find & Replace4replace_all, replace_regex, replace_in_line_range
Multi-File2find_in_files, replace_in_files
File Management7write_file, copy_file, move_file, delete_file
Directory4list_directory, create_directory, file_exists
Safety6backup_file, undo_last_edit, list_backups, compare_files
Excel5read_excel_text, read_excel_sheet, read_excel_range
Word4read_word_text, read_word_paragraphs, read_word_tables
HTTP3http_get, http_post, http_request
MySQL5mysql_select, mysql_execute, mysql_schema
Batch Reading2batch_read_files, batch_read_files_ranges
Batch MySQL4batch_mysql_queries, batch_mysql_queries_with_variables

Total: 58 tools


Example Usage

Edit a Specific Line

User: "Change line 45 to use async/await"
Claude: *calls replace(path, start_line=45, content="await ProcessAsync();")*

Edit One of Many Identical Lines

User: "Change the timeout in the database config, not the API config"
Claude: *calls find_all_occurrences* → sees 5 matches with context
Claude: *calls edit_nth_occurrence(occurrence=2)* → edits only the database one

Batch Edit with Auto-Sorting

User: "Add logging to lines 50, 100, and 150"
Claude: *calls batch_edit with all 3 edits*
→ Server auto-sorts to 150, 100, 50 (bottom-up)
→ All edits hit correct targets

Create Invoice with Line Items (MySQL)

User: "Create an invoice for customer 123 with 3 items"
Claude: *calls batch_mysql_queries_with_variables*
→ INSERT invoice → store {invoice_id}
→ INSERT items using {invoice_id}
→ SELECT totals → store {total}
→ UPDATE invoice with {total}
→ All in one transaction, auto-rollback on error

MySQL Configuration

Create mysql_constr.txt in the same folder as the .exe:

Server=localhost;Database=mydb;User=root;Password=secret;

Architecture

EnhancedFileSystemMCP/
├── Program.cs                 # Entry point
├── Protocol/
│   ├── McpServer.cs          # MCP JSON-RPC implementation
│   └── JsonRpcModels.cs      # Request/response models
├── Security/
│   ├── CallerValidator.cs    # Claude Desktop validation
│   └── PathValidator.cs      # Allowed directories enforcement
├── Services/
│   ├── FileOperations.cs     # Core file manipulation
│   ├── BackupService.cs      # Automatic backup handling
│   └── BatchSafetyValidator.cs # Bottom-up sort for batch edits
└── Tools/
    ├── FileReadingTools.cs
    ├── FileEditingTools.cs
    ├── DocumentReadingTools.cs
    ├── HttpTools.cs
    ├── MySqlTools.cs
    └── ...

Safety Features

Allowed Directories

Only paths listed in allowed_directories.txt can be accessed. Any attempt to read/write outside these directories is blocked.

Caller Validation

The server validates that requests come from Claude Desktop's process. Direct calls are rejected.

Automatic Backups

Every file edit creates a timestamped backup in the backups/ folder. Use undo_last_edit to restore instantly.

Batch Edit Safety

When making multiple edits to the same file, line numbers can shift and cause corruption. The batch_edit tool automatically sorts edits bottom-up (highest line first) to prevent this.


Requirements

  • Windows (tested on Windows 10/11)
  • .NET Framework 4.8
  • Claude Desktop
  • MySQL Server (optional, for database tools)

Dependencies


License

The unlicense license.


Acknowledgments

Built with human-AI collaboration (Claude Opus 4.5, Sonnet 4.5)