Hostinger API MCP Server

0.1.37 · active · verified Sun Apr 19

hostinger-api-mcp is an executable server designed to implement the Model Context Protocol (MCP), enabling AI agents and automated systems to interact with Hostinger API functionalities as discoverable tools. It provides a standardized interface for tool discovery and execution, facilitating integrations with AI platforms such as Claude or Cursor. The package is currently in early development at version `0.1.39`, indicating frequent, minor updates primarily for dependency maintenance rather than major feature releases. Its core differentiators include its specific focus on exposing Hostinger services through the MCP standard and its versatile support for both standard I/O and HTTP streaming transports, offering flexible deployment options for AI-driven workflows.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to use the `@modelcontextprotocol/sdk` to connect to a running `hostinger-api-mcp` server, list available tools, and call a specific tool like `billing_getCatalogItemListV1`.

import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";

const API_TOKEN = process.env.API_TOKEN ?? 'YOUR_HOSTINGER_API_TOKEN';
if (API_TOKEN === 'YOUR_HOSTINGER_API_TOKEN') {
  console.warn('API_TOKEN environment variable not set. Replace with your actual token or set process.env.API_TOKEN.');
}

async function runMcpClient() {
  // Ensure the hostinger-api-mcp server is running, e.g., 'hostinger-api-mcp --http'
  const transport = new StreamableHTTPClientTransport({
    url: "http://localhost:8100/",
    headers: {
      "Authorization": `Bearer ${API_TOKEN}`
    }
  });

  const client = new Client({
    name: "my-hostinger-client",
    version: "1.0.0"
  }, {
    capabilities: {}
  });

  try {
    await client.connect(transport);
    console.log("Connected to Hostinger MCP server.");

    const { tools } = await client.listTools();
    console.log("Available tools:", tools.map(tool => tool.name));

    // Example: Call a tool if one is available
    const billingTool = tools.find(t => t.name === 'billing_getCatalogItemListV1');
    if (billingTool) {
      const result = await client.callTool({
        name: "billing_getCatalogItemListV1",
        arguments: { category: "DOMAIN" }
      });
      console.log("Result of billing_getCatalogItemListV1:", result);
    } else {
      console.log("Tool 'billing_getCatalogItemListV1' not found.");
    }
  } catch (error) {
    console.error("Error connecting to or interacting with MCP server:", error);
  } finally {
    await client.disconnect();
    console.log("Disconnected from Hostinger MCP server.");
  }
}

runMcpClient();

view raw JSON →