WebDAV MCP Server

by LaubPlusCo
Verified

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Supports configuration through .env files to set WebDAV connection parameters, authentication credentials, and server options.

  • Provides containerized deployment of the MCP server with configurable environment variables for WebDAV connectivity and authentication.

  • Offers programmatic usage within Node.js applications through an importable API for custom MCP server implementations.

WebDAV MCP サーバー

WebDAVエンドポイントで基本認証によるCRUD操作を可能にするモデルコンテキストプロトコル(MCP)サーバー。このサーバーにより、Claude Desktopやその他のMCPクライアントは、自然言語コマンドを使用してWebDAVファイルシステムと対話できるようになります。

特徴

  • オプションの認証を使用して任意のWebDAVサーバーに接続します
  • ファイルとディレクトリに対してCRUD操作を実行する
  • ファイル操作をMCPリソースおよびツールとして公開する
  • stdio トランスポート (Claude Desktop 統合用) または HTTP/SSE トランスポート経由で実行
  • オプションの基本認証による安全なアクセス
  • MCP サーバー認証用の bcrypt 暗号化パスワードのサポート (プロトコルの制限により、WebDAV パスワードはプレーンテキストである必要があります)
  • WebDAV サーバーのパフォーマンスを向上させる接続プール
  • Zodを使用した構成検証
  • トラブルシューティングを向上させる構造化されたログ

前提条件

  • Node.js 18以降
  • npmまたはyarn
  • WebDAV サーバー (実際のファイル操作用)

インストール

オプション1: npmパッケージからインストールする

# Global installation npm install -g webdav-mcp-server # Or with npx npx webdav-mcp-server

オプション2: ソースからクローンしてビルドする

# Clone repository git clone https://github.com/yourusername/webdav-mcp-server.git cd webdav-mcp-server # Install dependencies npm install # Build the application npm run build

オプション3: Docker

# Build the Docker image docker build -t webdav-mcp-server . # Run the container without authentication docker run -p 3000:3000 \ -e WEBDAV_ROOT_URL=http://your-webdav-server \ -e WEBDAV_ROOT_PATH=/webdav \ webdav-mcp-server # Run the container with authentication for both WebDAV and MCP server docker run -p 3000:3000 \ -e WEBDAV_ROOT_URL=http://your-webdav-server \ -e WEBDAV_ROOT_PATH=/webdav \ -e WEBDAV_AUTH_ENABLED=true \ -e WEBDAV_USERNAME=admin \ -e WEBDAV_PASSWORD=password \ -e AUTH_ENABLED=true \ -e AUTH_USERNAME=user \ -e AUTH_PASSWORD=pass \ webdav-mcp-server

構成

次の変数を含む.envファイルをルート ディレクトリに作成します。

# WebDAV configuration WEBDAV_ROOT_URL=http://localhost:4080 WEBDAV_ROOT_PATH=/webdav # WebDAV authentication (optional) WEBDAV_AUTH_ENABLED=true WEBDAV_USERNAME=admin # WebDAV password must be plain text (required when auth enabled) # The WebDAV protocol requires sending the actual password to the server WEBDAV_PASSWORD=password # Server configuration (for HTTP mode) SERVER_PORT=3000 # Authentication configuration for MCP server (optional) AUTH_ENABLED=true AUTH_USERNAME=user AUTH_PASSWORD=pass AUTH_REALM=MCP WebDAV Server # Auth password for MCP server can be a bcrypt hash (unlike WebDAV passwords) # AUTH_PASSWORD={bcrypt}$2y$10$CyLKnUwn9fqqKQFEbxpZFuE9mzWR/x8t6TE7.CgAN0oT8I/5jKJBy

MCP サーバー認証用の暗号化パスワード

MCP サーバー (WebDAV 接続ではない) のセキュリティを強化するために、パスワードをプレーンテキストで保存する代わりに、bcrypt で暗号化されたパスワードを使用できます。

  1. bcryptハッシュを生成します:
    # Using the built-in utility npm run generate-hash -- yourpassword # Or with npx npx webdav-mcp-generate-hash yourpassword
  2. ハッシュを {bcrypt} プレフィックスを付けて .env ファイルに追加します。
    AUTH_PASSWORD={bcrypt}$2y$10$CyLKnUwn9fqqKQFEbxpZFuE9mzWR/x8t6TE7.CgAN0oT8I/5jKJBy

