Skip to main content
Glama
hostinger

hostinger-api-mcp

Official

hosting_deployJsApplication

Upload a JavaScript application archive to a hosting server for automatic deployment. The archive must contain source files only, excluding node_modules and .gitignore matches.

Instructions

Deploy a JavaScript application from an archive file to a hosting server. IMPORTANT: the archive must ONLY contain application source files, not the build output, skip node_modules directory; also exclude all files matched by .gitignore if the ignore file exists. The build process will be triggered automatically on the server after the archive is uploaded. After deployment, use the hosting_listJsDeployments tool to check deployment status and track build progress.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainYesDomain name associated with the hosting account (e.g., example.com)
archivePathYesAbsolute or relative path to the application archive file. Supported formats: zip, tar, tar.gz, tgz, 7z, gz, gzip. If user provides directory path, create archive from it before proceeding. IMPORTANT: the archive must ONLY contain application source files, not the build output, skip node_modules directory.
removeArchiveNoWhether to remove the archive file after successful deployment (default: false)

Implementation Reference

  • Tool definition and input schema for hosting_deployJsApplication, including the name, description, and inputSchema with domain (string), archivePath (string), and removeArchive (boolean) parameters. Maps to handlerMethod: handleJavascriptApplicationDeploy.
    {
      "name": "hosting_deployJsApplication",
      "topic": "hosting",
      "description": "Deploy a JavaScript application from an archive file to a hosting server. IMPORTANT: the archive must ONLY contain application source files, not the build output, skip node_modules directory; also exclude all files matched by .gitignore if the ignore file exists. The build process will be triggered automatically on the server after the archive is uploaded. After deployment, use the hosting_listJsDeployments tool to check deployment status and track build progress.",
      "method": "",
      "path": "",
      "inputSchema": {
        "type": "object",
        "properties": {
          "domain": {
            "type": "string",
            "description": "Domain name associated with the hosting account (e.g., example.com)"
          },
          "archivePath": {
            "type": "string",
            "description": "Absolute or relative path to the application archive file. Supported formats: zip, tar, tar.gz, tgz, 7z, gz, gzip. If user provides directory path, create archive from it before proceeding. IMPORTANT: the archive must ONLY contain application source files, not the build output, skip node_modules directory."
          },
          "removeArchive": {
            "type": "boolean",
            "description": "Whether to remove the archive file after successful deployment (default: false)"
          }
        },
        "required": [
          "domain",
          "archivePath"
        ]
      },
      "security": [],
      "custom": true,
      "templateFile": "deploy-javascript-app.template.js",
      "templateFileTS": "deploy-javascript-app.template.ts",
      "handlerMethod": "handleJavascriptApplicationDeploy",
      "group": "hosting"
    },
  • Registration/case statement that routes 'hosting_deployJsApplication' tool calls to the handleJavascriptApplicationDeploy method.
    private async executeCustomTool(tool: OpenApiTool, params: Record<string, any>): Promise<any> {
      switch (tool.name) {
        case 'hosting_importWordpressWebsite':
          return await this.handleWordpressWebsiteImport(params);
        case 'hosting_deployWordpressPlugin':
          return await this.handleWordpressPluginDeploy(params);
        case 'hosting_deployWordpressTheme':
          return await this.handleWordpressThemeDeploy(params);
        case 'hosting_deployJsApplication':
          return await this.handleJavascriptApplicationDeploy(params);
        case 'hosting_deployStaticWebsite':
          return await this.handleStaticWebsiteDeploy(params);
        case 'hosting_listJsDeployments':
          return await this.handleListJavascriptDeployments(params);
        case 'hosting_showJsDeploymentLogs':
          return await this.handleShowJsDeploymentLogs(params);
        default:
          throw new Error(`Unknown custom tool: ${tool.name}`);
      }
    }
  • Main handler function (handleJavascriptApplicationDeploy) that orchestrates the full JS app deployment: validates params, resolves username, uploads archive, fetches build settings, triggers build, and optionally removes archive.
    private async handleJavascriptApplicationDeploy(params: Record<string, any>): Promise<any> {
      const { domain, archivePath, removeArchive = false } = params;
    
      this.hosting_deployJsApplication_validateRequiredParams(params);
      this.hosting_deployJsApplication_validateArchiveFile(archivePath);
    
      // Auto-resolve username from domain
      this.log('info', `Resolving username from domain: ${domain}`);
      const username = await this.resolveUsername(domain);
    
      // Upload archive file
      this.log('info', `Starting archive upload for ${domain}`);
      
      let uploadCredentials: any;
      try {
        uploadCredentials = await this.fetchUploadCredentials(username, domain);
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        throw new Error(`Failed to fetch upload credentials: ${errorMessage}`);
      }
    
      const { url: uploadUrl, auth_key: authToken, rest_auth_key: authRestToken } = uploadCredentials;
    
      if (!uploadUrl || !authToken || !authRestToken) {
        throw new Error('Invalid upload credentials received from API');
      }
    
      const archiveBasename = path.basename(archivePath);
      let uploadResult: any;
      try {
        const stats = fs.statSync(archivePath);
        uploadResult = await this.uploadFile(
          archivePath,
          archiveBasename,
          uploadUrl,
          authRestToken,
          authToken
        );
    
        this.log('info', `Successfully uploaded archive: ${archiveBasename}`);
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        throw new Error(`Failed to upload archive: ${errorMessage}`);
      }
    
      // Fetch build settings
      let buildSettings: any;
      try {
        this.log('info', `Fetching build settings for ${domain}`);
        buildSettings = await this.hosting_deployJsApplication_fetchBuildSettings(username, domain, archivePath);
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        this.log('error', `Failed to fetch build settings: ${errorMessage}`);
        const archiveRemoved = this.hosting_deployJsApplication_removeArchive(archivePath, removeArchive);
    
        return {
          upload: {
            status: 'success',
            data: {
              filename: uploadResult.filename
            }
          },
          resolveSettings: {
            status: 'error',
            error: errorMessage
          },
          build: {
            status: 'skipped'
          },
          removeArchive: {
            status: archiveRemoved ? 'success' : 'skipped'
          }
        };
      }
    
      // Trigger build
      let buildResult: any;
      try {
        this.log('info', `Triggering build for ${domain}`);
        buildResult = await this.hosting_deployJsApplication_triggerBuild(username, domain, archivePath, buildSettings);
      } catch (error) {
        const errorMessage = error instanceof Error ? error.message : String(error);
        this.log('error', `Failed to trigger build: ${errorMessage}`);
        const archiveRemoved = this.hosting_deployJsApplication_removeArchive(archivePath, removeArchive);
    
        return {
          upload: {
            status: 'success',
            data: {
              filename: uploadResult.filename
            }
          },
          resolveSettings: {
            status: 'success',
            data: buildSettings
          },
          build: {
            status: 'error',
            error: errorMessage
          },
          removeArchive: {
            status: archiveRemoved ? 'success' : 'skipped'
          }
        };
      }
    
      const archiveRemoved = this.hosting_deployJsApplication_removeArchive(archivePath, removeArchive);
    
      return {
        upload: {
          status: 'success',
          data: {
            filename: uploadResult.filename
          }
        },
        resolveSettings: {
          status: 'success',
          data: buildSettings
        },
        build: {
          status: 'success',
          data: buildResult
        },
        removeArchive: {
          status: archiveRemoved ? 'success' : 'skipped'
        }
      };
    }
  • Helper to validate archive file format (zip, tar, tar.gz, tgz, 7z, gz, gzip).
    private hosting_deployJsApplication_validateArchiveFormat(filePath: string): boolean {
      const validExtensions = ['zip', 'tar', 'tar.gz', 'tgz', '7z', 'gz', 'gzip'];
      const fileName = path.basename(filePath).toLowerCase();
      
      for (const ext of validExtensions) {
        if (fileName.endsWith(`.${ext}`)) {
          return true;
        }
      }
      
      return false;
    }
  • Helper to validate required parameters (domain, archivePath) for the JS deploy tool.
    private hosting_deployJsApplication_validateRequiredParams(params: Record<string, any>): void {
      const { domain, archivePath, removeArchive } = params;
    
      if (!domain || typeof domain !== 'string') {
        throw new Error('domain is required and must be a string');
      }
    
      if (!archivePath || typeof archivePath !== 'string') {
        throw new Error('archivePath is required and must be a string');
      }
    
      if (removeArchive !== undefined && typeof removeArchive !== 'boolean') {
        throw new Error('removeArchive must be a boolean if provided');
      }
    }
