Skip to main content
Glama
alxspiker

MCP Server for FTP Access

create-directory

Create new directories on an FTP server by specifying the remote path, enabling organized file storage and management through direct interaction.

Instructions

Create a new directory on the FTP server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
remotePathYesPath of the directory to create

Implementation Reference

  • MCP tool handler for create-directory: calls ftpClient.createDirectory and returns formatted MCP response.
    async ({ remotePath }) => { try { await ftpClient.createDirectory(remotePath); return { content: [ { type: "text", text: `Directory successfully created at ${remotePath}` } ] }; } catch (error) { return { isError: true, content: [ { type: "text", text: `Error creating directory: ${error instanceof Error ? error.message : String(error)}` } ] }; } }
  • Input schema for the create-directory tool using Zod.
    { remotePath: z.string().describe("Path of the directory to create"), },
  • src/index.ts:133-163 (registration)
    Registration of the create-directory MCP tool via server.tool call.
    server.tool( "create-directory", "Create a new directory on the FTP server", { remotePath: z.string().describe("Path of the directory to create"), }, async ({ remotePath }) => { try { await ftpClient.createDirectory(remotePath); return { content: [ { type: "text", text: `Directory successfully created at ${remotePath}` } ] }; } catch (error) { return { isError: true, content: [ { type: "text", text: `Error creating directory: ${error instanceof Error ? error.message : String(error)}` } ] }; } } );
  • FtpClient helper method implementing the FTP directory creation logic using basic-ftp library.
    async createDirectory(remotePath: string): Promise<boolean> { try { await this.connect(); await this.client.ensureDir(remotePath); await this.disconnect(); return true; } catch (error) { console.error("Create directory error:", error); throw new Error(`Failed to create directory: ${error instanceof Error ? error.message : String(error)}`); } }

Other Tools

Related Tools

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