file-writer-mcp
File Writer MCP Server
LM Studioやその他のMCP互換環境内でシームレスなファイル操作を行うために設計された、Model Context Protocol (MCP) のNode.js実装です。このサーバーは、大規模言語モデルがプレーンテキスト、Markdown、CSV、Microsoft Excel (XLSX) を含む複数の形式でファイルを作成、追記、管理するための堅牢なインターフェースを提供します。
機能
マルチフォーマット対応: .txt、.md、.csv、.xlsxファイルのデータ変換を処理します。
構造化データ処理: テーブルデータをJSONオブジェクトとして受け取り、要求された形式に自動的に変換します。
柔軟な書き込みモード:
追記 (デフォルト): 既存のファイルの末尾に新しいデータを追加します。
上書き: 既存のファイルを新しいコンテンツで置き換えます。
番号付きバックアップ: インクリメントされたバージョン(例: file.1.csv)を作成することで、既存のデータを保持します。
セキュリティ重視: すべてのファイル操作をユーザーが指定したルートディレクトリに制限し、不正なパストラバーサルを防ぎます。
Excel統合: ExcelJSを利用して、高精度のバイナリスプレッドシートファイルを生成します。
Related MCP server: Excel MCP Server
インストール
前提条件
Node.js (v18以上)
npm
セットアップ
リポジトリをクローンするか、ソースファイルをローカルマシンにコピーします。
必要な依存関係をインストールします:
npm installプロジェクトをビルドします:
npm run build
LM Studioの設定
LM Studioでこのサーバーを使用するには、以下の設定でMCP設定に追加してください:
{
"mcpServers": {
"file-writer": {
"command": "node",
"args": [
"C:/Users/szpon/file_writer_mcp/dist/index.js",
"--root",
"C:/your/default/directory"
]
}
}
}引数
--root <path>: (必須) 相対ファイル操作のデフォルトディレクトリへの絶対パス。--overwrite: (オプション/レガシー) 古い設定との互換性のために提供されています。ツール選択が優先されるため無視されます。--backup: (オプション/レガシー) 古い設定との互換性のために提供されています。ツール選択が優先されるため無視されます。
ツールの使用方法
このサーバーは、LM Studioのサイドバーから直接ファイル操作を明確に制御できるように、3つの異なるツールを提供します:
write_file: 標準的な操作に使用します。既存のファイルにデータを追記するか、存在しない場合は作成します。write_file_overwrite: 既存のファイルを新しいデータで完全に置き換える場合に使用します。write_file_backup: 元のデータを保持しながらデータを保存する場合に使用します。ファイルが存在する場合、番号付きバックアップ(例:data.1.csv)を作成します。
ツールの引数
path(string): ファイル名または完全な絶対パス。相対パスが指定された場合、--rootディレクトリに対して解決されます。絶対パスが指定された場合、サーバーはその場所に直接書き込みます。format(string): 希望するファイル拡張子 (txt、md、csv、またはxlsx)。data(object):headers(string[]): テーブル形式の列名。rows(any[][]): 書き込まれるデータセット。content(string, optional): .txtファイルのプレーンテキストコンテンツ。
開発
テストの実行
プロジェクトはユニットテストにVitestを使用しています。テストスイートを実行するには:
npm testビルド
TypeScriptソースを配布ディレクトリにコンパイルするには:
npm run buildライセンス
このプロジェクトは、LM Studioおよびその他のMCPクライアントとの統合のために現状のまま提供されます。
This server cannot be deployed
Maintenance
Related MCP Connectors
Safe folder access for ChatGPT and Claude: read, write and search files, risky tools opt-in.
11Manage files and folders directly from your workspace. Read and write files, list directories, cre…
Securely search and manage workspace context files for AI agents and teams.
Markdown workspace for AI agents: read, write, organize, and share markdown documents.
Related MCP Servers
- FlicenseAqualityDmaintenanceEnables secure filesystem operations with directory sandboxing and optional read-only mode. Supports file reading/writing, directory management, file searching, and text operations while restricting access to specified directories.12-
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to read, write, and manipulate Excel files through comprehensive spreadsheet operations. Supports file management, data querying, worksheet operations, formula calculations, and includes security features like path validation and automatic backups.2MIT
- AlicenseAqualityFmaintenanceEnables AI assistants to read, write, and manage files on the local system with security features like path restrictions and optional read-only mode.92MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to safely interact with the file system through a set of tools for reading, writing, deleting, copying, moving files, and managing directories.-