UNPKG

whodis-mcp-server

Version:

Whodis MCP Server for checking the availability of domain names using WHOIS lookups.

54 lines (49 loc) 2.81 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const logger_util_js_1 = require("../utils/logger.util.js"); const error_util_js_1 = require("../utils/error.util.js"); const ipaddress_controller_js_1 = __importDefault(require("../controllers/ipaddress.controller.js")); /** * Register IP address CLI commands * @param program The Commander program instance */ function register(program) { const cliLogger = logger_util_js_1.Logger.forContext('cli/ipaddress.cli.ts', 'register'); cliLogger.debug(`Registering IP address CLI commands...`); program .command('get-ip-details') .description(`Get geolocation and network details about an IP address or the current device. PURPOSE: Retrieve comprehensive information about an IP address including geographical location, ISP, organization, and network details. Use Case: Useful for identifying the location of an IP address, determining network ownership, or checking your own public IP information. Output: Formatted Markdown containing location data (country, region, city), network information (ISP, organization, AS number), coordinates, and a link to view the location on a map. Examples: $ mcp-ipaddress get-ip-details $ mcp-ipaddress get-ip-details 8.8.8.8 $ mcp-ipaddress get-ip-details 1.1.1.1`) .argument('[ipAddress]', 'IP address to lookup (optional, omit for current device)') .option('--extended', 'Include extended data like ASN, mobile and proxy detection') .option('--https', 'Use HTTPS for API requests (may require paid API key)') .action(async (ipAddress, cmdOptions) => { const commandLogger = logger_util_js_1.Logger.forContext('cli/ipaddress.cli.ts', 'get-ip-details'); try { commandLogger.debug(`Processing IP details request for ${ipAddress || 'current device'}`, cmdOptions); // Map CLI options to controller options const controllerOptions = { includeExtendedData: cmdOptions?.extended || false, useHttps: cmdOptions?.https || false, }; commandLogger.debug('Calling controller with options', controllerOptions); const result = await ipaddress_controller_js_1.default.get(ipAddress, controllerOptions); commandLogger.debug(`IP details retrieved successfully`); console.log(result.content); } catch (error) { (0, error_util_js_1.handleCliError)(error); } }); cliLogger.debug('IP address CLI commands registered successfully'); } exports.default = { register };