hostinger-api-mcp 0.0.10 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/package.json +3 -1
- package/server.js +97 -6
- package/server.ts +99 -7
- package/types.d.ts +23 -0
package/README.md
CHANGED
|
@@ -73,6 +73,16 @@ The following environment variables can be configured when running the server:
|
|
|
73
73
|
}
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
+
### Using SSE Transport
|
|
77
|
+
|
|
78
|
+
To use the MCP server with SSE transport, you must run the server with the `--sse` option.
|
|
79
|
+
This will enable the server to communicate with clients using Server-Sent Events on localhost port 8100.
|
|
80
|
+
Additionally, you can specify the `--host` and `--port` options to set the host and port for the server to listen on.
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
node server.js --see --host 127.0.0.1 --port 8100
|
|
84
|
+
```
|
|
85
|
+
|
|
76
86
|
### Using as an MCP Tool Provider
|
|
77
87
|
|
|
78
88
|
This server implements the Model Context Protocol (MCP) and can be used with any MCP-compatible consumer, like Claude.js client or other MCP consumers.
|
|
@@ -299,6 +309,21 @@ If there is validation error, the response will fail with `422 Validation error`
|
|
|
299
309
|
- `overwrite`: If `true`, resource records (RRs) matching name and type will be deleted and new RRs will be created, otherwise resource records' ttl's are updated and new records are appended. If no matching RRs are found, they are created.
|
|
300
310
|
- `zone`: zone property (required)
|
|
301
311
|
|
|
312
|
+
### domains_checkDomainAvailabilityV1
|
|
313
|
+
|
|
314
|
+
This endpoint checks the availability of a domain name. Multiple TLDs can be checked at once.
|
|
315
|
+
|
|
316
|
+
Endpoint has rate limit of 10 requests per minute.
|
|
317
|
+
|
|
318
|
+
- **Method**: `POST`
|
|
319
|
+
- **Path**: `/api/domains/v1/availability`
|
|
320
|
+
|
|
321
|
+
**Parameters**:
|
|
322
|
+
|
|
323
|
+
- `domain`: domain property (required)
|
|
324
|
+
- `tlds`: tlds property (required)
|
|
325
|
+
- `with_alternatives`: with_alternatives property
|
|
326
|
+
|
|
302
327
|
### domains_getDomainListV1
|
|
303
328
|
|
|
304
329
|
This endpoint retrieves a list of all domains associated with your account.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hostinger-api-mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "MCP server for Hostinger API",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
29
|
+
"minimist": "^1.2.8",
|
|
30
|
+
"express": "^5.1.0",
|
|
29
31
|
"axios": "^1.8.0",
|
|
30
32
|
"dotenv": "^16.0.0"
|
|
31
33
|
},
|
package/server.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
4
4
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
|
+
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
|
|
6
|
+
import minimist from 'minimist';
|
|
7
|
+
import express from "express";
|
|
5
8
|
import axios from "axios";
|
|
6
9
|
import { config as dotenvConfig } from "dotenv";
|
|
7
10
|
import {
|
|
@@ -387,6 +390,38 @@ const TOOLS = [
|
|
|
387
390
|
}
|
|
388
391
|
]
|
|
389
392
|
},
|
|
393
|
+
{
|
|
394
|
+
"name": "domains_checkDomainAvailabilityV1",
|
|
395
|
+
"description": "This endpoint checks the availability of a domain name. Multiple TLDs can be checked at once.\n\nEndpoint has rate limit of 10 requests per minute.",
|
|
396
|
+
"method": "POST",
|
|
397
|
+
"path": "/api/domains/v1/availability",
|
|
398
|
+
"inputSchema": {
|
|
399
|
+
"type": "object",
|
|
400
|
+
"properties": {
|
|
401
|
+
"domain": {
|
|
402
|
+
"type": "string",
|
|
403
|
+
"description": "domain property"
|
|
404
|
+
},
|
|
405
|
+
"tlds": {
|
|
406
|
+
"type": "array",
|
|
407
|
+
"description": "tlds property"
|
|
408
|
+
},
|
|
409
|
+
"with_alternatives": {
|
|
410
|
+
"type": "boolean",
|
|
411
|
+
"description": "with_alternatives property"
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
"required": [
|
|
415
|
+
"domain",
|
|
416
|
+
"tlds"
|
|
417
|
+
]
|
|
418
|
+
},
|
|
419
|
+
"security": [
|
|
420
|
+
{
|
|
421
|
+
"apiToken": []
|
|
422
|
+
}
|
|
423
|
+
]
|
|
424
|
+
},
|
|
390
425
|
{
|
|
391
426
|
"name": "domains_getDomainListV1",
|
|
392
427
|
"description": "This endpoint retrieves a list of all domains associated with your account.",
|
|
@@ -1832,7 +1867,7 @@ const SECURITY_SCHEMES = {
|
|
|
1832
1867
|
|
|
1833
1868
|
/**
|
|
1834
1869
|
* MCP Server for Hostinger API
|
|
1835
|
-
* Generated from OpenAPI spec version 0.0.
|
|
1870
|
+
* Generated from OpenAPI spec version 0.0.27
|
|
1836
1871
|
*/
|
|
1837
1872
|
class MCPServer {
|
|
1838
1873
|
constructor() {
|
|
@@ -1850,7 +1885,7 @@ class MCPServer {
|
|
|
1850
1885
|
this.server = new Server(
|
|
1851
1886
|
{
|
|
1852
1887
|
name: "hostinger-api-mcp",
|
|
1853
|
-
version: "0.0.
|
|
1888
|
+
version: "0.0.12",
|
|
1854
1889
|
},
|
|
1855
1890
|
{
|
|
1856
1891
|
capabilities: {
|
|
@@ -1875,7 +1910,7 @@ class MCPServer {
|
|
|
1875
1910
|
});
|
|
1876
1911
|
}
|
|
1877
1912
|
|
|
1878
|
-
headers['User-Agent'] = 'hostinger-mcp-server/0.0.
|
|
1913
|
+
headers['User-Agent'] = 'hostinger-mcp-server/0.0.12';
|
|
1879
1914
|
|
|
1880
1915
|
return headers;
|
|
1881
1916
|
}
|
|
@@ -2126,10 +2161,52 @@ class MCPServer {
|
|
|
2126
2161
|
}
|
|
2127
2162
|
}
|
|
2128
2163
|
|
|
2164
|
+
/**
|
|
2165
|
+
* Start the sse server
|
|
2166
|
+
*/
|
|
2167
|
+
async startSse(host, port) {
|
|
2168
|
+
try {
|
|
2169
|
+
// Create sse transport
|
|
2170
|
+
const app = express();
|
|
2171
|
+
app.use(express.json());
|
|
2172
|
+
|
|
2173
|
+
let transport = null;
|
|
2174
|
+
const sessions = {};
|
|
2175
|
+
|
|
2176
|
+
app.get('/sse', (req, res) => {
|
|
2177
|
+
transport = new SSEServerTransport('/messages', res);
|
|
2178
|
+
sessions[transport.sessionId] = transport;
|
|
2179
|
+
|
|
2180
|
+
res.on('close', () => {
|
|
2181
|
+
delete sessions[transport.sessionId];
|
|
2182
|
+
});
|
|
2183
|
+
|
|
2184
|
+
this.server.connect(transport);
|
|
2185
|
+
});
|
|
2186
|
+
|
|
2187
|
+
app.post('/messages', (req, res) => {
|
|
2188
|
+
const sessionId = req.query.sessionId;
|
|
2189
|
+
const transport = sessions[sessionId];
|
|
2190
|
+
if (transport) {
|
|
2191
|
+
transport.handlePostMessage(req, res);
|
|
2192
|
+
} else {
|
|
2193
|
+
res.status(400).send('No transport found for sessionId');
|
|
2194
|
+
}
|
|
2195
|
+
});
|
|
2196
|
+
|
|
2197
|
+
app.listen(port, host);
|
|
2198
|
+
this.log('info', `MCP Server with SSE transport started successfully with ${this.tools.size} tools`);
|
|
2199
|
+
this.log('info', `Listening on ${host}:${port}`);
|
|
2200
|
+
} catch (error) {
|
|
2201
|
+
console.error("Failed to start MCP server:", error);
|
|
2202
|
+
process.exit(1);
|
|
2203
|
+
}
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2129
2206
|
/**
|
|
2130
2207
|
* Start the server
|
|
2131
2208
|
*/
|
|
2132
|
-
async
|
|
2209
|
+
async startStdio() {
|
|
2133
2210
|
try {
|
|
2134
2211
|
// Create stdio transport
|
|
2135
2212
|
const transport = new StdioServerTransport();
|
|
@@ -2140,7 +2217,7 @@ class MCPServer {
|
|
|
2140
2217
|
|
|
2141
2218
|
// Now we can safely log via MCP
|
|
2142
2219
|
console.error(`Registered ${this.tools.size} tools`);
|
|
2143
|
-
this.log('info', `MCP Server started successfully with ${this.tools.size} tools`);
|
|
2220
|
+
this.log('info', `MCP Server with stdio transport started successfully with ${this.tools.size} tools`);
|
|
2144
2221
|
} catch (error) {
|
|
2145
2222
|
console.error("Failed to start MCP server:", error);
|
|
2146
2223
|
process.exit(1);
|
|
@@ -2151,8 +2228,22 @@ class MCPServer {
|
|
|
2151
2228
|
// Start the server
|
|
2152
2229
|
async function main() {
|
|
2153
2230
|
try {
|
|
2231
|
+
const argv = minimist(process.argv.slice(2), {
|
|
2232
|
+
string: ['host'],
|
|
2233
|
+
int: ['port'],
|
|
2234
|
+
boolean: ['sse'],
|
|
2235
|
+
default: {
|
|
2236
|
+
host: '127.0.0.1',
|
|
2237
|
+
port: 8100,
|
|
2238
|
+
}
|
|
2239
|
+
});
|
|
2240
|
+
|
|
2154
2241
|
const server = new MCPServer();
|
|
2155
|
-
|
|
2242
|
+
if (argv.sse) {
|
|
2243
|
+
await server.startSse(argv.host, argv.port);
|
|
2244
|
+
} else {
|
|
2245
|
+
await server.startStdio();
|
|
2246
|
+
}
|
|
2156
2247
|
} catch (error) {
|
|
2157
2248
|
console.error("Failed to start server:", error);
|
|
2158
2249
|
process.exit(1);
|
package/server.ts
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
4
4
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
|
+
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
|
|
6
|
+
import express from "express";
|
|
7
|
+
import {Request, Response} from "express";
|
|
5
8
|
import axios, { AxiosRequestConfig, AxiosError, AxiosResponse } from "axios";
|
|
6
9
|
import { config as dotenvConfig } from "dotenv";
|
|
7
10
|
import {
|
|
@@ -403,6 +406,38 @@ const TOOLS: OpenApiTool[] = [
|
|
|
403
406
|
}
|
|
404
407
|
]
|
|
405
408
|
},
|
|
409
|
+
{
|
|
410
|
+
"name": "domains_checkDomainAvailabilityV1",
|
|
411
|
+
"description": "This endpoint checks the availability of a domain name. Multiple TLDs can be checked at once.\n\nEndpoint has rate limit of 10 requests per minute.",
|
|
412
|
+
"method": "POST",
|
|
413
|
+
"path": "/api/domains/v1/availability",
|
|
414
|
+
"inputSchema": {
|
|
415
|
+
"type": "object",
|
|
416
|
+
"properties": {
|
|
417
|
+
"domain": {
|
|
418
|
+
"type": "string",
|
|
419
|
+
"description": "domain property"
|
|
420
|
+
},
|
|
421
|
+
"tlds": {
|
|
422
|
+
"type": "array",
|
|
423
|
+
"description": "tlds property"
|
|
424
|
+
},
|
|
425
|
+
"with_alternatives": {
|
|
426
|
+
"type": "boolean",
|
|
427
|
+
"description": "with_alternatives property"
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
"required": [
|
|
431
|
+
"domain",
|
|
432
|
+
"tlds"
|
|
433
|
+
]
|
|
434
|
+
},
|
|
435
|
+
"security": [
|
|
436
|
+
{
|
|
437
|
+
"apiToken": []
|
|
438
|
+
}
|
|
439
|
+
]
|
|
440
|
+
},
|
|
406
441
|
{
|
|
407
442
|
"name": "domains_getDomainListV1",
|
|
408
443
|
"description": "This endpoint retrieves a list of all domains associated with your account.",
|
|
@@ -1848,7 +1883,7 @@ const SECURITY_SCHEMES: Record<string, SecurityScheme> = {
|
|
|
1848
1883
|
|
|
1849
1884
|
/**
|
|
1850
1885
|
* MCP Server for Hostinger API
|
|
1851
|
-
* Generated from OpenAPI spec version 0.0.
|
|
1886
|
+
* Generated from OpenAPI spec version 0.0.27
|
|
1852
1887
|
*/
|
|
1853
1888
|
class MCPServer {
|
|
1854
1889
|
private server: Server;
|
|
@@ -1870,7 +1905,7 @@ class MCPServer {
|
|
|
1870
1905
|
this.server = new Server(
|
|
1871
1906
|
{
|
|
1872
1907
|
name: "hostinger-api-mcp",
|
|
1873
|
-
version: "0.0.
|
|
1908
|
+
version: "0.0.12",
|
|
1874
1909
|
},
|
|
1875
1910
|
{
|
|
1876
1911
|
capabilities: {
|
|
@@ -1895,7 +1930,7 @@ class MCPServer {
|
|
|
1895
1930
|
});
|
|
1896
1931
|
}
|
|
1897
1932
|
|
|
1898
|
-
headers['User-Agent'] = 'hostinger-mcp-server/0.0.
|
|
1933
|
+
headers['User-Agent'] = 'hostinger-mcp-server/0.0.12';
|
|
1899
1934
|
|
|
1900
1935
|
return headers;
|
|
1901
1936
|
}
|
|
@@ -2150,11 +2185,53 @@ class MCPServer {
|
|
|
2150
2185
|
}
|
|
2151
2186
|
}
|
|
2152
2187
|
}
|
|
2188
|
+
|
|
2189
|
+
/**
|
|
2190
|
+
* Start the sse server
|
|
2191
|
+
*/
|
|
2192
|
+
async startSse(host: string, port: number): Promise<void> {
|
|
2193
|
+
try {
|
|
2194
|
+
// Create sse transport
|
|
2195
|
+
const app = express();
|
|
2196
|
+
app.use(express.json());
|
|
2197
|
+
|
|
2198
|
+
let transport: SSEServerTransport;
|
|
2199
|
+
const sessions = {} as Record<string, SSEServerTransport>;
|
|
2200
|
+
|
|
2201
|
+
app.get('/sse', (req: Request, res: Response) => {
|
|
2202
|
+
transport = new SSEServerTransport('/messages', res);
|
|
2203
|
+
sessions[transport.sessionId] = transport;
|
|
2204
|
+
|
|
2205
|
+
res.on('close', () => {
|
|
2206
|
+
delete sessions[transport.sessionId];
|
|
2207
|
+
});
|
|
2208
|
+
|
|
2209
|
+
this.server.connect(transport);
|
|
2210
|
+
});
|
|
2211
|
+
|
|
2212
|
+
app.post('/messages', (req: Request, res: Response) => {
|
|
2213
|
+
const sessionId = req.query.sessionId as string;
|
|
2214
|
+
const transport = sessions[sessionId];
|
|
2215
|
+
if (transport) {
|
|
2216
|
+
transport.handlePostMessage(req, res);
|
|
2217
|
+
} else {
|
|
2218
|
+
res.status(400).send('No transport found for sessionId');
|
|
2219
|
+
}
|
|
2220
|
+
});
|
|
2221
|
+
|
|
2222
|
+
app.listen(port, host);
|
|
2223
|
+
this.log('info', `MCP Server with SSE transport started successfully with ${this.tools.size} tools`);
|
|
2224
|
+
this.log('info', `Listening on ${host}:${port}`);
|
|
2225
|
+
} catch (error) {
|
|
2226
|
+
console.error("Failed to start MCP server:", error);
|
|
2227
|
+
process.exit(1);
|
|
2228
|
+
}
|
|
2229
|
+
}
|
|
2153
2230
|
|
|
2154
2231
|
/**
|
|
2155
|
-
* Start the server
|
|
2232
|
+
* Start the stdio server
|
|
2156
2233
|
*/
|
|
2157
|
-
async
|
|
2234
|
+
async startStdio(): Promise<void> {
|
|
2158
2235
|
try {
|
|
2159
2236
|
// Create stdio transport
|
|
2160
2237
|
const transport = new StdioServerTransport();
|
|
@@ -2165,7 +2242,7 @@ class MCPServer {
|
|
|
2165
2242
|
|
|
2166
2243
|
// Now we can safely log via MCP
|
|
2167
2244
|
console.error(`Registered ${this.tools.size} tools`);
|
|
2168
|
-
this.log('info', `MCP Server started successfully with ${this.tools.size} tools`);
|
|
2245
|
+
this.log('info', `MCP Server with stdio transport started successfully with ${this.tools.size} tools`);
|
|
2169
2246
|
} catch (error) {
|
|
2170
2247
|
console.error("Failed to start MCP server:", error);
|
|
2171
2248
|
process.exit(1);
|
|
@@ -2176,8 +2253,23 @@ class MCPServer {
|
|
|
2176
2253
|
// Start the server
|
|
2177
2254
|
async function main(): Promise<void> {
|
|
2178
2255
|
try {
|
|
2256
|
+
const argv = minimist(process.argv.slice(2), {
|
|
2257
|
+
string: ['host'],
|
|
2258
|
+
int: ['port'],
|
|
2259
|
+
boolean: ['sse'],
|
|
2260
|
+
default: {
|
|
2261
|
+
host: '127.0.0.1',
|
|
2262
|
+
port: 8100,
|
|
2263
|
+
}
|
|
2264
|
+
});
|
|
2265
|
+
|
|
2179
2266
|
const server = new MCPServer();
|
|
2180
|
-
|
|
2267
|
+
|
|
2268
|
+
if (argv.sse) {
|
|
2269
|
+
await server.startSse(argv.host, argv.port);
|
|
2270
|
+
} else {
|
|
2271
|
+
await server.startStdio();
|
|
2272
|
+
}
|
|
2181
2273
|
} catch (error) {
|
|
2182
2274
|
console.error("Failed to start server:", error);
|
|
2183
2275
|
process.exit(1);
|
package/types.d.ts
CHANGED
|
@@ -257,6 +257,29 @@ If there is validation error, the response will fail with `422 Validation error`
|
|
|
257
257
|
response: any; // Response structure will depend on the API
|
|
258
258
|
};
|
|
259
259
|
|
|
260
|
+
/**
|
|
261
|
+
* This endpoint checks the availability of a domain name. Multiple TLDs can be checked at once.
|
|
262
|
+
|
|
263
|
+
Endpoint has rate limit of 10 requests per minute.
|
|
264
|
+
*/
|
|
265
|
+
"undefined": {
|
|
266
|
+
params: {
|
|
267
|
+
/**
|
|
268
|
+
* domain property
|
|
269
|
+
*/
|
|
270
|
+
domain: string;
|
|
271
|
+
/**
|
|
272
|
+
* tlds property
|
|
273
|
+
*/
|
|
274
|
+
tlds: array;
|
|
275
|
+
/**
|
|
276
|
+
* with_alternatives property
|
|
277
|
+
*/
|
|
278
|
+
with_alternatives?: boolean;
|
|
279
|
+
};
|
|
280
|
+
response: any; // Response structure will depend on the API
|
|
281
|
+
};
|
|
282
|
+
|
|
260
283
|
/**
|
|
261
284
|
* This endpoint retrieves a list of all domains associated with your account.
|
|
262
285
|
*/
|