Skip to main content
Glama

reverse_dns_lookup

Retrieve hostnames associated with IP addresses using reverse DNS lookup on the Shodan MCP Server, aiding in cybersecurity research and threat intelligence.

Instructions

Get hostnames for IP addresses using reverse DNS lookup

Input Schema

NameRequiredDescriptionDefault
ipsYesList of IP addresses to lookup (e.g., ['8.8.8.8', '1.1.1.1'])

Input Schema (JSON Schema)

{ "properties": { "ips": { "description": "List of IP addresses to lookup (e.g., ['8.8.8.8', '1.1.1.1'])", "items": { "type": "string" }, "type": "array" } }, "required": [ "ips" ], "type": "object" }

Implementation Reference

  • MCP CallToolRequest handler case for 'reverse_dns_lookup': validates ips array input, calls ShodanClient.reverseDnsLookup, formats response as JSON text.
    case "reverse_dns_lookup": { const ips = request.params.arguments?.ips; if (!Array.isArray(ips) || ips.length === 0) { throw new McpError( ErrorCode.InvalidParams, "IPs array is required" ); } try { const reverseDnsResults = await shodanClient.reverseDnsLookup(ips.map(String)); return { content: [{ type: "text", text: JSON.stringify(reverseDnsResults, null, 2) }] }; } catch (error) { if (error instanceof McpError) { throw error; } throw new McpError( ErrorCode.InternalError, `Error performing reverse DNS lookup: ${(error as Error).message}` ); } }
  • src/index.ts:1105-1120 (registration)
    Tool registration in ListToolsRequest handler: defines name, description, and input schema for reverse_dns_lookup.
    name: "reverse_dns_lookup", description: "Get hostnames for IP addresses using reverse DNS lookup", inputSchema: { type: "object", properties: { ips: { type: "array", items: { type: "string" }, description: "List of IP addresses to lookup (e.g., ['8.8.8.8', '1.1.1.1'])" } }, required: ["ips"] } },
  • ShodanClient helper method: performs reverse DNS lookup by calling Shodan API /dns/reverse endpoint with comma-separated IPs.
    async reverseDnsLookup(ips: string[]): Promise<any> { try { const response = await this.axiosInstance.get("/dns/reverse", { params: { ips: ips.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 reverse_dns_lookup tool: requires 'ips' array of strings.
    type: "object", properties: { ips: { type: "array", items: { type: "string" }, description: "List of IP addresses to lookup (e.g., ['8.8.8.8', '1.1.1.1'])" } }, required: ["ips"] }

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