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 패키지에서 설치

지엑스피1

옵션 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 전송으로 실행

이 모드를 사용하면 서버에서 보낸 이벤트를 통해 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 서버에서 파일/디렉토리를 복사할지 묻습니다.

Claude의 예제 쿼리

WebDAV MCP 서버가 연결되면 Claude Desktop에서 사용할 수 있는 몇 가지 쿼리 예는 다음과 같습니다.

  • "내 원격 WebDAV 서버에 있는 파일 나열"
  • "원격 WebDAV 서버에 다음 내용을 포함하는 notes.txt라는 새 텍스트 파일을 만듭니다: Hello World"
  • "원격 WebDAV 서버에서 document.txt의 내용을 가져옵니다"
  • "이 새로운 구성으로 원격 WebDAV 서버의 config.json을 업데이트합니다."
  • "원격 WebDAV 서버에 projects라는 디렉토리를 만듭니다."
  • "report.docx를 원격 WebDAV 서버의 백업 위치로 복사합니다."
  • "원격 WebDAV 서버에서 old_name.txt 파일을 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 } } });

특허

MIT

ID: qoepn05pn9