Hostinger API MCP Server
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
-
Error: The Node.js version is too old. Please update to Node.js v24 or higher.
cause Attempting to run `hostinger-api-mcp` with an unsupported or outdated Node.js version (e.g., v20, v22).fixUpgrade your Node.js installation to version 24 or higher. We recommend using `nvm` (`nvm install v24 && nvm use v24`). -
401 Unauthorized
cause The Hostinger API token (`API_TOKEN`) is missing, incorrect, or expired, preventing authentication with the Hostinger API via the MCP server.fixVerify that the `API_TOKEN` environment variable is correctly set on the server-side and contains a valid, active Hostinger API token. For client applications, ensure the `Authorization` header is properly formatted (`Bearer YOUR_TOKEN`). -
Error: listen EADDRINUSE: address already in use 127.0.0.1:8100
cause Another application or another instance of `hostinger-api-mcp` is already bound to the default HTTP port 8100.fixEither stop the process currently using port 8100, or run the `hostinger-api-mcp` server on a different port using the `--port` option (e.g., `hostinger-api-mcp --http --port 8150`).
Warnings
- gotcha The `hostinger-api-mcp` server officially recommends Node.js version 24 or higher in its `README`, despite the `package.json` specifying `>=20.0.0`. Running on versions older than 24 may lead to unexpected behavior or missing features.
- gotcha Authorization is mandatory for interacting with the Hostinger API through the MCP server. The `API_TOKEN` environment variable must be set on the server-side, and client requests must include a valid `Authorization` header.
- gotcha As a pre-1.0 release, this package follows `0.y.z` versioning, which implies that minor (`y`) version increments might introduce breaking changes. Developers should review changelogs carefully before upgrading.
Install
-
npm install hostinger-api-mcp -
yarn add hostinger-api-mcp -
pnpm add hostinger-api-mcp
Imports
- Client
const Client = require('@modelcontextprotocol/sdk/client/index.js');import { Client } from '@modelcontextprotocol/sdk/client/index.js'; - StreamableHTTPClientTransport
const StreamableHTTPClientTransport = require('@modelcontextprotocol/sdk/client/streamableHttp.js');import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'; - ListToolsResult
import type { ListToolsResult } from '@modelcontextprotocol/sdk/client/index.js';
Quickstart
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();