Behavior3/5

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

With no annotations, the description must fully disclose behavior. It reveals that the build process triggers automatically and that the archive must meet strict criteria (source only, no node_modules). It does not address potential side effects (e.g., overwriting existing deployments), error scenarios, or authentication requirements. This is adequate but not comprehensive for a deployment action.

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 concise and well-structured. It front-loads the core purpose, then follows with critical usage notes in a logical order. Every sentence adds essential information; there is no fluff or repetition. The length is appropriate for the complexity of the tool.

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

Completeness3/5

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

Given the absence of an output schema, the description does not explain the return value or how to interpret the result. It references hosting_listJsDeployments for status, implying the initial call yields some identifier, but this is not explicit. Important behavioral aspects like error handling, idempotency, and prerequisites are missing, leaving gaps for an agent to infer.

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

Parameters4/5

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

The input schema has 100% coverage, providing clear descriptions for each parameter. The tool description adds value by explaining that if the user provides a directory path, an archive should be created from it before proceeding—a detail not in the schema. This extra guidance raises the score above the baseline of 3.

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

Purpose5/5

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

The description clearly states 'Deploy a JavaScript application from an archive file to a hosting server,' specifying the verb and resource. It distinguishes from sibling tools like hosting_deployStaticWebsite by focusing on JavaScript and mentioning the build process. The important constraint about archive contents adds further specificity.

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

Usage Guidelines4/5

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

The description provides clear guidance on when to use this tool: for deploying JavaScript applications from source archives. It includes crucial rules about archive content (source files only, exclude node_modules) and post-deployment actions (use hosting_listJsDeployments to track status). However, it does not explicitly state when NOT to use it or compare with alternatives like hosting_deployStaticWebsite, leaving some interpretation to the agent.

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/hostinger/api-mcp-server'

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