Skip to main content
Glama

dns_lookup

Resolve hostnames to IP addresses for cybersecurity research and threat intelligence using DNS lookup.

Instructions

Resolve hostnames to IP addresses using DNS lookup

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hostnamesYesList of hostnames to resolve (e.g., ['google.com', 'facebook.com'])

Implementation Reference

  • MCP tool handler for 'dns_lookup' in the CallToolRequestSchema switch statement. Validates input, calls ShodanClient.dnsLookup, and formats response.
    case "dns_lookup": { const hostnames = request.params.arguments?.hostnames; if (!Array.isArray(hostnames) || hostnames.length === 0) { throw new McpError( ErrorCode.InvalidParams, "Hostnames array is required" ); } try { const dnsResults = await shodanClient.dnsLookup(hostnames.map(String)); return { content: [{ type: "text", text: JSON.stringify(dnsResults, null, 2) }] }; } catch (error) { if (error instanceof McpError) { throw error; } throw new McpError( ErrorCode.InternalError, `Error performing DNS lookup: ${(error as Error).message}` ); }
  • ShodanClient method that performs the actual DNS lookup API call to Shodan /dns/resolve endpoint.
    async dnsLookup(hostnames: string[]): Promise<any> { try { const response = await this.axiosInstance.get("/dns/resolve", { params: { hostnames: hostnames.join(',') } }); return response.data; } catch (error: unknown) { if (axios.isAxiosError(error)) { throw new McpError( ErrorCode.InternalError, `Shodan API error: ${error.response?.data?.error || error.message}` ); } throw error; } }
  • Input schema definition for the 'dns_lookup' tool in the ListToolsRequestSchema response.
    name: "dns_lookup", description: "Resolve hostnames to IP addresses using DNS lookup", inputSchema: { type: "object", properties: { hostnames: { type: "array", items: { type: "string" }, description: "List of hostnames to resolve (e.g., ['google.com', 'facebook.com'])" } }, required: ["hostnames"] }
  • src/index.ts:1087-1103 (registration)
    Registration of the 'dns_lookup' tool in the tools list returned by ListToolsRequestSchema handler.
    { name: "dns_lookup", description: "Resolve hostnames to IP addresses using DNS lookup", inputSchema: { type: "object", properties: { hostnames: { type: "array", items: { type: "string" }, description: "List of hostnames to resolve (e.g., ['google.com', 'facebook.com'])" } }, required: ["hostnames"] } },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Cyreslab-AI/shodan-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server