Skip to main content
Glama
LaubPlusCo

WebDAV MCP Server

by LaubPlusCo

webdav_create_remote_file

Create and save files on remote WebDAV servers by specifying paths and content; optionally overwrite existing files. Simplify remote file management with direct configuration.

Instructions

Create a new file on a remote WebDAV server at the specified path

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYes
overwriteNo
pathYes

Implementation Reference

  • The core handler function for the 'webdav_create_remote_file' tool. Includes inline schema validation using Zod, existence check, overwrite handling, file writing via WebDAVService, and error handling with formatted responses.
    server.tool( 'webdav_create_remote_file', 'Create a new file on a remote WebDAV server at the specified path', { path: z.string().min(1, 'Path must not be empty'), content: z.string(), overwrite: z.boolean().optional().default(false) }, async ({ path, content, overwrite }) => { try { // Check if file exists and respect overwrite flag const exists = await webdavService.exists(path); if (exists && !overwrite) { return { content: [{ type: 'text', text: `Error: File already exists at ${path}. Use overwrite=true to replace it.` }], isError: true }; } await webdavService.writeFile(path, content); return { content: [{ type: 'text', text: `File created successfully at ${path}` }] }; } catch (error) { return { content: [{ type: 'text', text: `Error creating file: ${(error as Error).message}` }], isError: true }; } } );
  • Input schema for the webdav_create_remote_file tool using Zod for validation: path (string, required), content (string), overwrite (boolean, optional, default false).
    path: z.string().min(1, 'Path must not be empty'), content: z.string(), overwrite: z.boolean().optional().default(false) },
  • Registration of the 'webdav_create_remote_file' tool on the MCP server within setupToolHandlers.
    server.tool( 'webdav_create_remote_file', 'Create a new file on a remote WebDAV server at the specified path', { path: z.string().min(1, 'Path must not be empty'), content: z.string(), overwrite: z.boolean().optional().default(false) }, async ({ path, content, overwrite }) => { try { // Check if file exists and respect overwrite flag const exists = await webdavService.exists(path); if (exists && !overwrite) { return { content: [{ type: 'text', text: `Error: File already exists at ${path}. Use overwrite=true to replace it.` }], isError: true }; } await webdavService.writeFile(path, content); return { content: [{ type: 'text', text: `File created successfully at ${path}` }] }; } catch (error) { return { content: [{ type: 'text', text: `Error creating file: ${(error as Error).message}` }], isError: true }; } } );
  • src/lib.ts:78-78 (registration)
    High-level registration call to setupToolHandlers during MCP server initialization, which registers the webdav_create_remote_file tool among others.
    setupToolHandlers(server, webdavService);
  • WebDAVService class providing the writeFile method used by the tool handler for creating/updating remote files.
    export class WebDAVService {

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