Skip to main content
Glama
alxspiker

MCP Server for FTP Access

delete-file

Remove files from an FTP server by specifying the remote file path. This tool helps manage storage and clean up unnecessary files on FTP servers.

Instructions

Delete a file from the FTP server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
remotePathYesPath of the file to delete

Implementation Reference

  • src/index.ts:166-196 (registration)
    Registers the MCP 'delete-file' tool with Zod input schema for remotePath and an async handler that calls ftpClient.deleteFile(remotePath), handles success/error responses with markdown text content.
    server.tool( "delete-file", "Delete a file from the FTP server", { remotePath: z.string().describe("Path of the file to delete"), }, async ({ remotePath }) => { try { await ftpClient.deleteFile(remotePath); return { content: [ { type: "text", text: `File successfully deleted from ${remotePath}` } ] }; } catch (error) { return { isError: true, content: [ { type: "text", text: `Error deleting file: ${error instanceof Error ? error.message : String(error)}` } ] }; } } );
  • Core implementation of file deletion in FtpClient class: connects to FTP server, calls basic-ftp Client.remove(remotePath) to delete the file, disconnects, and propagates errors.
    async deleteFile(remotePath: string): Promise<boolean> { try { await this.connect(); await this.client.remove(remotePath); await this.disconnect(); return true; } catch (error) { console.error("Delete file error:", error); throw new Error(`Failed to delete file: ${error instanceof Error ? error.message : String(error)}`); } }

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/alxspiker/mcp-server-ftp'

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