Skip to main content
Glama
alxspiker

MCP Server for FTP Access

upload-file

Upload files to FTP servers by specifying destination paths and content. This tool enables transferring files to remote FTP locations through the MCP server for FTP access.

Instructions

Upload a file to the FTP server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
remotePathYesDestination path on the FTP server
contentYesContent to upload to the file

Implementation Reference

  • src/index.ts:99-130 (registration)
    Registration of the 'upload-file' MCP tool using server.tool(). Includes input schema (remotePath, content) and inline handler that calls ftpClient.uploadFile() and returns formatted text response.
    server.tool(
      "upload-file",
      "Upload a file to the FTP server",
      {
        remotePath: z.string().describe("Destination path on the FTP server"),
        content: z.string().describe("Content to upload to the file"),
      },
      async ({ remotePath, content }) => {
        try {
          await ftpClient.uploadFile(remotePath, content);
          
          return {
            content: [
              {
                type: "text",
                text: `File successfully uploaded to ${remotePath}`
              }
            ]
          };
        } catch (error) {
          return {
            isError: true,
            content: [
              {
                type: "text",
                text: `Error uploading file: ${error instanceof Error ? error.message : String(error)}`
              }
            ]
          };
        }
      }
    );
  • Zod input schema defining parameters for the upload-file tool: remotePath (destination path) and content (file content as string).
    {
      remotePath: z.string().describe("Destination path on the FTP server"),
      content: z.string().describe("Content to upload to the file"),
    },
  • Inline handler function for upload-file tool: invokes ftpClient.uploadFile with parameters and returns MCP-formatted success or error response.
    async ({ remotePath, content }) => {
      try {
        await ftpClient.uploadFile(remotePath, content);
        
        return {
          content: [
            {
              type: "text",
              text: `File successfully uploaded to ${remotePath}`
            }
          ]
        };
      } catch (error) {
        return {
          isError: true,
          content: [
            {
              type: "text",
              text: `Error uploading file: ${error instanceof Error ? error.message : String(error)}`
            }
          ]
        };
      }
    }
  • Core FTP upload logic in FtpClient class: writes content to temp file, uses basic-ftp Client.uploadFrom to upload to remotePath, handles connection and cleanup.
    async uploadFile(remotePath: string, content: string): Promise<boolean> {
      try {
        await this.connect();
        
        // Create a temporary file with the content
        const tempFilePath = path.join(this.tempDir, `upload-${Date.now()}-${path.basename(remotePath)}`);
        fs.writeFileSync(tempFilePath, content);
        
        // Upload the file
        await this.client.uploadFrom(tempFilePath, remotePath);
        
        // Clean up
        fs.unlinkSync(tempFilePath);
        
        await this.disconnect();
        return true;
      } catch (error) {
        console.error("Upload file error:", error);
        throw new Error(`Failed to upload file: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It implies a write operation ('Upload') but fails to mention critical traits such as authentication requirements, file size limits, error handling, or whether the operation overwrites existing files. This leaves significant gaps for safe and effective tool invocation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, direct sentence with zero wasted words, making it highly efficient and front-loaded. It immediately conveys the core action without unnecessary elaboration, earning a top score for conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a write operation tool with no annotations and no output schema, the description is insufficient. It lacks details on behavioral traits (e.g., permissions, side effects), expected outputs, or error scenarios, leaving the agent with incomplete context to use the tool reliably in complex scenarios.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, clearly documenting both parameters ('remotePath' and 'content'). The description adds no additional semantic context beyond what the schema provides, such as format examples or constraints. Given the high schema coverage, a baseline score of 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Upload') and resource ('a file to the FTP server'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'download-file' or 'create-directory' beyond the basic verb, missing explicit scope or boundary details that would elevate it to a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'download-file' or 'create-directory', nor does it mention prerequisites, exclusions, or specific contexts. It states what the tool does but offers no usage instructions, leaving the agent to infer based on the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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