Skip to main content
Glama
LaubPlusCo

WebDAV MCP Server

by LaubPlusCo

webdav_get_remote_file

Access and retrieve file content from a remote WebDAV server by specifying the file path, enabling integration with natural language commands for file management.

Instructions

Retrieve content from a file stored on a remote WebDAV server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes

Implementation Reference

  • Registers and implements the 'webdav_get_remote_file' MCP tool. Defines the input schema (path: string), handler logic that reads the remote file using WebDAVService.readFile(), and returns the content as text or an error message.
    server.tool( 'webdav_get_remote_file', 'Retrieve content from a file stored on a remote WebDAV server', { path: z.string().min(1, 'Path must not be empty') }, async ({ path }) => { try { const content = await webdavService.readFile(path); return { content: [{ type: 'text', text: content }] }; } catch (error) { return { content: [{ type: 'text', text: `Error reading file: ${(error as Error).message}` }], isError: true }; } } );
  • Core helper method WebDAVService.readFile() that constructs the full remote path and uses the WebDAV client library to fetch and return the file contents as a string.
    async readFile(path: string): Promise<string> { const fullPath = this.getFullPath(path); logger.debug(`Reading file: ${fullPath}`); try { // v5.x returns buffer by default, need to use format: 'text' const content = await this.client.getFileContents(fullPath, { format: 'text' }); // Handle both direct string response and detailed response let result: string; if (typeof content === 'string') { result = content; } else if (this.isResponseData(content)) { result = String(content.data); } else { throw new Error("Unexpected response format from server"); } const contentLength = result.length; logger.debug(`Read file: ${fullPath}`, { contentLength }); return result; } catch (error) { logger.error(`Error reading file ${fullPath}:`, error); throw new Error(`Failed to read file: ${(error as Error).message}`); } }
  • src/lib.ts:77-80 (registration)
    Top-level server setup where setupToolHandlers is called to register all WebDAV tools including 'webdav_get_remote_file'.
    setupResourceHandlers(server, webdavService); setupToolHandlers(server, webdavService); setupPromptHandlers(server);

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/LaubPlusCo/mcp-webdav-server'

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