これにより、MCPサーバーのパスワードは安全に保存されます。WebDAVパスワードはプロトコルの要件により、常にプレーンテキストで保存する必要があることにご注意ください。

使用法

stdioトランスポートで実行

このモードは、Claude Desktop との直接統合に最適です。

# If installed globally webdav-mcp-server # If using npx npx webdav-mcp-server # If built from source node dist/index.js

HTTP/SSEトランスポートで実行

このモードでは、リアルタイム通信のために Server-Sent Events を使用して HTTP 経由でサーバーにアクセスできます。

# If installed globally webdav-mcp-server --http # If using npx npx webdav-mcp-server --http # If built from source node dist/index.js --http

Docker Compose のクイックスタート

WebDAV サーバーと MCP サーバーの両方を使い始める最も簡単な方法は、Docker Compose を使用することです。

# Start both WebDAV and MCP servers cd docker docker-compose up -d # This will start: # - hacdias/webdav server on port 4080 (username: admin, password: admin) # - MCP server on port 3000 (username: user, password: pass)

このセットアップでは、Go言語で書かれたシンプルなスタンドアロンのWebDAVサーバーであるhacdias/webdavを使用します。WebDAVサーバーの設定はwebdav_config.ymlに保存されており、これを変更することで権限の調整、ユーザーの追加、その他の設定の変更が可能です。

WebDAV サーバーは、すべてのファイルをwebdav_dataという Docker ボリュームに保存します。このボリュームは、コンテナの再起動後も保持されます。

WebDAVサーバーの構成

webdav_config.ymlファイルは、Docker Compose セットアップで使用される hacdias/webdav サーバーを設定します。カスタマイズできる項目は以下のとおりです。

# Server address and port address: 0.0.0.0 port: 6060 # Root data directory directory: /data # Enable/disable CORS cors: enabled: true # Additional CORS settings... # Default permissions (C=Create, R=Read, U=Update, D=Delete) permissions: CRUD # User definitions users: - username: admin password: admin # Plain text password permissions: CRUD # Full permissions - username: reader password: reader permissions: R # Read-only permissions # You can also use bcrypt-encrypted passwords - username: secure password: "{bcrypt}$2y$10$zEP6oofmXFeHaeMfBNLnP.DO8m.H.Mwhd24/TOX2MWLxAExXi4qgi"

より詳細な設定オプションについては、 hacdias/webdav のドキュメントを参照してください。

テスト

テストを実行するには:

npm test

Claude Desktopとの統合

  1. Claude DesktopでMCP機能が有効になっていることを確認します

利用可能なMCPリソース

  • webdav://{path}/list - ディレクトリ内のファイルを一覧表示する
  • webdav://{path}/content - ファイルの内容を取得する
  • webdav://{path}/info - ファイルまたはディレクトリの情報を取得する

利用可能なMCPツール

  • webdav_create_remote_file - リモート WebDAV サーバーに新しいファイルを作成する
  • webdav_get_remote_file - リモート WebDAV サーバーに保存されているファイルからコンテンツを取得します
  • webdav_update_remote_file - リモート WebDAV サーバー上の既存のファイルを更新する
  • webdav_delete_remote_item - リモート WebDAV サーバーからファイルまたはディレクトリを削除します
  • webdav_create_remote_directory - リモート WebDAV サーバーに新しいディレクトリを作成する
  • webdav_move_remote_item - リモート WebDAV サーバー上のファイル/ディレクトリを移動または名前変更する
  • webdav_copy_remote_item - ファイル/ディレクトリをリモート WebDAV サーバー上の新しい場所にコピーします
  • webdav_list_remote_directory - リモート WebDAV サーバー上のファイルとディレクトリを一覧表示する

