mcp-file-rwle
v1.0.18
Published
A simple MCP server to read, write, edit, and list files inside a folder.
Maintainers
Readme
🗂️ File_RWLE — MCP File Server
A simple Model Context Protocol (MCP) server built using Node.js that allows you to read, write, list, edit, and delete files inside a workspace folder.
🚀 Features
- 📄 List files inside a workspace
- 📖 Read files with full content access
- ✍️ Write/Create files with custom content
- ✏️ Edit specific lines in existing files
- 🗑️ Delete files when needed
- 🧩 Works seamlessly with MCP-compatible clients like Claude Desktop and Cursor
🧠 How It Works
This MCP server uses the @modelcontextprotocol/sdk library to expose five powerful tools:
list_files- Lists all files in the workspaceread_file- Reads and returns file contentwrite_file- Creates or overwrites a fileedit_file- Edits specific lines in a filedelete_file- Deletes a file from the workspace
These tools can be accessed through any MCP-compatible client (like Cursor or Claude Desktop).
📦 Quick Start (Using npm package)
The easiest way to use this MCP server is through npm:
Step 1: Add to your MCP configuration
Add this to your claude_desktop_config.json or MCP settings file:
{
"mcpServers": {
"file_rwle": {
"command": "npx",
"args": ["-y", "mcp-file-rwle"]
}
}
}Step 2: Restart your MCP client
Restart Claude Desktop or Cursor and the server will be automatically downloaded and started!
Step 3: Use it!
Your AI assistant can now:
- Create files in your workspace
- Read and edit existing files
- List all files in the workspace
- Delete files when needed
🛠️ Local Development Setup
Want to modify or contribute? Follow these steps:
Step 1: Clone the repository
git clone https://github.com/suvidhay/File_RWLE.git
cd File_RWLEStep 2: Install dependencies
npm installStep 3: Test locally
npm startThe server will start and create a workspace folder in your current directory if it doesn't exist.
🧪 Manual Testing
You can test file operations directly in Node.js:
nodeThen run these commands:
import fs from "fs";
import path from "path";
const ROOT_DIR = path.join(process.cwd(), "workspace");
// Create a test file
fs.writeFileSync(path.join(ROOT_DIR, "test.txt"), "Hello MCP!");
// List files
console.log(fs.readdirSync(ROOT_DIR)); // ['test.txt']
// Read the file
console.log(fs.readFileSync(path.join(ROOT_DIR, "test.txt"), "utf-8")); // Hello MCP!🌍 Publishing Your Own Version
Want to publish your modified version to npm?
Step 1: Update package.json
Change the package name to something unique:
{
"name": "your-mcp-file-server",
"version": "1.0.0",
...
}Step 2: Login to npm
npm loginStep 3: Publish
npm publish --access publicStep 4: Use your package
{
"mcpServers": {
"my_file_server": {
"command": "npx",
"args": ["-y", "your-mcp-file-server"]
}
}
}📂 Workspace Folder
- All file operations happen inside a
workspacefolder - The folder is automatically created in your current working directory
- Files are isolated to this folder for safety
🔧 Configuration Locations
For Claude Desktop:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.jsonFor Cursor:
Check Cursor's MCP settings in the application preferences.
🐛 Troubleshooting
Server not connecting?
- Make sure you've restarted your MCP client after adding the configuration
- Check that Node.js is installed:
node --version - Verify the configuration JSON syntax is correct
Files not appearing?
- The
workspacefolder is created in the directory where the server runs - Check the working directory of your MCP client
Permission errors?
- Ensure you have write permissions in the directory
- On macOS/Linux, you might need to allow terminal access in System Preferences
🛡️ Available Tools
1. list_files
Lists all files in the workspace folder.
Input: None
Output: Array of filenames
2. read_file
Reads the content of a specific file.
Input:
filename(string): Name of the file to read
Output: File content as text
3. write_file
Creates a new file or overwrites an existing one.
Input:
filename(string): Name of the filecontent(string): Content to write
Output: Success confirmation
4. edit_file
Edits specific lines in an existing file.
Input:
filename(string): Name of the file to editedits(array): Array of{ line: number, newText: string }objects
Output: Success confirmation with number of lines edited
5. delete_file
Deletes a file from the workspace.
Input:
filename(string): Name of the file to delete
Output: Success confirmation
📝 Example Usage
Once configured, you can ask your AI assistant:
"Can you create a file called notes.txt with 'Hello World'?"
"List all files in my workspace"
"Read the contents of notes.txt"
"Edit line 1 of notes.txt to say 'Hello MCP!'"
"Delete the file notes.txt"
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
📄 License
This project is licensed under the MIT License.
🧑💻 Author
Suvidha Yadav
- GitHub: @suvidhay
- Package: mcp-file-rwle
🙏 Acknowledgments
- Built with @modelcontextprotocol/sdk
- Uses Zod for schema validation
