Skip to main content
Glama

ip_lookup

Retrieve comprehensive IP address information including geolocation, open ports, running services, SSL certificates, hostnames, and cloud provider details. Returns service banners and HTTP server data when available.

Instructions

Retrieve comprehensive information about an IP address, including geolocation, open ports, running services, SSL certificates, hostnames, and cloud provider details if available. Returns service banners and HTTP server information when present.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ipYesThe IP address to query.

Implementation Reference

  • Handler for the ip_lookup tool: validates input using IpLookupArgsSchema, queries the Shodan host API for the given IP, formats the response including IP details, geolocation, open ports/services, cloud info, hostnames, and returns it as formatted JSON text content.
    case "ip_lookup": { const parsedIpArgs = IpLookupArgsSchema.safeParse(args); if (!parsedIpArgs.success) { throw new Error("Invalid ip_lookup arguments"); } const result = await queryShodan(`/shodan/host/${parsedIpArgs.data.ip}`, {}); // Format the response in a user-friendly way const formattedResult = { "IP Information": { "IP Address": result.ip_str, "Organization": result.org, "ISP": result.isp, "ASN": result.asn, "Last Update": result.last_update }, "Location": { "Country": result.country_name, "City": result.city, "Coordinates": `${result.latitude}, ${result.longitude}`, "Region": result.region_code }, "Services": result.ports.map((port: number) => { const service = result.data.find((d: ShodanService) => d.port === port); return { "Port": port, "Protocol": service?.transport || "unknown", "Service": service?.data?.trim() || "No banner", ...(service?.http ? { "HTTP": { "Server": service.http.server, "Title": service.http.title, } } : {}) }; }), "Cloud Provider": result.data[0]?.cloud ? { "Provider": result.data[0].cloud.provider, "Service": result.data[0].cloud.service, "Region": result.data[0].cloud.region } : "Not detected", "Hostnames": result.hostnames || [], "Domains": result.domains || [], "Tags": result.tags || [] }; return { content: [ { type: "text", text: JSON.stringify(formattedResult, null, 2), }, ], }; }
  • Zod schema defining the input for ip_lookup tool: requires an 'ip' string parameter.
    const IpLookupArgsSchema = z.object({ ip: z.string().describe("The IP address to query."), });
  • src/index.ts:316-320 (registration)
    Registers the ip_lookup tool in the tools list returned by ListToolsRequestSchema handler, including name, description, and input schema converted to JSON schema.
    { name: "ip_lookup", description: "Retrieve comprehensive information about an IP address, including geolocation, open ports, running services, SSL certificates, hostnames, and cloud provider details if available. Returns service banners and HTTP server information when present.", inputSchema: zodToJsonSchema(IpLookupArgsSchema), },

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/BurtTheCoder/mcp-shodan'

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