file-writer-mcp
Enables LLMs to write, append, and manage files in txt, md, csv, and xlsx formats with append, overwrite, and backup modes, restricted to a specified root directory.
README
File Writer MCP Server
A Node.js implementation of the Model Context Protocol (MCP) designed for seamless file operations within LM Studio and other MCP-compatible environments. This server provides a robust interface for large language models to create, append, and manage files in multiple formats including Plain Text, Markdown, CSV, and Microsoft Excel (XLSX).
Features
- Multi-Format Support: Handles data transformation for .txt, .md, .csv, and .xlsx files.
- Structured Data Processing: Accepts table data as JSON objects and converts them into the requested format automatically.
- Flexible Write Modes:
- Append (Default): Adds new data to the end of existing files.
- Overwrite: Replaces existing files with new content.
- Numbered Backup: Preserves existing data by creating incremented versions (e.g., file.1.csv).
- Security Focused: Restricts all file operations to a user-specified root directory to prevent unauthorized path traversal.
- Excel Integration: Utilizes ExcelJS for high-fidelity generation of binary spreadsheet files.
Installation
Prerequisites
- Node.js (v18 or higher)
- npm
Setup
- Clone the repository or copy the source files to your local machine.
- Install the required dependencies:
npm install - Build the project:
npm run build
Configuration for LM Studio
To use this server in LM Studio, add it to your MCP settings with the following configuration:
{
"mcpServers": {
"file-writer": {
"command": "node",
"args": [
"C:/Users/szpon/file_writer_mcp/dist/index.js",
"--root",
"C:/your/default/directory"
]
}
}
}
Arguments
--root <path>: (Required) The absolute path to the default directory for relative file operations.--overwrite: (Optional/Legacy) Provided for compatibility with older configs; ignored in favor of tool selection.--backup: (Optional/Legacy) Provided for compatibility with older configs; ignored in favor of tool selection.
Tool Usage
The server provides three distinct tools to give you clear control over file handling directly from the LM Studio sidebar:
write_file: Use this for standard operations. It appends data to existing files or creates them if they do not exist.write_file_overwrite: Use this to completely replace an existing file with new data.write_file_backup: Use this to save data while preserving the original. If the file exists, it creates a numbered backup (e.g.,data.1.csv).
Tool Arguments
path(string): The filename or full absolute path. If a relative path is provided, it resolves against the--rootdirectory. If an absolute path is provided, the server writes directly to that location.format(string): The desired file extension (txt,md,csv, orxlsx).data(object):headers(string[]): Column names for table formats.rows(any[][]): The dataset to be written.content(string, optional): Plain text content for .txt files.
Development
Running Tests
The project uses Vitest for unit testing. To execute the test suite:
npm test
Building
To compile the TypeScript source into the distribution directory:
npm run build
License
This project is provided as-is for integration with LM Studio and other MCP clients.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。