get_my_ip
Retrieve your current public IP address to identify your network's external presence for cybersecurity analysis and Shodan API integration.
Instructions
Get your current IP address as seen from the Internet
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:1674-1692 (handler)MCP tool handler for 'get_my_ip' that invokes shodanClient.getMyIp() and formats the response as JSON text.case "get_my_ip": { try { const myIp = await shodanClient.getMyIp(); return { content: [{ type: "text", text: JSON.stringify(myIp, null, 2) }] }; } catch (error) { if (error instanceof McpError) { throw error; } throw new McpError( ErrorCode.InternalError, `Error getting IP address: ${(error as Error).message}` ); } }
- src/index.ts:1079-1086 (registration)Tool registration in ListToolsRequestSchema handler, including name, description, and empty input schema.{ name: "get_my_ip", description: "Get your current IP address as seen from the Internet", inputSchema: { type: "object", properties: {} } },
- src/index.ts:474-487 (helper)ShodanClient helper method that queries the Shodan API endpoint '/tools/myip' to retrieve the current IP address.async getMyIp(): Promise<any> { try { const response = await this.axiosInstance.get("/tools/myip"); return { ip: 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; } }