利用可能なMCPプロンプト

  • webdav_create_remote_file - リモート WebDAV サーバーに新しいファイルを作成するように要求します
  • webdav_get_remote_file - リモート WebDAV ファイルからコンテンツを取得するためのプロンプト
  • webdav_update_remote_file - リモート WebDAV サーバー上のファイルを更新するかどうかを確認するメッセージを表示します。
  • webdav_delete_remote_item - リモート WebDAV サーバーからファイル/ディレクトリを削除するように要求する
  • webdav_list_remote_directory - リモート WebDAV サーバー上のディレクトリの内容を一覧表示するプロンプト
  • webdav_create_remote_directory - リモート WebDAV サーバーにディレクトリを作成するように要求します
  • webdav_move_remote_item - リモート WebDAV サーバー上のファイル/ディレクトリの移動/名前変更を要求します
  • webdav_copy_remote_item - リモート WebDAV サーバー上のファイル/ディレクトリをコピーするためのプロンプト

クロードのクエリ例

WebDAV MCP サーバーに接続すると、Claude Desktop で使用できるクエリの例を次に示します。

  • 「リモート WebDAV サーバー上のファイルを一覧表示する」
  • 「リモート WebDAV サーバーに、次の内容を含む notes.txt という新しいテキスト ファイルを作成します: Hello World」
  • 「リモート WebDAV サーバーから document.txt の内容を取得する」
  • 「この新しい設定でリモート WebDAV サーバーの config.json を更新します」
  • 「リモート WebDAV サーバーに projects というディレクトリを作成します」
  • 「report.docx をリモート WebDAV サーバーのバックアップ場所にコピーします」
  • 「ファイル old_name.txt をリモート WebDAV サーバー上の new_name.txt に移動する」
  • 「リモート WebDAV サーバーから temp.txt を削除する」

プログラムによる使用

このパッケージを独自のプロジェクトでプログラム的に使用することもできます。

import { startWebDAVServer } from 'webdav-mcp-server'; // For stdio transport without authentication await startWebDAVServer({ webdavConfig: { rootUrl: 'http://your-webdav-server', rootPath: '/webdav', authEnabled: false }, useHttp: false }); // For stdio transport with WebDAV authentication (password must be plain text) await startWebDAVServer({ webdavConfig: { rootUrl: 'http://your-webdav-server', rootPath: '/webdav', authEnabled: true, username: 'admin', password: 'password' }, useHttp: false }); // With bcrypt hash for MCP server password (HTTP auth only) await startWebDAVServer({ webdavConfig: { rootUrl: 'http://your-webdav-server', rootPath: '/webdav', authEnabled: true, username: 'admin', password: 'password' // WebDAV password must be plain text }, useHttp: true, httpConfig: { port: 3000, auth: { enabled: true, username: 'user', password: '{bcrypt}$2y$10$CyLKnUwn9fqqKQFEbxpZFuE9mzWR/x8t6TE7.CgAN0oT8I/5jKJBy' } } }); // For HTTP transport with MCP authentication await startWebDAVServer({ webdavConfig: { rootUrl: 'http://your-webdav-server', rootPath: '/webdav', authEnabled: true, username: 'admin', password: 'password' }, useHttp: true, httpConfig: { port: 3000, auth: { enabled: true, username: 'user', password: 'pass', realm: 'MCP WebDAV Server' } } }); // For HTTP transport without authentication await startWebDAVServer({ webdavConfig: { rootUrl: 'http://your-webdav-server', rootPath: '/webdav', authEnabled: false }, useHttp: true, httpConfig: { port: 3000, auth: { enabled: false } } });

ライセンス

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

-
security - not tested
A
license - permissive license
-
quality - not tested

Claude Desktop およびその他の MCP クライアントが CRUD 操作用の自然言語コマンドを通じて WebDAV ファイル システムと対話できるようにするモデル コンテキスト プロトコル サーバー。

  1. Features
    1. Prerequisites
      1. Installation
        1. Option 1: Install from npm package
        2. Option 2: Clone and build from source
        3. Option 3: Docker
      2. Configuration
        1. Encrypted Passwords for MCP Server Authentication
      3. Usage
        1. Running with stdio transport
        2. Running with HTTP/SSE transport
      4. Quick Start with Docker Compose
        1. WebDAV Server Configuration
          1. Testing
            1. Integrating with Claude Desktop
              1. Available MCP Resources
                1. Available MCP Tools
                  1. Available MCP Prompts
                    1. Example Queries in Claude
                      1. Programmatic Usage
                        1. License
                          ID: qoepn05pn9