Skip to main content
Glama
bsmi021

Filesystem MCP Server

by bsmi021

ファイルシステムMCPサーバー

標準化されたツール インターフェイスを通じてファイル システムの操作、分析、および操作機能を提供するモデル コンテキスト プロトコル (MCP) サーバー実装。

建築

サーバーは MCP SDK 上に構築され、明確なレイヤーに編成されています。

graph TD
    A[MCP Server Layer] --> B[Tool Registry]
    B --> C[Operations Layer]
    C --> D[File System Operations]
    C --> E[Analysis Operations]
    C --> F[Stream Operations]

コンポーネント

  • サーバー層: MCPプロトコル通信とツールディスパッチを処理する

  • ツールレジストリ: ツールの登録と実行を管理します

  • 運用層: コア機能を実装する

  • ファイルシステムインターフェース:安全なファイルシステムアクセスを提供する

Related MCP server: MCP Filesystem Server

インストール

  1. リポジトリをクローンします。

git clone <repository-url>
cd filesystem-server
  1. 依存関係をインストールします:

npm install
  1. サーバーを構築します。

npm run build
  1. MCP 設定を構成します (cline_mcp_settings.json):

{
  "mcpServers": {
    "filesystem": {
      "command": "node",
      "args": ["path/to/filesystem-server/build/index.js"]
    }
  }
}

ツールリファレンス

ディレクトリ操作

リストディレクトリ

メタデータとともにディレクトリの内容を一覧表示します。

interface ListDirectoryParams {
    path: string;       // Directory path
    recursive?: boolean; // List recursively (default: false)
}

interface ListDirectoryResult {
    entries: {
        name: string;
        path: string;
        isDirectory: boolean;
        size: number;
        created: string;
        modified: string;
        accessed: string;
        mode: string;
    }[];
}

ディレクトリの作成

新しいディレクトリを作成します。

interface CreateDirectoryParams {
    path: string;       // Directory path
    recursive?: boolean; // Create parent directories (default: true)
}

ファイル操作

読み取りファイル

エンコード サポートを使用してファイルの内容を読み取ります。

interface ReadFileParams {
    path: string;     // File path
    encoding?: string; // File encoding (default: 'utf8')
}

書き込みファイル

コンテンツをファイルに書き込みます。

interface WriteFileParams {
    path: string;     // File path
    content: string;  // Content to write
    encoding?: string; // File encoding (default: 'utf8')
}

ファイル追加

ファイルにコンテンツを追加します。

interface AppendFileParams {
    path: string;     // File path
    content: string;  // Content to append
    encoding?: string; // File encoding (default: 'utf8')
}

分析操作

テキスト分析

テキスト ファイルのプロパティを分析します。

interface AnalyzeTextParams {
    path: string; // File path
}

interface AnalyzeTextResult {
    lineCount: number;
    wordCount: number;
    charCount: number;
    encoding: string;
    mimeType: string;
}

ハッシュを計算する

指定されたアルゴリズムを使用してファイル ハッシュを計算します。

interface CalculateHashParams {
    path: string;           // File path
    algorithm?: 'md5' | 'sha1' | 'sha256' | 'sha512'; // Hash algorithm
}

interface CalculateHashResult {
    hash: string;
    algorithm: string;
}

重複を見つける

ディレクトリ内の重複ファイルを識別します。

interface FindDuplicatesParams {
    path: string; // Directory path
}

interface FindDuplicatesResult {
    duplicates: {
        hash: string;
        size: number;
        files: string[];
    }[];
}

圧縮操作

作成_zip

ZIP アーカイブを作成します。

interface CreateZipParams {
    files: string[];  // Files to include
    output: string;   // Output ZIP path
}

抽出_zip

ZIP アーカイブを抽出します。

interface ExtractZipParams {
    path: string;    // ZIP file path
    output: string;  // Output directory
}

エラー処理

サーバーは標準の MCP エラー コードを使用します。

enum ErrorCode {
    ParseError = -32700,
    InvalidRequest = -32600,
    MethodNotFound = -32601,
    InvalidParams = -32602,
    InternalError = -32603
}

エラー応答には次のものがあります:

  • エラーコード

  • 人間が読めるメッセージ

  • 利用可能な場合の追加コンテキスト

エラー例:

{
    "code": -32602,
    "message": "File not found: /path/to/file.txt"
}

発達

プロジェクト構造

src/
├── operations/     # Core operations implementation
├── tools/         # MCP tool definitions and handlers
├── __tests__/     # Test suites
├── index.ts       # Entry point
├── server.ts      # MCP server setup
├── types.ts       # Type definitions
└── utils.ts       # Utility functions

テストの実行

テスト スイートを実行します。

npm test

カバレッジ付きで実行:

npm run test:coverage

開発モード

ウォッチモードで実行:

npm run watch

コード品質

コードベースをリントする:

npm run lint

型チェック:

npm run type-check

依存関係

コア依存関係:

  • @modelcontextprotocol/sdk: MCP サーバーの実装

  • ファイルタイプ: ファイルタイプの検出

  • mime-types: MIMEタイプの検索

  • crypto-js: ファイルハッシュ

  • アーカイバ:ZIP作成

  • extract-zip: ZIP抽出

  • iconv-lite: テキストエンコーディング

  • chardet: エンコーディング検出

開発依存関係:

  • Typescript: 型システム

  • jest: テスト

  • eslint: リンティング

  • prettier: フォーマット

  • ts-node: TypeScriptの実行

  • nodemon: 開発サーバー

貢献

  1. リポジトリをフォークする

  2. 機能ブランチを作成する

  3. 新機能のテストを書く

  4. すべてのテストに合格することを確認する

  5. プルリクエストを送信する

ライセンス

マサチューセッツ工科大学

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

No tool schema history has been recorded yet.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server that enables enhanced file system operations including reading, writing, copying, moving files with streaming capabilities, directory management, file watching, and change tracking.
    21
    MIT
  • A
    license
    A
    quality
    F
    maintenance
    A Model Context Protocol server that provides secure and intelligent interaction with files and filesystems, offering smart context management and token-efficient operations for working with large files and complex directory structures.
    21
    66
    MIT
  • A
    license
    C
    quality
    D
    maintenance
    A server implementing the Model Context Protocol that provides filesystem operations (read/write, directory management, file movement) through a standardized interface with security controls for allowed directories.
    9
    4
    MIT

Latest Blog Posts

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/bsmi021/mcp-filesystem-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server