#!/usr/bin/env node
/**
* Gandi MCP Server
*
* Standalone server for managing Gandi domains and DNS records via API.
*
* Required environment variables:
* - GANDI_API_TOKEN (required) - Your Gandi API token
*
* Available tools:
*
* Domain Tools:
* - gandi_domains_list: List all domains
* - gandi_domains_get: Get domain details
* - gandi_domains_check: Check domain availability
* - gandi_domains_contacts: List domain contacts
*
* DNS Tools (LiveDNS):
* - gandi_dns_records_list: List DNS records
* - gandi_dns_record_get: Get specific DNS record
* - gandi_dns_record_create: Create DNS record
* - gandi_dns_record_update: Update DNS record
* - gandi_dns_record_delete: Delete DNS record
*/
import { createMCPServer, startMCPServer, type ToolDefinition } from "./lib/mcp-core.js";
import { GandiClient, getGandiCredentials } from "./lib/client.js";
import { createDomainTools } from "./tools/domains.js";
import { createDNSTools } from "./tools/dns.js";
async function initServer() {
try {
// Get credentials from environment variables
const credentials = getGandiCredentials();
// Create client with credentials
const client = new GandiClient(credentials);
// Create tools
const tools: ToolDefinition[] = [
...createDomainTools(client),
...createDNSTools(client),
];
const server = createMCPServer(
{
name: "gandi-mcp",
version: "1.0.0",
description: "Gandi domain and DNS management via API",
},
tools
);
// Start server
await startMCPServer(server);
console.error(`[MCP] Gandi server ready with ${tools.length} tools`);
} catch (error) {
console.error('[MCP] Failed to start server:', error);
process.exit(1);
}
}
// Initialize and start server
initServer().catch(console.error);