fs-mcp
fs-mcp
6つのツールを公開する小さなMCPサーバー:
explore_filesystem(subpath?, glob?)— ルートディレクトリ配下のファイル/フォルダを一覧表示します。オプションでグロブ(**/*.jsなど)によるフィルタリングが可能です。edit_file(path, edits[], createIfMissing?)— ルート配下のファイルにgitスタイルの行編集(行範囲の置換 / 挿入 / 削除)を適用します。create_file(path, content?, overwrite?)— オプションのコンテンツ付きで新しいファイルを作成し、必要に応じて親ディレクトリも作成します。delete_file(path, recursive?)— ルート配下のファイルまたはディレクトリを削除します(空でないディレクトリの場合はオプションで再帰的に削除)。read_file(path, startLine?, endLine?)— ファイルの内容を読み取ります。オプションで行範囲に限定し、行番号を先頭に付加します。grep(pattern, glob?, useRegex?, caseInsensitive?)— ファイル内のテキストパターンを検索します。オプションで正規表現のサポートとグロブフィルタリングが利用可能です。
ルート = プロセスの起動時の作業ディレクトリです。
グローバルCLIとしてインストール
npm install
npm link # or: npm install -g .これにより、グローバルな fs-mcp コマンドが利用可能になります(package.json の bin フィールド経由で接続されます)。
Related MCP server: LocalFS MCP Server
実行方法
fs-mcp # stdio mode (default) — for Claude Desktop/Code,
# which spawn the process themselves
fs-mcp --http # HTTP mode on http://localhost:4823/mcp — for
# curl, the MCP Inspector, or the on-demand
# Claude Desktop setup below
fs-mcp --http -p 5000 # custom port
fs-mcp --help実行時にいるフォルダが、公開されるルートになります。
Claude Desktopへの接続
Claude DesktopはMCPサーバーを自ら起動し、stdio経由で通信します。ターミナルのカレントディレクトリは引き継がれません。そのため、作業方法に応じて2つのセットアップオプションがあります。
オプションA — 任意のフォルダからオンデマンドで使用(CLI感覚を重視する場合に推奨)
Desktopを一度だけ設定し、固定フォルダではなく固定ローカルポートを指定します。claude_desktop_config.example.json を参照してください。その "fs-mcp" エントリを、以下の場所にある既存の mcpServers オブジェクトにマージします:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
Claude Desktopを一度再起動します。以降は:
cd ~/whatever/project
fs-mcp --httpサーバーが実行されている間、そのフォルダがClaudeから見える範囲になります。Ctrl+C で停止し、別のフォルダから再度起動するとコンテキストを切り替えられます。Desktopの設定をさらに変更する必要はありません。
注: --allow-http が必要なのは、mcp-remote(stdio↔HTTPブリッジ)がデフォルトで実際のリモートサーバーに対してHTTPS + OAuthを期待するためです。このフラグは、認証なしのプレーンな localhost トラフィックで問題ないことを伝えます。
オプションB — 固定フォルダを常時公開
Desktopに常に同じプロジェクトを公開させたい場合で、手動で何かを起動したくない場合は:
{
"mcpServers": {
"fs-mcp": {
"command": "fs-mcp",
"cwd": "/absolute/path/to/the/folder/you/want/exposed"
}
}
}Desktopを再起動します。これはstdioモードを直接使用します。プロキシも手動の fs-mcp --http ステップも不要ですが、公開するフォルダを変更するには、この設定を編集してDesktopを再度再起動する必要があります。
セキュリティに関する注意
すべてのパスはルートに対して解決され、ルートから外れる場合(例:
../../etc/passwd)は拒否されます。パストラバーサルテストで検証済みです。認証はありません。サーバーに到達できるもの(
--httpモードでは任意のローカルプロセス)は、ルート配下の任意のファイルを読み書きできます。信頼できるローカル開発用途では問題ありません。機密性の高い場所で実行したり、localhostを超えてバインドしたりしないでください。
編集セマンティクス(edit_file)
編集は {startLine, endLine, newLines} で、1始まりで両端を含みます:
3〜5行目を置換:
{startLine: 3, endLine: 5, newLines: ["new content"]}3〜5行目を削除:
{startLine: 3, endLine: 5, newLines: []}6行目の前に挿入(削除なし):
{startLine: 6, endLine: 5, newLines: ["inserted"]}
1回の呼び出しで複数の編集を行う場合、内部では下から上へ適用されるため、先行する編集が適用されても編集リストの行番号はずれません。
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceEnables reading, creating, and editing files on the local filesystem through operations like view, create, string replacement, and line insertion.1613MIT
- FlicenseNot gradedqualityDmaintenanceProvides sandboxed access to local filesystem operations including directory and file management, content search with glob and regex patterns, and binary file support with configurable safety limits.
- FlicenseNot gradedqualityDmaintenanceEnables file system operations such as listing, reading, and creating files within a scoped local project directory. It provides a secure way to manage local files through standardized MCP tools built with FastMCP.
- FlicenseAqualityDmaintenanceEnables listing, reading, and searching local files and directories through MCP tools.4
Related MCP Connectors
Securely search and manage workspace context files for AI agents and teams.
Personal assistant MCP server with search, execute, packages, jobs, secrets, and integrations.
Agent-native MCP server over the public saagarpatel.dev corpus. Read-only, stateless.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Polarts/fs-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server